make a output file from two input files on certain condition
Moderators: Frank Yaeger, Moderator Group
make a output file from two input files on certain condition
Hi All,
I have two input file and I want a output file as below:
1st Input:
XXXX 1234 HGKKJKKJGJ.......
XXXX 2424 BGYUOJLLKH.......
XXXX 8474 YFTFFJYGIKLJ......
here col 6-9 is key.
2nd Input:
AAAA 7347 A H 32.....
AAAA 1234 B G 54.....
AAAA 6456 C D 76.....
here also 6-9 is key.
I want the output file in the format of 1st input file excluding the duplicate keys. Means if the key is present in 2nd file don't write the record for this key.
Output expected as
XXXX 2424 BGYUOJLLKH.......
XXXX 8474 YFTFFJYGIKLJ......
I have two input file and I want a output file as below:
1st Input:
XXXX 1234 HGKKJKKJGJ.......
XXXX 2424 BGYUOJLLKH.......
XXXX 8474 YFTFFJYGIKLJ......
here col 6-9 is key.
2nd Input:
AAAA 7347 A H 32.....
AAAA 1234 B G 54.....
AAAA 6456 C D 76.....
here also 6-9 is key.
I want the output file in the format of 1st input file excluding the duplicate keys. Means if the key is present in 2nd file don't write the record for this key.
Output expected as
XXXX 2424 BGYUOJLLKH.......
XXXX 8474 YFTFFJYGIKLJ......
Vikash kumar
09922611854
09922611854
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
You can use a DFSORT/ICETOOL job like the following to do what you asked for. I assumed your input file has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes.
Code: Select all
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD *
XXXX 1234 HGKKJKKJGJ.......
XXXX 2424 BGYUOJLLKH.......
XXXX 8474 YFTFFJYGIKLJ......
/*
//IN2 DD *
AAAA 7347 A H 32.....
AAAA 1234 B G 54.....
AAAA 6456 C D 76.....
/*
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SELECT FROM(T1) TO(OUT) ON(6,4,CH) NODUPS USING(CTL3)
/*
//CTL1CNTL DD *
INREC OVERLAY=(81:C'1')
/*
//CTL2CNTL DD *
INREC OVERLAY=(81:C'2')
/*
//CTL3CNTL DD *
OUTFIL FNAMES=OUT,INCLUDE=(81,1,CH,EQ,C'1'),BUILD=(1,80)
/*
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
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
Just change the //OUT DD statement to point to your output file. For example:I want the output in a file, then what changes need to be done.
Code: Select all
//OUT DD DSN=myfilename,DISP=(NEW,CATLG,DELETE),
// SPACE=(CYL,(5,5)),UNIT=SYSDA
Am I supposed to read your mind to figure out the actual RECFM and LRECL of your file, or could you possibly, I don't know, TELL ME the actual RECFM and LRECL? Sheesh.Also My file is not fixed of 80
And please DON"T post the same question on multiple help boards!
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
Hi,
the Actual RECFM=FB and LRECL=600 for INP1 and
RECFM=FB and LRECL=900 for INP2.
Also,I need to seperate the control statement in some other member. And then use this member in our PROC or JCL.
So that I don't have to write the control statement in all JCLs or PROC. Just use the member.
the Actual RECFM=FB and LRECL=600 for INP1 and
RECFM=FB and LRECL=900 for INP2.
Also,I need to seperate the control statement in some other member. And then use this member in our PROC or JCL.
So that I don't have to write the control statement in all JCLs or PROC. Just use the member.
Vikash kumar
09922611854
09922611854
- 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 using PDS members for the control statements. Just make sure that the PDS has RECFM=FB and LRECL=80.
pds(M1):
pds(M2):
pds(M3):
pds(M4):
Code: Select all
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=... input file1 (FB/600)
//IN2 DD DSN=... input file2 (FB/900)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=... output file (FB/600)
//TOOLIN DD DSN=pds(M1),DISP=SHR
//CTL1CNTL DD DSN=pds(M2),DISP=SHR
//CTL2CNTL DD DSN=pds(M3),DISP=SHR
//CTL3CNTL DD DSN=pds(M4),DISP=SHR
Code: Select all
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SELECT FROM(T1) TO(OUT) ON(6,4,CH) NODUPS USING(CTL3)
Code: Select all
INREC OVERLAY=(601:C'1')
Code: Select all
INREC BUILD=(1,600,601:C'2')
Code: Select all
OUTFIL FNAMES=OUT,INCLUDE=(601,1,CH,EQ,C'1'),BUILD=(1,600)
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