Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

VSAM file comparison

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
ganeshprasanna

New User


Joined: 21 Feb 2009
Posts: 36
Location: South Portland, Maine

PostPosted: Thu Jun 18, 2009 6:26 pm    Post subject: VSAM file comparison
Reply with quote

I have 2 variable length files with 1 ranging from 23 to 26543 and other ranging from 23 to 30623. Key for both files starts from 1 to 13 and of length 13 bytes.
I want to compare these 2 files and write an error report if the files are not matching. The mismatch can be of any type. ie; if any of the records are not matching, keys are not matching or if 1 file has more number of records than the other etc etc.

The file layouts are given below:
File 1:

Code:
       01  WS-AAA-RECORD.
           05  WS-AA-KEY                 PIC X(13).
           05  WS-AA-VAR1               PIC X(08).
           05  WS-AA-VAR2               PIC S9(04) COMP.
           05  WS-AA-VAR1-INFO           OCCURS 1  TO 2040 TIMES
                                            DEPENDING ON
                                            WS-AA-VAR2.
               10  WS-AA-VAR3            PIC S9(04)    COMP.
               10  WS-AA-VAR4            PIC X(11).


File 2:

Code:
       01  WS-BBB-RECORD.
           05  WS-BBB-KEY                 PIC X(13).
           05  WS-BBB-VAR1               PIC X(08).
           05  WS-BBB-VAR2               PIC S9(04)    COMP.
           05  WS-BBB-VAR1-INFO           OCCURS 1  TO 2040 TIMES
                          DEPENDING ON WS-BBB-VAR2.
               10  WS-BBB-VAR3            PIC S9(05)    COMP.
               10  WS-BBB-VAR4            PIC X(11).


Please help me.
Back to top
View user's profile Send private message

Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Jun 18, 2009 11:31 pm    Post subject:
Reply with quote

ganeshprasanna,

1. Are these KSDS VSAM clusters?
2. Is it ok to just write out the keys in the report or do you want the entire records to be written out?
Back to top
View user's profile Send private message
ganeshprasanna

New User


Joined: 21 Feb 2009
Posts: 36
Location: South Portland, Maine

PostPosted: Thu Jun 18, 2009 11:48 pm    Post subject:
Reply with quote

Hi Skolusu,

1. Yes these are KSDS VSAM clusters.

2. Yeah. its ok with the key to be written in the file.

But can i also get exact posotion of mismatch also? It would be helpful.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Jun 19, 2009 1:36 am    Post subject:
Reply with quote

ganeshprasanna,

The following DFSORT/ICETOOL JCL will give you the desired results


Code:

//STEP0100 EXEC PGM=ICETOOL                                       
//TOOLMSG  DD SYSOUT=*                                           
//DFSMSG   DD SYSOUT=*                                           
//VSAM1    DD DSN=your vsam file 1,DISP=SHR                     
//VSAM2    DD DSN=your vsam file 2,DISP=SHR                     
//T1       DD DSN=&&T1,DISP=(MOD,PASS),SPACE=(CYL,(X,Y),RLSE)     
//OUT      DD SYSOUT=*                                           
//TOOLIN   DD *                                                   
  COPY FROM(VSAM1) USING(CTL1)                                   
  COPY FROM(VSAM2) USING(CTL1)                                   
  SORT FROM(T1) USING(CTL2)                                       
//CTL1CNTL DD *                                                   
  INREC BUILD=(1,13)                                             
  OUTFIL FNAMES=T1,REMOVECC,HEADER1=(C'$')                       
//CTL2CNTL DD *                                                   
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,1,CH,EQ,C'$'),PUSH=(14:ID=1))
  SORT FIELDS=(1,13,CH,A)                                         
  SUM FIELDS=(14,1,ZD)                                           
  OUTFIL FNAMES=OUT,OMIT=(1,1,CH,EQ,C'$'),                       
  IFTHEN=(WHEN=(14,1,ZD,EQ,1),                                   
  OVERLAY=(14:C' - KEY FOUND ONLY IN FILE1')),                   
  IFTHEN=(WHEN=(14,1,ZD,EQ,2),                                   
  OVERLAY=(14:C' - KEY FOUND ONLY IN FILE2')),                   
  IFTHEN=(WHEN=(14,1,ZD,EQ,3),                                   
  OVERLAY=(14:C' - MATCHING KEY IN 2 FILES'))                     
