compare 2 files with different LRECL
Moderators: Frank Yaeger, Moderator Group
compare 2 files with different LRECL
Hi,
I want to compare two files with different LRECL and the key field also occur in different position in each file.
For eg : File A is with 120 bytes/FB and the key field starts at position 1 with length 7 and File B is with 300/FB bytes and the key field starts in 15 position. File B contain duplicates.
File A-120/FB key starts at position1 and length 7
1235678 AAAAAAAAAA
6666666 bbbbbbbbbbb
8888888 dddddddddddd
File B -300/FB key starts at position 15 and length 7 with duplicates
...............1236666sdsfff...........
...............6666666abced..........
...............6666666bcdef...........
...............9999999asnjd...........
Output File-300 the same layout as File B.
...............1236666sdsfff...........
...............9999999asnjd...........
I want the output file with records that are vailable only in File B.
I wil face the same senario more often with different input files and layouts(key field position differs and LRECL also differs) and so trying to implement using ICETOOL through PROC with symbolic parameters for field positions also and also require the control statments in a separate member so that the proc can be a generic one.
Please help.
Thanks ,
Nina.
I want to compare two files with different LRECL and the key field also occur in different position in each file.
For eg : File A is with 120 bytes/FB and the key field starts at position 1 with length 7 and File B is with 300/FB bytes and the key field starts in 15 position. File B contain duplicates.
File A-120/FB key starts at position1 and length 7
1235678 AAAAAAAAAA
6666666 bbbbbbbbbbb
8888888 dddddddddddd
File B -300/FB key starts at position 15 and length 7 with duplicates
...............1236666sdsfff...........
...............6666666abced..........
...............6666666bcdef...........
...............9999999asnjd...........
Output File-300 the same layout as File B.
...............1236666sdsfff...........
...............9999999asnjd...........
I want the output file with records that are vailable only in File B.
I wil face the same senario more often with different input files and layouts(key field position differs and LRECL also differs) and so trying to implement using ICETOOL through PROC with symbolic parameters for field positions also and also require the control statments in a separate member so that the proc can be a generic one.
Please help.
Thanks ,
Nina.
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
Here's a DFSORT/ICETOOL job with Symbols that will do what you asked for. You can put each set of control statements in a separate member of a PDS with RECFM=FB and LRECL=80.
Code: Select all
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//SYMNAMES DD *
* Change 1,7 to position and length of input file1 key
F1_KEY,1,7,CH
* Change 15,7 to position and length of input file2 key
F2_KEY,15,7,CH
* Change 300 to LRECL of input file2
F2_RCD,1,300
F2_ID,*,2,CH
F2_ID1,=,1,CH
/*
//IN1 DD DSN=... input file1
//IN2 DD DSN=... input file2
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=... output file
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(F2_KEY) KEEPNODUPS KEEPBASE -
WITHALL WITH(F2_RCD) WITH(F2_ID1) USING(CTL3)
/*
//CTL1CNTL DD *
INREC BUILD=(F2_KEY:F1_KEY,301:C'BB')
/*
//CTL2CNTL DD *
INREC OVERLAY=(F2_ID1:C'VV')
/*
//CTL3CNTL DD *
OUTFIL FNAMES=OUT,INCLUDE=(F2_ID,EQ,C'VV'),
BUILD=(F2_RCD)
/*
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:
Nina,
If you add the following to the job:
//SYMNOUT DD SYSOUT=*
DFSORT will display the original and translated symbols in SYMNOUT like this:
* means start at the next position after the previous field.
= means start at the same position as the previous field.
For complete details on DFSORT Symbols, see:
http://publibz.boulder.ibm.com/cgi-bin/ ... 0528171007
If you add the following to the job:
//SYMNOUT DD SYSOUT=*
DFSORT will display the original and translated symbols in SYMNOUT like this:
Code: Select all
------- ORIGINAL STATEMENTS FROM SYMNAMES -------
* Change 1,7 to position and length of input file1 key
F1_KEY,1,7,CH
* Change 15,7 to position and length of input file2 key
F2_KEY,15,7,CH
* Change 300 to LRECL of input file2
F2_RCD,1,300
F2_ID,*,2,CH
F2_ID1,=,1,CH
------------------ SYMBOL TABLE -----------------
F1_KEY,1,7,CH
F2_KEY,15,7,CH
F2_RCD,1,300
F2_ID,301,2,CH
F2_ID1,301,1,CH
= means start at the same position as the previous field.
For complete details on DFSORT Symbols, see:
http://publibz.boulder.ibm.com/cgi-bin/ ... 0528171007
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,
I was trying to compare 2 files with the above suggested code which have different record length and key positions are different. But it's giving following error.
My 1st I/P file length is 5 and key length is also 5. And 2nd record length is 300 and key position starts at 14 with length 5. Both record formats are FB.
I was trying to compare 2 files with the above suggested code which have different record length and key positions are different. But it's giving following error.
ICE201I E RECORD TYPE IS F - DATA STARTS IN POSITION 1
ICE027A 1 END OF FIELD BEYOND MAXIMUM RECORD LENGTH
ICE751I 0 C5-K26318 C6-K90007 C7-K90000 C8-K23476 E4-K90007 E7-K24705
ICE052I 3 END OF DFSORT
My 1st I/P file length is 5 and key length is also 5. And 2nd record length is 300 and key position starts at 14 with length 5. Both record formats are FB.
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
Show me the job you used (the complete JCL and control statements).
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 Frank,
I have given total DFSMSG but that was deleted by some one. Below is my complete JCL.
I have given total DFSMSG but that was deleted by some one. Below is my complete JCL.
//DFSORT EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//SYMNAMES DD *
F1_KEY,1,5,CH
F2_KEY,14,5,CH
F2_RCD,1,300
F2_ID,*,2,CH
F2_ID1,=,1,CH
/*
//IN1 DD DISP=SHR,DSN=SSY361.USER.FLSBRNCH.PCOMPARE.SORT
//IN2 DD DISP=SHR,DSN=SSY361.USER.PCOMPARE.LINKAGE.LDFILE.SORT
//T1 DD DSN=&&TEMP1,DISP=(MOD,PASS),SPACE=(CYL,(50,10)),UNIT=SYSDA
//OUT DD DSN=SSY361.USER.SORTCOMP.COMPFILE,
// DISP=(NEW,CATLG,DELETE),SPACE=(CYL,(500,100),RLSE),
// DCB=(LRECL=300,RECFM=FB,BLKSIZE=0)
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(F2_KEY) KEEPNODUPS KEEPBASE -
WITHALL WITH(F2_RCD) WITH(F2_ID1) USING(CTL3)
/*
//CTL1CNTL DD *
INREC BUILD=(F2_KEY:F1_KEY,301:C'BB')
/*
//CTL2CNTL DD *
INREC OVERLAY=(F2_ID1:C'VV')
/*
//CTL3CNTL DD *
OUTFIL FNAMES=OUT,INCLUDE=(F2_ID,EQ,C'VV'),
BUILD=(F2_RCD)
/*
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
I need to see the //DFSMSG messages. Rerun the job and post them.I have given total DFSMSG but that was deleted by some one. Below is my complete JCL.
Also, tell me the RECFM and LRECL of SSY361.USER.FLSBRNCH.PCOMPARE.SORT and SSY361.USER.PCOMPARE.LINKAGE.LDFILE.SORT
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
Following is DFSMSG log.
One more thing, SSY361.USER.FLSBRNCH.PCOMPARE.SORT won't have duplicates but SSY361.USER.PCOMPARE.LINKAGE.LDFILE.SORT can have duplicates. Please let me know if you need more details.
RECFM and LRECL of SSY361.USER.FLSBRNCH.PCOMPARE.SORT is 'FB' and '5' and SSY361.USER.PCOMPARE.LINKAGE.LDFILE.SORT is 'FB' and '300'.
********************************* TOP OF DATA **********************************
ICE200I 0 IDENTIFIER FROM CALLING PROGRAM IS 0001
ICE280I 1 ORIGINAL STATEMENTS FROM CTL1CNTL FOLLOW
INREC BUILD=(F2_KEY:F1_KEY,301:C'BB')
ICE280I 2 ORIGINAL STATEMENTS FROM PARMLIST FOLLOW
DEBUG NOABEND,ESTAE
OPTION MSGDDN=DFSMSG,LIST,MSGPRT=ALL,RESINV=0,SORTDD=CTL1,SORTIN=IN1,S
RTOUT=T1,DYNALLOC
SORT FIELDS=COPY
ICE282I 0 PERFORMING SYMBOL SUBSTITUTION AS NEEDED
ICE143I 0 BLOCKSET COPY TECHNIQUE SELECTED
ICE250I 0 VISIT http://www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES AN
ICE000I 0 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R5 - 23:48 ON MON MAR
INREC BUILD=(14:1,5,301:C'BB')
ICE146I 0 END OF STATEMENTS FROM CTL1CNTL - PARAMETER LIST STATEMENTS FOLLOW
DEBUG NOABEND,ESTAE
OPTION MSGDDN=DFSMSG,LIST,MSGPRT=ALL,RESINV=0,SORTDD=CTL1,SORTIN=IN1,S
RTOUT=T1,DYNALLOC
SORT FIELDS=COPY
ICE201I E RECORD TYPE IS F - DATA STARTS IN POSITION 1
ICE751I 0 C5-K26318 C6-K90007 C7-K90000 C8-K23476 E9-K90007 C9-BASE E5-K35433
ICE193I 0 ICEAM2 ENVIRONMENT IN EFFECT - ICEAM2 INSTALLATION MODULE SELECTED
ICE088I 0 SSY361AB.DFSORT . , INPUT LRECL = 5, BLKSIZE = 27995, TYPE =
ICE093I 0 MAIN STORAGE = (MAX,4194304,4194304)
ICE156I 0 MAIN STORAGE ABOVE 16MB = (4284400,4136944)
ICE127I 0 OPTIONS: OVFLO=RC0 ,PAD=RC0 ,TRUNC=RC0 ,SPANINC=RC0 ,VLSCMP=N,SZERO=Y
ICE128I 0 OPTIONS: SIZE=4194304,MAXLIM=1048576,MINLIM=450560,EQUALS=N,LIST=Y,ER
ICE129I 0 OPTIONS: VIO=Y,RESDNT=ALL ,SMF=FULL ,WRKSEC=Y,OUTSEC=Y,VERIFY=N,CHALT
ICE130I 0 OPTIONS: RESALL=16384,RESINV=0,SVC=109 ,CHECK=N,WRKREL=Y,OUTREL=Y,CKP
ICE131I 0 OPTIONS: TMAXLIM=4194304,ARESALL=16384,ARESINV=131072,OVERRGN=16384,C
ICE132I 0 OPTIONS: VLSHRT=N,ZDPRINT=Y,IEXIT=N,TEXIT=N,LISTX=N,EFS=NONE ,EXIT
ICE133I 0 OPTIONS: HIPRMAX=OPTIMAL,DSPSIZE=0 ,ODMAXBF=0,SOLRF=N,VLLONG=N,VSAM
ICE235I 0 OPTIONS: NULLOUT=RC0
ICE084I 0 EXCP ACCESS METHOD USED FOR T1
ICE084I 0 EXCP ACCESS METHOD USED FOR IN1
ICE751I 1 EF-K10929 F0-K30362 E8-K24705
ICE090I 0 OUTPUT LRECL = 5, BLKSIZE = 27995, TYPE = FB (SDB)
ICE055I 0 INSERT 0, DELETE 0
ICE054I 0 RECORDS - IN: 49, OUT: 49
ICE052I 0 END OF DFSORT
1ICE200I 0 IDENTIFIER FROM CALLING PROGRAM IS 0002
ICE280I 1 ORIGINAL STATEMENTS FROM CTL2CNTL FOLLOW
INREC OVERLAY=(F2_ID1:C'VV')
ICE280I 2 ORIGINAL STATEMENTS FROM PARMLIST FOLLOW
DEBUG NOABEND,ESTAE
OPTION MSGDDN=DFSMSG,LIST,MSGPRT=ALL,RESINV=0,SORTDD=CTL2,SORTIN=IN2,
RTOUT=T1,DYNALLOC
SORT FIELDS=COPY
ICE282I 0 PERFORMING SYMBOL SUBSTITUTION AS NEEDED
ICE143I 0 BLOCKSET COPY TECHNIQUE SELECTED
ICE250I 0 VISIT http://www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES A
ICE000I 0 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R5 - 23:48 ON MON MA
0 INREC OVERLAY=(301:C'VV')
ICE146I 0 END OF STATEMENTS FROM CTL2CNTL - PARAMETER LIST STATEMENTS FOLLOW
DEBUG NOABEND,ESTAE
OPTION MSGDDN=DFSMSG,LIST,MSGPRT=ALL,RESINV=0,SORTDD=CTL2,SORTIN=IN2,
RTOUT=T1,DYNALLOC
SORT FIELDS=COPY
ICE201I E RECORD TYPE IS F - DATA STARTS IN POSITION 1
ICE751I 0 C5-K26318 C6-K90007 C7-K90000 C8-K23476 E9-K90007 C9-BASE E5-K35433
ICE193I 0 ICEAM2 ENVIRONMENT IN EFFECT - ICEAM2 INSTALLATION MODULE SELECTED
ICE088I 0 SSY361AB.DFSORT . , INPUT LRECL = 300, BLKSIZE = 27900, TYPE
ICE093I 0 MAIN STORAGE = (MAX,4194304,4194304)
ICE156I 0 MAIN STORAGE ABOVE 16MB = (4284400,4136944)
ICE127I 0 OPTIONS: OVFLO=RC0 ,PAD=RC0 ,TRUNC=RC0 ,SPANINC=RC0 ,VLSCMP=N,SZERO=Y
ICE128I 0 OPTIONS: SIZE=4194304,MAXLIM=1048576,MINLIM=450560,EQUALS=N,LIST=Y,ER
ICE129I 0 OPTIONS: VIO=Y,RESDNT=ALL ,SMF=FULL ,WRKSEC=Y,OUTSEC=Y,VERIFY=N,CHALT
ICE130I 0 OPTIONS: RESALL=16384,RESINV=0,SVC=109 ,CHECK=N,WRKREL=Y,OUTREL=Y,CKP
ICE131I 0 OPTIONS: TMAXLIM=4194304,ARESALL=16384,ARESINV=131072,OVERRGN=16384,C
ICE132I 0 OPTIONS: VLSHRT=N,ZDPRINT=Y,IEXIT=N,TEXIT=N,LISTX=N,EFS=NONE ,EXIT
ICE133I 0 OPTIONS: HIPRMAX=OPTIMAL,DSPSIZE=0 ,ODMAXBF=0,SOLRF=N,VLLONG=N,VSAM
ICE235I 0 OPTIONS: NULLOUT=RC0
ICE084I 0 EXCP ACCESS METHOD USED FOR T1
ICE084I 0 EXCP ACCESS METHOD USED FOR IN2
ICE751I 1 EF-K10929 F0-K30362 E8-K24705
ICE090I 0 OUTPUT LRECL = 5, BLKSIZE = 27995, TYPE = FB
ICE171I 0 SORTOUT LRECL OF 5 IS DIFFERENT FROM SORTIN(NN) LRECL OF 300 - RC=0
ICE055I 0 INSERT 0, DELETE 0
ICE054I 0 RECORDS - IN: 526288, OUT: 526288
ICE052I 0 END OF DFSORT
1ICE200I 0 IDENTIFIER FROM CALLING PROGRAM IS 0003
ICE280I 1 ORIGINAL STATEMENTS FROM CTL3CNTL FOLLOW
OUTFIL FNAMES=OUT,INCLUDE=(F2_ID,EQ,C'VV'),
BUILD=(F2_RCD)
ICE280I 2 ORIGINAL STATEMENTS FROM PARMLIST FOLLOW
DEBUG NOABEND,ESTAE
OPTION MSGDDN=DFSMSG,LIST,MSGPRT=ALL,RESINV=0,SORTDD=CTL3,SORTIN=T1,S
TOUT=OUT,DYNALLOC,SZERO,EQUALS,NOVLSHRT,LOCALE=NONE,NO
ECK
SORT FIELDS=(14,5,CH,A)
MODS E35=(ICE35DU,12288)
ICE282I 0 PERFORMING SYMBOL SUBSTITUTION AS NEEDED
ICE143I 0 BLOCKSET SORT TECHNIQUE SELECTED
ICE250I 0 VISIT http://www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES A
ICE000I 0 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R5 - 23:48 ON MON MA
0 OUTFIL FNAMES=OUT,INCLUDE=(301,2,CH,EQ,C'VV'),BUILD=(1,300)
ICE146I 0 END OF STATEMENTS FROM CTL3CNTL - PARAMETER LIST STATEMENTS FOLLOW
DEBUG NOABEND,ESTAE
OPTION MSGDDN=DFSMSG,LIST,MSGPRT=ALL,RESINV=0,SORTDD=CTL3,SORTIN=T1,S
TOUT=OUT,DYNALLOC,SZERO,EQUALS,NOVLSHRT,LOCALE=NONE,NO
ECK
SORT FIELDS=(14,5,CH,A)
MODS E35=(ICE35DU,12288)
ICE201I E RECORD TYPE IS F - DATA STARTS IN POSITION 1
ICE027A 1 END OF FIELD BEYOND MAXIMUM RECORD LENGTH
ICE751I 0 C5-K26318 C6-K90007 C7-K90000 C8-K23476 E4-K90007 E7-K24705
ICE052I 3 END OF DFSORT
******************************** BOTTOM OF DATA ********************************
One more thing, SSY361.USER.FLSBRNCH.PCOMPARE.SORT won't have duplicates but SSY361.USER.PCOMPARE.LINKAGE.LDFILE.SORT can have duplicates. Please let me know if you need more details.
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
Ok, I see your problem.
Your system programmers have changed DFSORT's shipped installation default of SOLRF=YES to SOLRF=NO. This is NOT recommended. With SOLRF=NO, DFSORT uses the input LRECL instead of the reformatted length for the output LRECL. So instead of getting an LRECL of 300 for the T1 data set, you get an LRECL of 5 and the job doesn't work.
Add the following to your job to override the parameter:
You might want to tell your System Programmers that their choice of SOLRF=NO is NOT recommended and can cause problems.
Your system programmers have changed DFSORT's shipped installation default of SOLRF=YES to SOLRF=NO. This is NOT recommended. With SOLRF=NO, DFSORT uses the input LRECL instead of the reformatted length for the output LRECL. So instead of getting an LRECL of 300 for the T1 data set, you get an LRECL of 5 and the job doesn't work.
Add the following to your job to override the parameter:
Code: Select all
//DFSPARM DD *
OPTION SOLRF
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