One Jcl question
We have 3 steps in jcl, Step1 Step2 Step3 If step 1 output empty ,then step2 need to run else step 3 need to be run. Any one know answer? It should not be add any new steps and solution should be thru jcl only
One Jcl question
We have 3 steps in jcl, Step1 Step2 Step3 If step 1 output empty ,then step2 need to run else step 3 need to be run. Any one know answer? It should not be add any new steps and solution should be thru jcl only
if you would like to do that with JCL there are several possibilities. I give you my favorite one:
//* Using IDCAMS
//* -------------------------------------------------------------------
//* Sets RC=0000 if dataset has records. *
//* Sets RC=0004 if dataset is empty. *
//*-------------------------------------------------------------------*
//IDCAMS0 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//MYFILE DD DISP=SHR,DSN=<Dataset Name>
//SYSIN DD *
PRINT INFILE(MYFILE) CHARACTER COUNT(1)
Regards, Andreas
I wouldn't call it an elegant solution, but one simple way to handle this is to write yourself a short program that runs after step 1 and before step 2. This program checks to see if the output file from step 1 is empty or not, setting the return code to indicate one from the other, and then you can use standard JCL COND checking on the subsequent steps to get the result you want.
There are lots of ways to check for empty files...I'd use stat() in C/C++, but it can be done in Java and even REXX or other scripting languages if you prefer. In worst case, you just open and read the input file, returning the empty return code if you get an immediate EOF, otherwise return the non-empty return code.