IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Compare two PS files using ICE TOOL for updated records


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
SENTHIL MURUGAAN
Warnings : 1

New User


Joined: 12 Jan 2013
Posts: 32
Location: India

PostPosted: Sun Dec 24, 2017 1:26 pm
Reply with quote

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
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1306
Location: Vilnius, Lithuania

PostPosted: Sun Dec 24, 2017 3:08 pm
Reply with quote

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
View user's profile Send private message
SENTHIL MURUGAAN
Warnings : 1

New User


Joined: 12 Jan 2013
Posts: 32
Location: India

PostPosted: Sun Dec 24, 2017 5:51 pm
Reply with quote

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
View user's profile Send private message
magesh23586

Active User


Joined: 06 Jul 2009
Posts: 213
Location: Chennai

PostPosted: Wed Dec 27, 2017 1:12 am
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Dec 29, 2017 8:28 pm
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Wed Jan 03, 2018 2:02 pm
Reply with quote

Why not simply use the IBM compare utility ???
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
Search our Forums:

Back to Top