Need to check count of file records and abend if >10.

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
rahul_kolhe
Member
Posts: 12
Joined: Wed Nov 08, 2006 1:03 am

Need to check count of file records and abend if >10.

Post by rahul_kolhe » Fri Nov 17, 2006 2:01 am

Hi,

I want to check the number of records count in file and if count is more than 10 then needs to return abend.

How could we attend this thru JCL, Do not want to write prog.

Thanks,

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Fri Nov 17, 2006 2:32 am

Would you settle for a RC=12 rather than an abend?
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

rahul_kolhe
Member
Posts: 12
Joined: Wed Nov 08, 2006 1:03 am

Post by rahul_kolhe » Sat Nov 18, 2006 12:11 am

Yes, I will.

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Sat Nov 18, 2006 1:11 am

Here's a DFSORT/ICETOOL job that will set RC=12 if the input file has more than 10 records, or RC=0 otherwise.

Code: Select all

//S1   EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=...  input file
//TOOLIN DD *
* Set RC=12 if > 10 records, else RC=0
COUNT FROM(IN) HIGHER(10)
/*
For more information, see the "Set RC=12 or RC=4 if file is empty, has more than n records, etc " Smart DFSORT Trick at:

http://www.ibm.com/servers/storage/supp ... vs/tricks/
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

rahul_kolhe
Member
Posts: 12
Joined: Wed Nov 08, 2006 1:03 am

Post by rahul_kolhe » Sat Nov 18, 2006 2:14 am

thank you.

Have a good weekend!

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