Count number of records in input file

In this Mainframe Forum - You can post your queries on JCL, OS/390 JCL, MVS JCL, z/OS JCL, JES2 & JES3

Moderators: Frank Yaeger, DikDude, Moderator Group

Post Reply
prachi249
Member
Posts: 1
Joined: Wed Aug 24, 2016 11:21 am

Count number of records in input file

Post by prachi249 » Wed Aug 24, 2016 11:25 am

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?

magesh_j
Member
Posts: 16
Joined: Wed Aug 31, 2016 8:32 am

Re: Count number of records in input file

Post by magesh_j » Wed Aug 31, 2016 9:57 am

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

Charinthara07
Member
Posts: 2
Joined: Thu Feb 09, 2017 1:57 pm

Post by Charinthara07 » Thu Feb 09, 2017 2:01 pm


Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others