Page 1 of 1

Count number of records in input file

Posted: Wed Aug 24, 2016 11:25 am
by prachi249
Hi,

My requirement is -
In my JCL step I need to find the total count of records in input file, if its more than 50K then I won't be running further steps in the JCL, else I run them.

Could you please help me with this?

Re: Count number of records in input file

Posted: Wed Aug 31, 2016 9:57 am
by magesh_j
prachi249 wrote:Hi,

My requirement is -
In my JCL step I need to find the total count of records in input file, if its more than 50K then I won't be running further steps in the JCL, else I run them.

Could you please help me with this?
Quite simple,

Assuming your input LRECL 80 bytes

use the below sort code

Code: Select all

//SYSIN DD *
  OPTION COPY,STOPAFT=50002
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD)),
        IFTHEN=(WHEN=(81,8,ZD,GT,50000),OVERLAY=(89:C'A'))
  OUTFIL INCLUDE=(89,1,CH,EQ,C'A'),NULLOFL=RC4  
This step will set return code 0, when you have records more than 50K and set 04, when it is less than or equal to 50K.

now you need to handle other steps condition to execute when RC is 04.

Thanks
Magesh

Posted: Thu Feb 09, 2017 2:01 pm
by Charinthara07