Joined: 24 Dec 2008 Posts: 7 Topics: 3 Location: India
Posted: Fri Dec 26, 2008 4:23 am Post subject: Need to generate a comparison report between two files
Hi,
I have two files :
FILE-1 :-
Code:
Item no Class colour special number manufacturer
--------------------------------------------------------
BC111 A Green 1234.12.1234 ABCD corp
TPK14562 J yellow 2324.65.5645 JJGroup
1A2345 B Red 4345.13.2222 CD Group
1A2345 J Red 4345.13.2222 CD Group
0S334456 CA Blue 5676.32.1524 HL Corp
0123545 C Black 5355.76.8787 JJ Group
File-2 :-
Code:
Item no Class colour special number manufacturer
-------------------------------------------------------
BC111 A Green 1234.12.1234 ABCD corp
1A2345 B Red 4345.13.2222 CD Group
1A2345 J Red 4345.13.2222 CD Group
0S334456 CA Blue 4444.44.4444 HL Corp
1G47896 B Red 2123.34.4234 GB Corp
0123545 C Black 5355.76.8787 JJ Group
What is happening is, we have this special number gets changed over a period of time and that is what we are suppose to check and track in out report.
OUTPUT :-
Code:
Item no Class Old special New special Change Type
number number
----------------------------------------------------------------
TPK14562 J 2324.65.5645 DEL
0S334456 CA 5676.32.1524 4444.44.4444 CHG
1G47896 B 2123.34.4234 NEW
Could you please suggest how can I do it using ICETOOL ?
Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Fri Dec 26, 2008 11:45 am Post subject:
akash_rgh,
Please answer the following questions
1. What is the LRECL and RECFM of the input files?
2. Can their be duplicates for the combination of item number and class ?
3. Post the COBOL layout of the files.
4. If the Combination keys match is the special number the only field to be compared?
5. Does the files have the 2 line header
Code:
Item no Class colour special number manufacturer
--------------------------------------------------------
Joined: 24 Dec 2008 Posts: 7 Topics: 3 Location: India
Posted: Mon Dec 29, 2008 2:55 am Post subject:
Hi Kolusu,
Please find the details below :
1. LRECL 141 and RECFM =FB.
2. No duplicates possible for the combination of item number and class.
3. Item no 20 bytes
Class 2 bytes
colour 10 bytes
special number 12 bytes
manufacturer 40 bytes
while the rest is filler
4. Yes, we first need to check the item number and class combination match in other file and if matched then only we need to compare the special number field for any changes.
5. No none of the files have any headers.
Joined: 24 Dec 2008 Posts: 7 Topics: 3 Location: India
Posted: Mon Dec 29, 2008 2:58 am Post subject:
In output file we will in third example we will have the special number under new special number column while the old one will remain blank. In my query above it looks like in old column. _________________ -AK
I know in your original post that you requested an ICETOOL solution, but if you have access to SyncSort for z/OS 1.2 or 1.3, then try the following job:
Code:
//STEP1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTOUT DD DSN=OUTPUT.DATASET,...
//SORTJNF1 DD *
BC111 A GREEN 1234.12.1234 ABCD CORP
TPK14562 J YELLOW 2324.65.5645 JJGROUP
1A2345 B RED 4345.13.2222 CD GROUP
1A2345 J RED 4345.13.2222 CD GROUP
0S334456 CA BLUE 5676.32.1524 HL CORP
0123545 C BLACK 5355.76.8787 JJ GROUP
//SORTJNF2 DD *
BC111 A GREEN 1234.12.1234 ABCD CORP
1A2345 B RED 4345.13.2222 CD GROUP
1A2345 J RED 4345.13.2222 CD GROUP
0S334456 CA BLUE 4444.44.4444 HL CORP
1G47896 B RED 2123.34.4234 GB CORP
0123545 C BLACK 5355.76.8787 JJ GROUP
//SYSIN DD *
JOINKEYS FILES=F1,FIELDS=(1,20,A,25,2,A)
JOINKEYS FILES=F2,FIELDS=(1,20,A,25,2,A)
JOIN UNPAIRED
REFORMAT FIELDS=(F1:1,26,40,12,F2:1,26,40,12)
SORT FIELDS=COPY
OUTFIL OMIT=(1,38,CH,EQ,39,38,CH),
IFTHEN=(WHEN=(1,38,CH,EQ,C' '),
BUILD=(1:39,26,45:65,12,60:C'NEW')),
IFTHEN=(WHEN=(39,34,CH,EQ,C' '),
BUILD=(1:1,26,30:27,12,60:C'DEL')),
IFTHEN=(WHEN=(1,26,CH,EQ,39,26,CH,AND,27,12,CH,NE,65,12,CH),
BUILD=(1:1,26,30:27,12,45:65,12,60:C'CHG'))
/*
Here is the output produced:
Code:
TPK14562 J 2324.65.5645 DEL
0S334456 CA 5676.32.1524 4444.44.4444 CHG
1G47896 B 2123.34.4234 NEW
Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Tue Dec 30, 2008 2:15 pm Post subject:
akash_rgh,
The following DFSORT JCL will give you the desired results. Since both files have same LRECL we can concatenate them together but seperated by a header record which will be used to distinguish as to which file the record came from
when concatenated together this is how it looks like. For the first file we use HEADER-11 and for the second file we use HEADER-22
Code:
HEADER-11
BC111 A GREEN 1234.12.1234 ABCD CORP
TPK14562 J YELLOW 2324.65.5645 JJGROUP
1A2345 B RED 4345.13.2222 CD GROUP
1A2345 J RED 4345.13.2222 CD GROUP
0S334456 CA BLUE 5676.32.1524 HL CORP
0123545 C BLACK 5355.76.8787 JJ GROUP
HEADER-22
BC111 A GREEN 1234.12.1234 ABCD CORP
1A2345 B RED 4345.13.2222 CD GROUP
1A2345 J RED 4345.13.2222 CD GROUP
0S334456 CA BLUE 4444.44.4444 HL CORP
1G47896 B RED 2123.34.4234 GB CORP
0123545 C BLACK 5355.76.8787 JJ GROUP
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum