IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

XDC SDSF output to temp dataset


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Fri Jul 07, 2023 1:58 am
Reply with quote

Hi,

I have a program which calls SDSF API, and performs an XDC to a TEMP dataset, as below.

Code:
ADDRESS ISPEXEC "VGET (ZTEMPF) SHARED"   
               
ISFPRTDSNAME = "'"||ZTEMPF||"'"                         
ISFPRTDISP="SHR"                                         
ADDRESS SDSF "ISFACT ST TOKEN('"PASSTOKEN"') PARM(NP XDC)"
ISFMSG = ISFCALLS("OFF")             
                   
ADDRESS TSO                                             
"ALLOC F(INFILE) DSN('"ZTEMPF"') SHR REU"               
"EXECIO * DISKR INFILE ( FINIS STEM MYFILE."             
"FREE F(INFILE)"                                         


The ZTEMPF file is of LRECL 80, but the XDC contents are of LRECL 133.
Could you please let me know how to make a call to SDSF API and write the contents to a TEMP dataset with LRECL 133 and then read it later. Thank you.

Regards,
Vasanth.S
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2547
Location: Silicon Valley

PostPosted: Fri Jul 07, 2023 4:15 am
Reply with quote

Based on the code that you show, I do not believe that ZTEMPF is required. I think you can allocate any dataset for use as ISFPRTDSNAME or for INFILE.

If you insist on ZTEMPF, try reallocating ISPFILE with a different temp dsn with attributes of your choosing.
Back to top
View user's profile Send private message
Willy Jensen

Active Member


Joined: 01 Sep 2015
Posts: 712
Location: Denmark

PostPosted: Fri Jul 07, 2023 1:01 pm
Reply with quote

You write 'then read it later', you do know that you can read a jobs output directly?
Here is a sample
Code:
/*                                                      rexx
 Browse job output                                         
*/                                                         
 address TSO                                               
 arg jbn jid .  /* i.e. DSREST JOB00572 */                 
                                                           
 rc=isfcalls('ON')                                         
 isfprefix=jbn                                             
 isfdest  ='LOCAL'                                         
 Address SDSF "ISFEXEC ST"                                 
 if rc<>0 then call msgrtn rc "ISFEXEC ST"                 
                                                           
 ok=0                                                       
 do jn=1 to JNAME.0  until ok   /* locate job */           
   say jobid.jn                                             
   ok=(jobid.jn=jid)                                       
 end                                                       
 if \ok then exit xmsg('not found')                         
                                                           
 Address SDSF "ISFACT ST TOKEN('"TOKEN.jn"') PARM(NP SA)"   
 if rc<>0 then call msgrtn rc "ISFACT ST TOKEN"             
 /* The data set name for each allocated data   */         
 /* set is contained in the isfdsname stem. The */         
 /* ddname returned by allocation is contained  */         
 /* in the isfddname stem.                      */         
 Say 'Output data sets in job'                             
 do n=1 to isfddname.0                                     
   say ' 'isfddname.n isfdsname.0                           
 end                                                       
 Say 'Listing log'                                         
 "execio * diskr" isfddname.1 "(stem line. finis"           
 Say 'File contains' line.0 "lines"                         
 do ln = 1 to line.0                                       
   say line.ln                                             
 end                                                       
 Exit xmsg('Done..')                                       
                                                           
XMsg: if arg(1)<>'' then say arg(1);return word(arg(2) 0,1)
                                                           
Msgrtn:    /* subroutine to list error messages */         
 arg msgrc msgfunc                                         
 if msgrc=0 then return                                     
 say msgrc 'returned from' msgfunc                         
 if isfmsg<>"" then Say "isfmsg is:" isfmsg                 
 do msgix=1 to isfmsg2.0                                   
   Say "isfmsg2."msgix "is:" isfmsg2.msgix                 
 end                                                       
 exit 8                                                     
Back to top
View user's profile Send private message
Willy Jensen

Active Member


Joined: 01 Sep 2015
Posts: 712
Location: Denmark

PostPosted: Fri Jul 07, 2023 1:23 pm
Reply with quote

Sorry, small error in the sample concerning display of dsnames in job. This new sample also uses the ISF filter rather than looping through jobs.
Code:
/*                                                      rexx
 Browse job output                                         
*/                                                         
 address TSO                                               
 arg jbn jid .  /* i.e. DSREST JOB00572 */                 
                                                           
 rc=isfcalls('ON')                                         
 isfprefix=jbn                                             
 isfdest  ='LOCAL'                                         
 parse value 'AND jobid eq' jid with isffiltermode isffilter
 Address SDSF "ISFEXEC ST"                                 
 if rc<>0 then call msgrtn rc "ISFEXEC ST"                 
 if jobid.0=0 then exit xmsg('not found')                   
                                                           
 Address SDSF "ISFACT ST TOKEN('"TOKEN.1"') PARM(NP SA)"   
 if rc<>0 then call msgrtn rc "ISFACT ST TOKEN"             
 /* The data set name is in the isfdsname stem. */         
 /* The dd name is in the isfddname stem.       */         
 Say 'Output data sets in job'                             
 do n=1 to isfddname.0                                     
   say ' 'isfddname.n isfdsname.n                           
 end                                                       
 Say 'Listing log'                                         
 "execio * diskr" isfddname.1 "(stem line. finis"           
 Say 'File contains' line.0 "lines"                         
 do ln = 1 to line.0                                       
   say line.ln                                             
 end                                                       
 Exit xmsg('Done..')                                       
                                                           
XMsg: if arg(1)<>'' then say arg(1);return word(arg(2) 0,1)
                                                           
Msgrtn:    /* subroutine to list error messages */         
 arg msgrc msgfunc                                         
 if msgrc=0 then return                                     
 say msgrc 'returned from' msgfunc                         
 if isfmsg<>"" then Say "isfmsg is:" isfmsg                 
 do msgix=1 to isfmsg2.0                                   
   Say "isfmsg2."msgix "is:" isfmsg2.msgix                 
 end                                                       
 exit 8                                                     
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Fri Jul 07, 2023 6:49 pm
Reply with quote

Thank you very much WJ, this is an elegant solution. I am going to rewrite my code and remove the need for temp file.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts Execute secondary panel of sdsf with ... CLIST & REXX 1
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts Routing command Address SDSF to other... TSO/ISPF 2
Search our Forums:

Back to Top