I'm trying to extract the same spool dataset from several job executions but not getting the desired result, I'm just getting one spool dataset in my output.
The MYJOB job runs 50 times a day, and this job has a spool called OUTPUT, here's my code.
rc=isfcalls("ON")
isfcols2="JNAME STEPN DATEE TIMEE"
isfsort="JNAME A DATEE A TIMEE A"
isffilter="DATEE EQ 2017.110"
ISFPRTDDNAME = OUTF
ADDRESS SDSF "ISFEXEC ST MYJOB (ALTERNATE DELAYED)"
IF rc<>0 THEN CALL msgrtn
SAY "No of jobs "||JNAME.0
IF jname.0 > 0 THEN DO
DO j=1 TO JNAME.0
/* get spool list for selected job */
ADDRESS SDSF "ISFACT ST TOKEN('"TOKEN.j"') PARM(NP ?) (PREFIX JDS_)"
IF rc<>0 THEN CALL msgrtn
/* OUTPUT spool dataset is number 21 */
js=21
IF j < JNAME.0 THEN
ADDRESS SDSF "ISFACT ST TOKEN('"JDS_TOKEN.js"') PARM(NP XF)"
ELSE
ADDRESS SDSF "ISFACT ST TOKEN('"JDS_TOKEN.js"') PARM(NP XFC)"
END /* MAIN LOOP */
END
rc=isfcalls('OFF')
EXIT
isfcols2="JNAME STEPN DATEE TIMEE"
isfsort="JNAME A DATEE A TIMEE A"
isffilter="DATEE EQ 2017.110"
ISFPRTDDNAME = OUTF
ADDRESS SDSF "ISFEXEC ST MYJOB (ALTERNATE DELAYED)"
IF rc<>0 THEN CALL msgrtn
SAY "No of jobs "||JNAME.0
IF jname.0 > 0 THEN DO
DO j=1 TO JNAME.0
/* get spool list for selected job */
ADDRESS SDSF "ISFACT ST TOKEN('"TOKEN.j"') PARM(NP ?) (PREFIX JDS_)"
IF rc<>0 THEN CALL msgrtn
/* OUTPUT spool dataset is number 21 */
js=21
IF j < JNAME.0 THEN
ADDRESS SDSF "ISFACT ST TOKEN('"JDS_TOKEN.js"') PARM(NP XF)"
ELSE
ADDRESS SDSF "ISFACT ST TOKEN('"JDS_TOKEN.js"') PARM(NP XFC)"
END /* MAIN LOOP */
END
rc=isfcalls('OFF')
EXIT
I also tried
SELECT
WHEN j = 1 THEN
DO
SAY j||". XF"
ADDRESS SDSF "ISFACT ST TOKEN('"JDS_TOKEN.js"') PARM(NP XF)"
END
WHEN j = 3 THEN /*JNAME.0 THEN*/
DO
SAY j||". XC"
ADDRESS SDSF "ISFACT ST TOKEN('"JDS_TOKEN.js"') PARM(NP XC)"
END
OTHERWISE
DO
SAY j||". XF"
ADDRESS SDSF "ISFACT ST TOKEN('"JDS_TOKEN.js"') PARM(NP X)"
END
WHEN j = 1 THEN
DO
SAY j||". XF"
ADDRESS SDSF "ISFACT ST TOKEN('"JDS_TOKEN.js"') PARM(NP XF)"
END
WHEN j = 3 THEN /*JNAME.0 THEN*/
DO
SAY j||". XC"
ADDRESS SDSF "ISFACT ST TOKEN('"JDS_TOKEN.js"') PARM(NP XC)"
END
OTHERWISE
DO
SAY j||". XF"
ADDRESS SDSF "ISFACT ST TOKEN('"JDS_TOKEN.js"') PARM(NP X)"
END