Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Compare two PS files using ICE TOOL for updated records

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Compare two PS files using ICE TOOL for updated records
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: 1120
Location: Oostende, Belgium

PostPosted: Sun Dec 24, 2017 3:08 pm    Post subject: Re: Compare two PS files using ICE TOOL for updated records
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    Post subject: Reply to: Compare two PS files using ICE TOOL for updated records
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    Post subject: Re: Reply to: Compare two PS files using ICE TOOL for updated records
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: 2427
Location: @my desk

PostPosted: Fri Dec 29, 2017 8:28 pm    Post subject:
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: 8735
Location: Welsh Wales

PostPosted: Wed Jan 03, 2018 2:02 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. DFSORT output in CSV for data spans i... hiravibk DFSORT/ICETOOL 3 Tue Nov 13, 2018 7:55 pm
No new posts Writing multiple records into a CSV r... hiravibk DFSORT/ICETOOL 2 Wed Nov 07, 2018 2:35 pm
No new posts Can records in IMS/DB be related usin... SRICOBSAS IMS DB/DC 2 Fri Oct 19, 2018 3:53 pm
No new posts Anyone know how to copy Unix files? John Poulakos JCL & VSAM 7 Wed Oct 10, 2018 12:57 am
No new posts PL/I read error for HFS files Joe Kirsch PL/I & Assembler 6 Fri Sep 28, 2018 9:13 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us