Matching record counts using SORT and setting a RC
Moderators: Frank Yaeger, Moderator Group
-
- Member
- Posts: 5
- Joined: Wed Jan 18, 2012 2:31 am
Matching record counts using SORT and setting a RC
Hello,
Below is the requirement
I receive 2 files. One with data (file 1) and the other with just the record count (file 2). What I need to do is count the number of records in file 1 and check to see if the value matches with what is present on file 2. If the counts match need to set RC = 0 and if not set it to something else so that it can be handled accordingly in the next step in the JCL. Can this be acheived throug SORT or any other utility. Was checking to see if anything can be done other than writing a COBOL program. Please help. Thank you.
Below is the requirement
I receive 2 files. One with data (file 1) and the other with just the record count (file 2). What I need to do is count the number of records in file 1 and check to see if the value matches with what is present on file 2. If the counts match need to set RC = 0 and if not set it to something else so that it can be handled accordingly in the next step in the JCL. Can this be acheived throug SORT or any other utility. Was checking to see if anything can be done other than writing a COBOL program. Please help. Thank you.
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
What is the RECFM and LRECL of each input file?
What is the starting position, length and format of the count field in the second input file? Does it just contain one record with the count?
What is the starting position, length and format of the count field in the second input file? Does it just contain one record with the count?
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
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
-
- Member
- Posts: 5
- Joined: Wed Jan 18, 2012 2:31 am
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
Again:
What is the starting position, length and format of the count field in the second input file?
What is the starting position, length and format of the count field in the second input file?
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
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
-
- Member
- Posts: 5
- Joined: Wed Jan 18, 2012 2:31 am
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
Here's a DFSORT/ICETOOL job that will give you RC=0 if the counts match or RC=8 if they don't match. If you want RC=4 instead of RC=8, change RC8 to RC4. If you want RC=12 instead of RC=8, change RC8 to RC12.
Code: Select all
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//RCDS DD DSN=... input file1 (FB/80)
//CT DD DSN=... input file2 (FB/80)
//CTL2CNTL DD DSN=&&T1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//TOOLIN DD *
COPY FROM(RCDS) USING(CTL1)
COUNT FROM(CT) EMPTY RC8 USING(CTL2)
//CTL1CNTL DD *
OUTFIL FNAMES=CTL2CNTL,REMOVECC,NODETAIL,
TRAILER1=(' INCLUDE COND=(1,10,ZD,EQ,',
COUNT=(TO=ZD,LENGTH=10),C') ')
/*
Last edited by Frank Yaeger on Wed Feb 01, 2012 2:31 am, edited 1 time in total.
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
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
-
- Member
- Posts: 5
- Joined: Wed Jan 18, 2012 2:31 am
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
- Cobol Interview Questions
50+ Interview Questions - JCL Interview Questions
50+ Interview Questions - DB2 Interview Questions
100+ Interview Questions - CICS Interview Questions
70+ Interview Questions - VSAM Interview Questions
27 Interview Questions
Other References
Mainframe Tools and others
- XPEDITER Reference
Explains how we can debug a program - FILEAID Reference
Explains how to browse , edit and delete datasets - Change Man Reference
Quick Start tutorial on Changeman - Abend Reference
Important Abend codes explained - FaceBook Page
MainframeGurukul FaceBook Page - LinkedIn Page
MainframeGurkul Linkedin Page