Comparing 2 files on the basis of Date
Moderators: Frank Yaeger, Moderator Group
-
- Member
- Posts: 11
- Joined: Mon Feb 27, 2012 7:35 pm
Comparing 2 files on the basis of Date
Hi,
I've been banging my head on this. It would be great if anyone could help. Note - I have to use ICETOOL/DFSORT to get the below result.
I have 2 files -
F1 - LRECL=100,RECFM=FB with date field in the form of YYYY-MM-DD(10 bytes) starting at position 15 (15-24).
F2 - LRECL=80,RECFM=FB. This is a date file with only one record. First 10 bytes being the current batch date and the enxte 10 bytes (11-20) being the previous batch date. Format of dates - YYYY-MM-DD.
I want to retrieve the first 14 bytes from all the records in F1 where the date (15-24) is less than or equal to the previous date in F2(11-20).
It would be great if anyone could help me on an urgent basis.
Let me know if any more details are required.
Thanks
Rajat Kharbanda
I've been banging my head on this. It would be great if anyone could help. Note - I have to use ICETOOL/DFSORT to get the below result.
I have 2 files -
F1 - LRECL=100,RECFM=FB with date field in the form of YYYY-MM-DD(10 bytes) starting at position 15 (15-24).
F2 - LRECL=80,RECFM=FB. This is a date file with only one record. First 10 bytes being the current batch date and the enxte 10 bytes (11-20) being the previous batch date. Format of dates - YYYY-MM-DD.
I want to retrieve the first 14 bytes from all the records in F1 where the date (15-24) is less than or equal to the previous date in F2(11-20).
It would be great if anyone could help me on an urgent basis.
Let me know if any more details are required.
Thanks
Rajat Kharbanda
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
You can use a DFSORT job like the following to do what you asked for:
Code: Select all
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file2 (FB/80)
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN DD *
OPTION COPY
INREC BUILD=(C'PREVDATE,''',11,10,C'''',80:X)
/*
//S2 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=... input file1 (FB/100)
//SORTOUT DD DSN=... output file (FB/14)
//SYSIN DD *
OPTION COPY
INCLUDE COND=(15,10,CH,LE,PREVDATE)
OUTREC BUILD=(1,14)
/*
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: 11
- Joined: Mon Feb 27, 2012 7:35 pm
-
- Member
- Posts: 26
- Joined: Mon Jan 23, 2012 11:17 pm
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
The SYMNAMES data set has to have RECFM=FB and LRECL=80. The 80:X ensures that the Symbol statement is padded with blanks on the right, and that the LRECL of the SYMNAMES data set is set to 80 automatically.
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: 26
- Joined: Mon Jan 23, 2012 11:17 pm
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
Using 80:X ensures that the SYMNAMES record is padded on the right with blanks. If you don't use 80:X, you'll get binary zero padding on the right which can result in a syntax error. If you specify LRECL=80 for the SYMNAMES data set, you could probably get away with using:
so you get one blank after the SYMNAMES statement. But what's the problem with specifying 80:X?
Code: Select all
INREC BUILD=(C'PREVDATE,''',11,10,C'''',X)
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