/*


This will create a file like this

Code:

KEY1 - KEY FOUND ONLY IN FILE1
KEY2 - KEY FOUND ONLY IN FILE2
KEY3 - MATCHING KEY IN 2 FILES 
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Jun 19, 2009 2:13 am    Post subject:
Reply with quote

Hello,

Possibly, i misunderstand, but i believe the requirement includes comparing the entire record (and posting the position(s?) of the mismatch(es?) along with the key) when the keys match. . .

I wouldn't try to guess guess how duplicates should be handled. . . icon_confused.gif
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Jun 19, 2009 2:20 am    Post subject:
Reply with quote

dick scherrer,

1. KSDS vsam clusters cannot have duplicates on KEY.
2. OP did say he is OK with just the keys.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Jun 19, 2009 2:34 am    Post subject:
Reply with quote

Hi Kolusu,

Quote:
1. KSDS vsam clusters cannot have duplicates on KEY.
Oops, my bad - forgot we were talking vsam icon_redface.gif

Quote:
2. OP did say he is OK with just the keys.
That is the part i may have misunderstood. . . I believe he is ok with only the key being shown as output rather than entire records.

I believe he wants the key and any "data position" that does not match as the output - made more complicated as the elementary items in the arrays are not the same size. . .

Maybe he will clarify.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Jun 19, 2009 3:04 am    Post subject:
Reply with quote

dick scherrer,

IF OP's Intention is to compare byte by byte then he needs to code a program to do it. DFSORT does not have the ability to compare byte by byte and pick the differences.
Back to top
View user's profile Send private message
ganeshprasanna

New User


Joined: 21 Feb 2009
Posts: 36
Location: South Portland, Maine

PostPosted: Fri Jun 19, 2009 5:31 pm    Post subject:
Reply with quote

Hi Kolusu,

Thanks for the quick response.

But as per my requirement, I need to compare the complete record and not just the keys.

But listing in the report can either be mismatched key or the complete record.

Is there any way out?

Thanks for all your inputs.

Thanks,
Ganesh
Back to top
View user's profile Send private message
PeD

Active User


Joined: 26 Nov 2005
Posts: 456
Location: Belgium

PostPosted: Fri Jun 19, 2009 6:45 pm    Post subject:
Reply with quote

Ecomp can do that easily.

Any chance you have it?
Back to top
View user's profile Send private message
ganeshprasanna

New User


Joined: 21 Feb 2009
Posts: 36
Location: South Portland, Maine

PostPosted: Fri Jun 19, 2009 7:02 pm    Post subject:
Reply with quote

Ped,

Could you please give me more Info on Ecomp?.

If its a third party tool, i am pretty sure we would not have it.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Jun 19, 2009 7:17 pm    Post subject:
Reply with quote

you know that in the two days you have been flumiging around looking for something easy (translate: written by someone else)
you could have coded a COBOL module to compare the 5 variables in each record.

use the match program from the "Programs" button on top,
using the match logic - which is the hardest to write
change what is necessary, write a perform for the 2040 occurances.

you can't use a generic compare
because the files are not the same
Code:

AAA record
10  WS-AA-VAR3           PIC S9(04)    COMP.
BBB record
10  WS-BBB-VAR3          PIC S9(05)    COMP.
Back to top
View user's profile Send private message
ganeshprasanna

New User


Joined: 21 Feb 2009
Posts: 36
Location: South Portland, Maine

PostPosted: Fri Jun 19, 2009 8:20 pm    Post subject:
Reply with quote

Thanks Dick Brenholtz,

Of course COBOL module was my last resort. Wanted to know if there were any other options available. What about the runtime performance if COBOL module is used considering a large file with huge amount of records?

Any specific pointers to tune for performance?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Jun 19, 2009 8:33 pm    Post subject:
Reply with quote

The COBOL part, use INDEXED BY instead of subscripts.
The report should be a WRITE to a dataset instead of DISPLAY upon console.
Otherwise, the COBOL module should be about 100 lines (maybe more).

The VSAM tuning, I would suggest consulting the IBM REDBOOK VSAM Demystified
as well as search this forum.
Robert Sample (and others) have repeated posted on DCB parms that could/should be used.
Back to top
View user's profile Send private message
PeD

Active User


Joined: 26 Nov 2005
Posts: 456
Location: Belgium

PostPosted: Fri Jun 19, 2009 8:40 pm    Post subject:
Reply with quote

Ganesh,

Quote:
Ped,
Could you please give me more Info on Ecomp?.
If its a third party tool, i am pretty sure we would not have it.


EComp is an independent software ( I invented ) which can cross compare any objects on IBM Mainframes : SAM, VSAM, DB2 tables, Queues, unloads od BD2 ( IBM, BMC ),extracts of SPUFI, QMF, SDSF, DDL's, Structures, apple, pear.... "Cross" means you can compare a SAM file with the content of a DB2 table, or a VSAM with a SAM, etc

The power of utility are in a nutshell : variety of criteria ( select, where clause, mutation, tolerance, reformat, timestamp neutralisation, ... and clear results : direct to the spot.

More documentation on request if really interested.

best regards

Pierre
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Jun 19, 2009 11:23 pm    Post subject:
Reply with quote

Pierre,

you site is unreachable without JAVA Script enabled,
which should be no needed.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Jun 19, 2009 11:55 pm    Post subject:
Reply with quote

Hi Pierre,

Does ecomp compare elements with the same logical content, but differing data lengths?

For example 000000123 and 00123 should compare equal even though they are different lengths. . . And these are embedded within arrays in the 2 files.
Back to top
View user's profile Send private message
PeD

Active User


Joined: 26 Nov 2005
Posts: 456
Location: Belgium

PostPosted: Sat Jun 20, 2009 2:22 am    Post subject:
Reply with quote

Quote:
Does ecomp compare elements with the same logical content, but differing data lengths?

For example 000000123 and 00123 should compare equal even though they are different lengths. . . And these are embedded within arrays in the 2 files.


Yes Ecomp can do that on demand : 00000123 can be equal to 123,
as 123 in packed decimal can be equal to 123 in numeric.
It is an option.

Ecomp is also able to compare records with structure variables as "depending on" in Cobol or "refer block" in PL/I.

example : count "0003 abc def ghi" compared to "0002 abc ghi" will show only difference on def and accept ghi even if the positions in the records is not same depending on the counter.

And more and more...


To Dick ( somewhere in Germany )

Quote:
Pierre,

you site is unreachable without JAVA Script enabled,
which should be no needed.

Yes I have to work on that urgently.

Thanks

Pierre
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
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us