|
View previous topic :: View next topic
|
| Author |
Message |
danny companez
New User
Joined: 09 Mar 2022 Posts: 2 Location: Australia
|
|
|
|
I have a job with //PRINTR1 DD SYSOUT=* in it. I want to use the ISFACT REXX commands to capture it and put it in a dataset.
I successfully issue ISFACT ST and loop through the returned results till I find the correct job. Great!
Having found the job I issue ISFACT ST token(job_token) PARM(NP ?) to see all its datasets. Great!
I then iterate through these and find my matching DDNAME.index = "PRINTR1". Great!
I then want to use the PARM(NP SA) as described in various places to get the dataset allocation but it always fails with RC=8 and "ISF746E Action request rejected, row token invalid."
I really want this process to work, and hope that someone out there has succeeded and can help me.
I have also tried a different approach.
Having found the job, I issue ISFACT ST Token(job_token) PARM(NP SA) to allocate ALL the job's datasets.
This time I iterate through the results but cannot identify which is PRINTR1 because the ISFDDNAME.n is of the form SYSnnnn and the ISFDSNAME.n has a question mark for where I would like PRINTR1 to be.
TIA |
|
| Back to top |
|
 |
Willy Jensen
Active Member

Joined: 01 Sep 2015 Posts: 777 Location: Denmark
|
|
|
|
I have found that the trick is to use PARM(NP SA) and PARM(NP ?) together to get all information for a job, as shown in the sample below. Note the 'prefix' parameter in the second ISFACT ST. Actually in your case, you only need the 2nd ISFACT ST. The sample was taken from a larger program.
| Code: |
address syscall 'sleep 5' /* sometimes neccessary */
call syscalls 'ON'
isfprefix=mvsvar('symdef','jobname') /* jobname (me) */
say 'Looking for self' isfprefix
rc=isfcalls('ON')
Address SDSF "ISFEXEC ST"
if rc<>0 then call SdsfErr 'ST'
do ji=1 to jobid.0 until queue.ji='EXECUTION'
end
if ji>jobid.0 then exit xmsg('Job not found',8)
say 'Job selected:' jname.ji jobid.ji
Address SDSF "ISFACT ST TOKEN('"TOKEN.ji"') PARM(NP SA)"
Address SDSF "ISFACT ST TOKEN('"TOKEN.ji"') PARM(NP ?) (prefix j_"
say 'Procstep Stepname DDname Dsname'
do idd = 1 to j_ddname.0
say l8(j_procs.idd) l8(j_stepn.idd) l8(j_ddname.idd) j_dsname.idd
end
exit xmsg('Ok')
l8: return left(arg(1),8)
SdsfErr:
say arg(1)':' isfmsg
say isfdisplay
do i=1 to isfmsg2.0
say isfmsg2.i
end
exit 12
XMsg: if arg(1)<>'' then say arg(1);return word(arg(2) 0,1) |
|
|
| Back to top |
|
 |
Willy Jensen
Active Member

Joined: 01 Sep 2015 Posts: 777 Location: Denmark
|
|
|
|
Sorry, you do need both ISFACTs to get the ddname for reading the data.
Altered sample section, listing ddname SYSUT2 from step A:
| Code: |
say 'Job selected:' jname.ji jobid.ji
Address SDSF "ISFACT ST TOKEN('"TOKEN.ji"') PARM(NP SA)"
Address SDSF "ISFACT ST TOKEN('"TOKEN.ji"') PARM(NP ?) (prefix j_"
say 'Procstep Stepname DDname Sysddn Dsname'
dd#=0
do idd = 1 to j_ddname.0
say l8(j_procs.idd) l8(j_stepn.idd) l8(j_ddname.idd) ,
isfddname.idd j_dsname.idd
if j_stepn.idd j_ddname.idd='A SYSUT2' then dd#=idd
end
if dd#<>0 then do
say 'Listing step A ddname SYSUT2:'
"execio * diskr" isfddname.dd# "(stem lst. finis)"
do #=1 to lst.0
say '->' lst.#
end
end |
|
|
| Back to top |
|
 |
danny companez
New User
Joined: 09 Mar 2022 Posts: 2 Location: Australia
|
|
|
|
Hi Willy,
Thank you so much. I got it working by using your code. The idea of doing the PARM(NP SA) followed by PARM(NP ?) PREFIX j_ is pure genius. My problem was that it returns a J_TOKEN and I tried to use that instead of the ji token. That explains the "row token invalid" message.
Thanks
Danny |
|
| Back to top |
|
 |
|
|