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

Compare 2 files with different record lengths


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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 Developer


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

PostPosted: Fri Dec 29, 2006 4:50 am
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
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 Developer


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

PostPosted: Fri Dec 29, 2006 9:42 pm
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
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 Developer


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

PostPosted: Sat Dec 30, 2006 2:01 am
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 8
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts Compare only first records of the fil... SYNCSORT 7
Search our Forums:

Back to Top