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
 

 

Compare 2 files with different record lengths

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

Active User


Joined: 04 Oct 2006
Posts: 118
Location: NJ, USA

PostPosted: Fri Dec 29, 2006 1:34 am    Post subject: Compare 2 files with different record lengths
Reply with quote

Hi,
My requirement is like this:

I have 2 files
File1 : Lrecl - 703 - field 1 - starting from position 1 of length 3.
Code:
265 553546929632423CM08M 2658394OTHR   PRC0000001002002-07-24
265 81U606929632423RO    2658394OTHR   PRC0000001001991-02-01


File 2: KSDS Vsam file - Lrecl -80 - field 2 starting from position 8 (considering its V) of length 3. this field is not the key.
Code:
1AM 265
1AP 265
1AX 165
1BA 265
1BB 165



I need to compare field1 from File1 and field2 from File2 and retrieve the matched and unmatched records from File1.

I am not sure if this can be accomplised using sort.
Any pointers will be of great help.

Thanks in advance,
Viji
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Fri Dec 29, 2006 4:50 am    Post subject:
Reply with quote

Do you want the matched records from file1 in one output file and the unmatched records from file1 in another output file? In your example, the two records in file1 have a key of 265 and three records in file2 have a key of 265. You don't show any records in file1 without a match in file2.

Please show a better example of the input records with matched and unmatched records, and show the expected output records.
Back to top
View user's profile Send private message
vijikesavan

Active User


Joined: 04 Oct 2006
Posts: 118
Location: NJ, USA

PostPosted: Fri Dec 29, 2006 9:05 pm    Post subject: Re: Compare 2 files with different record lengths
Reply with quote

Sorry about not being clear. Here is more info.

My file1 is :
Code:
265553546929632423CM08M 2658394OTHR   PRC0000001002002-07-24                   
26581U606929632423RO    2658394OTHR   PRC0000001001991-02-01                   
705109181673685423RO    7053496DECD   PRC0000002502005-06-07                   
705329801673685423RO    7053496CLIENT PRC0000002501982-09-16                   
85999W916487502803SC   M8593441BENE      0000004422002-04-02   


My file 2
Code:
23B 265 Y           
23C 265 Y           
23D 23C Y           
23E 859 Y           
23F 23F Y           
23G 23G Y   


My output fileA: Matched records from File1
Code:
265553546929632423CM08M 2658394OTHR   PRC0000001002002-07-24                   
26581U606929632423RO    2658394OTHR   PRC0000001001991-02-01             
85999W916487502803SC   M8593441BENE      0000004422002-04-02   


My outputfileB: Unmatched records from File1

Code:
705109181673685423RO    7053496DECD   PRC0000002502005-06-07                   
705329801673685423RO    7053496CLIENT PRC0000002501982-09-16


Please let me know if I missed any other info.
Thanks for your help,
Viji
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Fri Dec 29, 2006 9:42 pm    Post subject:
Reply with quote

I forgot to ask about the record type for the two input files:

What is the RECFM of file1?

Are all of the records in file2 the same length, so we can process them as fixed length records? Or are they of different lengths so we have to process them as variable length records?
Back to top
View user's profile Send private message
vijikesavan

Active User


Joined: 04 Oct 2006
Posts: 118
Location: NJ, USA

PostPosted: Sat Dec 30, 2006 12:44 am    Post subject: Re: Compare 2 files with different record lengths
Reply with quote

File1 is recfm=FB, LRECL=703
File2 is KSDS LRECL=80, Recfm - V
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Sat Dec 30, 2006 2:01 am    Post subject:
Reply with quote

Here's a DFSORT/ICETOOL job that will do what you asked for:

Code:

//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=...  input file1 (FB/703)
//IN2 DD DSN=...  input file2 (VSAM KSDS)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT1 DD DSN=...  output file1 (FB/703)  - matched
//OUT2 DD DSN=...  output file2 (FB/703)  - unmatched
//TOOLIN DD *
COPY FROM(IN2) TO(T1) USING(CTL1) VSAMTYPE(V)
COPY FROM(IN1) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT1) ON(1,3,CH) KEEPNODUPS KEEPBASE -
  WITHALL WITH(1,704) USING(CTL3)
/*
//CTL1CNTL DD *
  OUTFIL FNAMES=T1,VTOF,BUILD=(1:9,3,704:C'BB')
/*
//CTL2CNTL DD *
  INREC OVERLAY=(704:C'VV')
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=OUT1,INCLUDE=(704,2,CH,EQ,C'VB'),
    BUILD=(1,703)
  OUTFIL FNAMES=OUT2,INCLUDE=(704,2,CH,EQ,C'VV'),
    BUILD=(1,703)
/*


Quote:
File 2: KSDS Vsam file - Lrecl -80 - field 2 starting from position 8 (considering its V) of length 3.


The field appears to start at position 9, not position 8.
Back to top
View user's profile Send private message
vijikesavan

Active User


Joined: 04 Oct 2006
Posts: 118
Location: NJ, USA

PostPosted: Thu Jan 04, 2007 11:15 pm    Post subject: Re: Compare 2 files with different record lengths
Reply with quote

New year wishes to you all.
Back from my vacation. I customized this for my requirement and it worked perfectly fine.
Thanks Frank for your time and valuable suggesstion.

Thanks,
Viji
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 Storing huge volume of data, compare ... Pradeep K M All Other Mainframe Topics 3 Mon Jan 16, 2017 5:08 pm
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 15 Thu Dec 01, 2016 8:28 pm
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
This topic is locked: you cannot edit posts or make replies. How to use 2 input files in control c... Gunapala CN DFSORT/ICETOOL 23 Thu Oct 13, 2016 3:42 pm


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