I've got 2 Files with a common key. One file additionally has a date
Example
File 1
AAA
DDD
EEE
File 2
2011-03-01AAA
2011-02-01AAA
2011-01-01AAA
2010-12-01AAA
2011-01-01BBB
2011-03-01BBB
2011-02-01CCC
2011-01-01CCC
2010-12-01CCC
2010-03-01EEE
My task is to create a file with records of File2 that
- either the key occurs in file1
- or are younger than 2010-02-28 (regardless of the key)
My desired result would be
File 2
2011-03-01AAA
2011-02-01AAA
2011-01-01AAA
2010-12-01AAA
2011-03-01BBB
2010-03-01EEE
Another daunting task
Moderators: Frank Yaeger, Moderator Group
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
I don't know why you included
2011-03-01BBB
in your expected output file. It doesn't seem to meet either of your criteria.
However, here's a DFSORT job that does what you described:
2011-03-01BBB
in your expected output file. It doesn't seem to meet either of your criteria.
However, here's a DFSORT job that does what you described:
Code: Select all
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//IN1 DD DSN=... input file1
//IN2 DD DSN=... input file2
//SORTOUT DD DSN=... output file
//SYSIN DD *
JOINKEYS F1=IN1,FIELDS=(1,3,A)
JOINKEYS F2=IN2,FIELDS=(11,3,A)
JOIN UNPAIRED,F2
REFORMAT FIELDS=(F2:1,13,?)
OPTION COPY
OUTFIL INCLUDE=(14,1,CH,EQ,C'B',OR,
1,10,CH,LT,C'2010-02-28'),BUILD=(1,13)
/*
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
I included the record you mentioned because it is younger than 2011-02-28 but still i got the idea and i amended your DFSORT to
and BINGO !!
Thank you, thak you, thank you
Great help !!!
Code: Select all
JOINKEYS F1=IN1,FIELDS=(1,3,A)
JOINKEYS F2=IN2,FIELDS=(11,3,A)
JOIN UNPAIRED,F2
REFORMAT FIELDS=(F2:1,13,F1:1,3)
OPTION COPY
OUTFIL INCLUDE=((14,1,CH,EQ,C' ',AND,1,10,CH,GT,C'2011-02-28'),OR,
14,1,CH,NE,C' '),BUILD=(1,13)
END
Thank you, thak you, thank you
Great help !!!
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
From your first post
Anyway, glad I could help.
From your latest postor are younger than 2010-02-28 (regardless of the key)
Oh, I see - you said 2010-02-28, but you actually meant to say 2011-02-28.because it is younger than 2011-02-28
Anyway, glad I could help.
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