Dean wrote:Thanks Guys,
One last idea. is there a way to test for the Return code in the OUTREC uisng an IFTHEN to build a custom line like
OUTREC IFTHEN=(WHEN=(RC4, BUILD=('NO RECORDS SELECTED')
Dean,
You canNOT check the RC using IFTHEN. INREC/OUTREC all work on data records. So if your file is empty, the inrec/outrec statements will not be executed.
You can create a file with the text "$$$$ NO RESULTS FOR THIS REPORT " and concatenate it to the input file. And now we can control what text we want to write out based on the input.
ex: Assuming you have 3 records you run the job as shown below
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
----+----1----+----2----+----3----+----4----+----5----+----
RECORD - 1
RECORD - 2
RECORD - 3
// DD *
$$$$ NO RESULTS FOR THIS REPORT
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFOUTLEN=80,
IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,3,ZD,START=0)),
IFTHEN=(WHEN=(1,4,CH,EQ,C'$$$$',AND,81,3,ZD,GT,0),
OVERLAY=(24X,C'NUMBER OF RECORDS SELECTED: ',81,3)),
IFTHEN=(WHEN=(1,4,CH,EQ,C'$$$$',AND,81,3,ZD,EQ,0),
OVERLAY=(24X))
//*
The output of this is :
RECORD - 1
RECORD - 2
RECORD - 3
NUMBER OF RECORDS SELECTED: 003
Now lets say your input file is empty , then run the same jcl and the output would be
NO RESULTS FOR THIS REPORT
This is the job that produces that output (check how SORTIN DD * does not have any records.
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
// DD *
$$$$ NO RESULTS FOR THIS REPORT
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFOUTLEN=80,
IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,3,ZD,START=0)),
IFTHEN=(WHEN=(1,4,CH,EQ,C'$$$$',AND,81,3,ZD,GT,0),
OVERLAY=(24X,C'NUMBER OF RECORDS SELECTED: ',81,3)),
IFTHEN=(WHEN=(1,4,CH,EQ,C'$$$$',AND,81,3,ZD,EQ,0),
OVERLAY=(24X))
//*