|
View previous topic :: View next topic
|
| Author |
Message |
SENTHIL MURUGAAN Warnings : 1 New User
Joined: 12 Jan 2013 Posts: 32 Location: India
|
|
|
|
Hi all,
I have to compare current version and previous version of a PS GDG file with LRECL=80. The keys were unique.
For example : current file is F1 and previous file is F2
If Record key (1,5) matches between F1 and F2, then its fields needs to be compared and if there is any difference, then it needs to be written to output file with last data appended as "M" which denotes modified.
If record key is present in current file but not in previous file ,then current file record must be written to output file with last data appended as "C" which denotes Create.
If record key is present in previous file but not in current file ,then current file record must be written to output file with last data appended as "D" which denotes Delete.
F1 File : previous version
| Code: |
10001 CALIPER1 5000
10002 RINGS 2000
10003 PISTON 8000
10004 GUAGE 9000 |
F2 File: current version
| Code: |
10002 RINGS A 2000
10003 PISTON 7000
10004 GUAGE 9000
10005 DISCS 3000 |
Output File:
| Code: |
10001 D
10002 M -----> change in Field 2
10003 M -----> change in Field 3
10005 C |
10004 must not be written to output file as other fields were same.
The above file comparison is possible in cobol. But i need this to be performed in ICETOOL.
Is it possible in ICETOOL?
Thanks,
Senthil |
|
| Back to top |
|
 |
prino
Senior Member

Joined: 07 Feb 2009 Posts: 1323 Location: Vilnius, Lithuania
|
|
|
|
| SENTHIL MURUGAAN wrote: |
| The above file comparison is possible in cobol. But i need this to be performed in ICETOOL. |
Why? Because you will think that someone here will do it for you, so that you don't have to write a COBOL program yourself? |
|
| Back to top |
|
 |
SENTHIL MURUGAAN Warnings : 1 New User
Joined: 12 Jan 2013 Posts: 32 Location: India
|
|
|
|
Hi Prino,
I didn't mean that. I have written many cobol program for this scenarios. But I want to try icetool to make it in short steps. I am trying using joinkeys. But join keys only compares the keys and not other fields of matched records for comparison. So seeking help on this. |
|
| Back to top |
|
 |
magesh23586
Active User

Joined: 06 Jul 2009 Posts: 213 Location: Chennai
|
|
|
|
| SENTHIL MURUGAAN wrote: |
Hi Prino,
I didn't mean that. I have written many cobol program for this scenarios. But I want to try icetool to make it in short steps. I am trying using joinkeys. But join keys only compares the keys and not other fields of matched records for comparison. So seeking help on this. |
Try this untested. If both the files are not in sorted order by key then remove SORTED,NOSEQCK
| Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//INA DD DSN=your.first.file(FB/80)
//INB DD DSN=Your.second.file(FB/80)
//SORTOUT DD DSN=OUTPUT,DISP=(,CATLG,DELETE),
// SPACE=(CYL,(100,100),RLSE)
//SYSIN DD *
OPTION COPY
JOINKEYS F1=INA,FIELDS=(1,5,A),SORTED,NOSEQCK
JOINKEYS F2=INB,FIELDS=(1,5,A),SORTED,NOSEQCK
JOIN UNPAIRED,F2,F1
REFORMAT FIELDS=(F1:1,80,F2:1,80,?)
OUTFIL INCLUDE=((161,01,CH,EQ,C'B',AND,
001,80,CH,NE,81,80,CH),OR,
161,01,CH,EQ,C'1',OR,
161,1,CH,EQ,C'2'),
IFTHEN=(WHEN=(161,1,CH,EQ,C'B'),BUILD=(01,5,X,C'M',80:X)),
IFTHEN=(WHEN=(161,1,CH,EQ,C'1'),BUILD=(01,5,X,C'C',80:X)),
IFTHEN=(WHEN=(161,1,CH,EQ,C'2'),BUILD=(81,5,X,C'D',80:X))
|
Updated as requested |
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
From a test run, the indicators (C and D) might need to be swapped for the OPs original requirement. I am sure he would have figured it by now. Also the OUTFIL INCLUDE could be simplified as an OMIT COND like this:
| Code: |
....
....
REFORMAT FIELDS=(F1:1,80,F2:1,80,?)
OMIT COND=(01,80,CH,EQ,81,80,CH)
INREC IFTHEN=(WHEN=(161,1,CH,EQ,C'B'),BUILD=(01,5,X,C'M',80:X)),
IFTHEN=(WHEN=(161,1,CH,EQ,C'1'),BUILD=(01,5,X,C'D',80:X)),
IFTHEN=(WHEN=(161,1,CH,EQ,C'2'),BUILD=(81,5,X,C'C',80:X)) |
|
|
| Back to top |
|
 |
expat
Global Moderator

Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
| Why not simply use the IBM compare utility ??? |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|