Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to capture output from LDAPSRCH

Status
Not open for further replies.

Adam5

Programmer
Oct 13, 2005
18
DE
Hello,

I want to make an LDAP-search with the REXX-EXEC LDAPSRCH. This z/OS utility can be used to get attributes of LDAP-entries. It can be found on HLQ.SGLDEXEC(LDAPSRCH) and is documented in "IBM Tivoli Directory Server Client Programming for z/OS" (
The request is working fine. The LDAPSRCH-command writes the output to the terminal. Unfortunately I can't trap the output, when I'm calling the command online within rexx:

Code:
call LDAPSRCH '-h ldaphost ',
'-D CN=userid,OU=Benutzerkonten,DC=bk,DC=xxxxx,DC=de -w password ',    
'-b CN='!!user!!',OU=Benutzerkonten,DC=bk,DC=xxxxx,DC=de objectclass=* ',
'department displayName sn extensionAttribute extensionAttribute1 ',    
'telephoneNumber'
I've tried to allocate SYSPRINT, SYSOUT, STDOUT, OUTPUT but the output have not been written into the allocated files. OUTTRAP also doesn't work.

But if I execute the command within an JCL with DD-Name SYSPRINT, then the output from LDAPSRCH is written to SYSPRINT!

I don't understand this behaviour!

Does anybody have an idea, how I can trap the output from this command?

Thanks

Adam
 
How are you allocating SYSPRINT?

Post the code.


Frank Clarke
Tampa Area REXX Programmers' Alliance
REXX Language Assn Listmaster
 
Hello,

in the JCL SYSPRINT is allocated like:
Code:
//SYSPRINT DD DSN=TXXXXXA.FTP.OUTPUT,DISP=SHR
This file already exists:
Code:
Organization  . . . : PS   
Record format . . . : VB   
Record length . . . : 1028

Here is the code how I'm allocating SYSPRINT dynamically within REXX:
Code:
"FREE F(SYSPRINT)"                               
"ALLOC F(SYSPRINT) DSN('TXXXXXA.FTP.OUTPUT') SHR"

Whery strange!
 
Do you see your output on the terminal if you
Code:
"ALLOC FI(SYSPRINT) DA(*) REU"

Frank Clarke
Tampa Area REXX Programmers' Alliance
REXX Language Assn Listmaster
 
Hello,

I've found a solution how to pipe the output of LDAPSRCH into a file[smile]. I had this idea, after I saw a JCL in HLQ.SGLDSAMP - library. It works like piping stdout & stderr in USS. Here ist my REXX-code:
Code:
  'FREE F(DSOUT)'                                                        
 'alloc f(DSOUT) lrecl(1024) recfm(V,B) new reuse'                       
  say 'alloc rc:' rc                                                     
  'FREE F(DSERR)'                                                        
 'alloc f(DSERR) lrecl(1024) recfm(V,B) new reuse'                       
  say 'alloc rc:' rc                                                     
                                                                         
  call LDAPSRCH '-h bk.datev.de ',                                       
  '-D CN=xxxxxxx,OU=Benutzerkonten,DC=bk,DC=xxxxx,DC=de -w xxxxxxxx ',   
  '-b CN='!!user!!',OU=Benutzerkonten,DC=bk,DC=xxxxx,DC=de objectclass=* ',
  'department displayName sn extensionAttribute extensionAttribute1 ',   
  'telephoneNumber [b]1>DD:DSOUT 2>DD:DSERR' [/b]                               
  /*                                                                     
  'telephoneNumber  > DD:DSOUT 2>&1'                                     
  */                                                                     
 msgrc = result                                                          
 say 'LDAPSRCH rc:' msgrc                                                

 address tso "execio * diskr DSOUT (STEM dsout. finis) "                 
 do i = 1 to dsout.0                                                     
   say 'ldapoutput:' dsout.i                                             
 end                                                                     
  "FREE F(DSOUT)"                                                        
                                                                         
 address tso "execio * diskr DSERR (STEM dserr. finis) "                 
 do i = 1 to dserr.0                                                     
   say 'ldaperror:' dserr.i                                              
 end                                                                     
  "FREE F(DSERR)"

This is realy strange notation for trapping the output from a TSO-Command. I'm wondering, that this works in TSO!

Thanks

Adam
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top