Hi,
Here is my requirement
File-A
1234512345
File-B
1234512344
Only one record (of length 10) is present in both File-A and File-B.
If Record(File-A) > Record(File-B) then SORT should return 4
otherwise 0.
So how to get this using any SORT.
Thanks
Kalicharan.
Controlling Return Codes of SORT
Moderators: Frank Yaeger, Moderator Group
- Kalicharan
- Moderator
- Posts: 31
- Joined: Wed Feb 08, 2006 1:51 pm
- 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 do what you asked for.
Code: Select all
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//CON DD DSN=... input file1 (FB/10)
// DD DSN=... input file2 (FB/10)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//TOOLIN DD *
* Get 1 record if field1>field2 or 0 records if field1<=field2.
SORT FROM(CON) USING(CTL1)
* If we have 1 record (field1>field2), set RC=4.
* If we have 0 records (field1<=field2), set RC=0.
COUNT FROM(T1) NOTEMPTY RC4
/*
//CTL1CNTL DD *
* Add 'A' in position 11 of both records so we can sort on it.
* Add seqnum in position 12 so we can identify record 2.
INREC IFTHEN=(WHEN=INIT,OVERLAY=(11:C'A',12:SEQNUM,1,ZD)),
* Change 10-byte value in file2 record to a negative value.
IFTHEN=(WHEN=(12,1,CH,EQ,C'2'),
OVERLAY=(1:1,10,ZD,MUL,-1,TO=ZD,LENGTH=10))
* Sort on 'A' in 12 so we can use SUM to get field1-field2.
SORT FIELDS=(11,1,CH,A)
OPTION EQUALS
* Use SUM to get field1-field2.
SUM FIELDS=(1,10,ZD)
* If field1>field2, keep record, otherwise omit it.
OUTFIL FNAMES=T1,INCLUDE=(1,10,ZD,GT,+0)
/*
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
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