There are two files. one sorted and other not. Data in files are like
1st file:(not sorted)
---+----1----+----2----+----3----+----4----+----5----+----6----+----7-
LAL116936 *A 02-01-09 12 69.90 24.54 94.44
A101903604 0 01-20-09 01 11.71 0.00 11.71
A102079125 0 02-01-09 03 66.18 0.00 66.18
C101234969 0 02-01-09 12 33.00 0.00 33.00
C101235138 0 02-01-09 12 32.03 0.00 32.03
C101235227 0 02-01-09 12 18.12 0.00 18.12
2nd file: (sorted on these policy no.s)
----+----1
A101762993
A101816689
A101860025
A101903604
A101972621
A102051736
We to match these two reports on the policy no. basis.2nd file contain policy no. only(can be used as key for matching). But 1st contain policy no. along with its some detail. So, we have to create a new file that contain the records of 1st file with added indicator "D" at 14 position (without changing its original format) for those policies which are not present in 2nd file.
how to match the two files, one sorted and other not
Moderators: Frank Yaeger, Moderator Group
-
- Member
- Posts: 2
- Joined: Fri Feb 13, 2009 11:32 am
- Location: noida
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
Please show the expected output records for your input example.
What is the RECFM and LRECL of the input files?
In your example, I only see one matching policy number in the two files: A101903604. Is that correct? Is that the example you wanted to show?
What is the RECFM and LRECL of the input files?
In your example, I only see one matching policy number in the two files: A101903604. Is that correct? Is that the example you wanted to show?
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: 2
- Joined: Fri Feb 13, 2009 11:32 am
- Location: noida
There are two files. one sorted and other not. Data in files are like
1st file:(not sorted)
---+----1----+----2----+----3----+----4----+----5----+----6----+----7-
LAL116936 *A
A101903604 0
A102079125 0
C101234969 0
C101235138 0
C101235227 0
2nd file: (sorted on these policy no.s)
----+----1
A101762993
A101816689
A101860025
A101903604
A101972621
A102051736
Expected output:
LAL116936 D*A
A101903604 0
A102079125 D 0
C101234969 D 0
C101235138 D 0
C101235227 D 0
We to match these two reports on the policy no. basis.2nd file contain policy no. only(can be used as key for matching). But 1st contain policy no. along with its some detail. So, we have to create a new file that contain the records of 1st file with added indicator "D" at 14 position (without changing its original format) for those policies which are not present in 2nd file.
1st file: (RECFM=FB,LRECL=121,BLKSIZE=12100)
2nd File: (RECFM=FB,LRECL=80,BLKSIZE=800)
output file: (RECFM=FB,LRECL=121,BLKSIZE=12100)
1st file:(not sorted)
---+----1----+----2----+----3----+----4----+----5----+----6----+----7-
LAL116936 *A
A101903604 0
A102079125 0
C101234969 0
C101235138 0
C101235227 0
2nd file: (sorted on these policy no.s)
----+----1
A101762993
A101816689
A101860025
A101903604
A101972621
A102051736
Expected output:
LAL116936 D*A
A101903604 0
A102079125 D 0
C101234969 D 0
C101235138 D 0
C101235227 D 0
We to match these two reports on the policy no. basis.2nd file contain policy no. only(can be used as key for matching). But 1st contain policy no. along with its some detail. So, we have to create a new file that contain the records of 1st file with added indicator "D" at 14 position (without changing its original format) for those policies which are not present in 2nd file.
1st file: (RECFM=FB,LRECL=121,BLKSIZE=12100)
2nd File: (RECFM=FB,LRECL=80,BLKSIZE=800)
output file: (RECFM=FB,LRECL=121,BLKSIZE=12100)
- 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 the output records could be in order by the policy number. If the output has to be in the original order, that would require another step.
Code: Select all
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=... input file1 (FB/121)
//IN2 DD DSN=... input file2 (FB/80)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=... output file (FB/121)
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(1,10,CH) KEEPNODUPS -
WITH(14,1) USING(CTL3)
/*
//CTL1CNTL DD *
INREC OVERLAY=(14:C'D',122:C'B')
/*
//CTL2CNTL DD *
INREC OVERLAY=(122:C'V')
/*
//CTL3CNTL DD *
OUTFIL FNAMES=OUT,INCLUDE=(122,1,CH,EQ,C'B'),
BUILD=(1,121)
/*
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