View previous topic :: View next topic
|
Author |
Message |
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1744 Location: Tirupur, India
|
|
|
|
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 |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2593 Location: Silicon Valley
|
|
|
|
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 |
|
|
Willy Jensen
Active Member
Joined: 01 Sep 2015 Posts: 730 Location: Denmark
|
|
|
|
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 |
|
|
Willy Jensen
Active Member
Joined: 01 Sep 2015 Posts: 730 Location: Denmark
|
|
|
|
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 |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1744 Location: Tirupur, India
|
|
|
|
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 |
|
|
|