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

Merge 2 files horizontally based on key


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
madishpa

New User


Joined: 18 May 2007
Posts: 28
Location: Hyderabad

PostPosted: Wed Nov 17, 2010 9:50 pm
Reply with quote

Hi,

Could you please help merge 2 files horizontally based on the key.

Following is the example

File1 : Key is first 18 numbers(No duplicates and LRECL is 55 and FB) and file is sorted
File2 : Key is first 18 numbers(Duplicates present and LRECL is 150 and FB) and file is sorted

If records present on both files, merge horizontally as FILE2||FILE1
If records present in file2 only,write the entire contents of file2 only.
If records present in file1 only,nothing to be written to output

Example:

File1:(Key first 18 numbers)

111111111111111111...........(55 lrecl)
222222222222222222...........(55 lrecl)
333333333333333333...........(55 lrecl)
444444444444444444...........(55 lrecl)
666666666666666666...........(55 lrecl)

File2:(Key first 18 numbers)
111111111111111111...........(150 lrecl)
222222222222222222...........(150 lrecl)
222222222222222222...........(150 lrecl)
222222222222222222...........(150 lrecl)
222222222222222222...........(150 lrecl)
333333333333333333...........(150 lrecl)
555555555555555555...........(150 lrecl)
666666666666666666...........(150 lrecl)

Output:
111111111111111111...........(150 lrecl)111111111111111111...........(55 lrecl)
222222222222222222...........(150 lrecl)222222222222222222...........(55 lrecl)
222222222222222222...........(150 lrecl)222222222222222222...........(55 lrecl)
222222222222222222...........(150 lrecl)222222222222222222...........(55 lrecl)
222222222222222222...........(150 lrecl)222222222222222222...........(55 lrecl)
333333333333333333...........(150 lrecl)333333333333333333...........(55 lrecl)
555555555555555555...........(150 lrecl)
666666666666666666...........(150 lrecl)666666666666666666...........(55 lrecl)

Please advise at the earliest.
Thanks in advance.

Regards,
Madishpa.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Wed Nov 17, 2010 10:42 pm
Reply with quote

madishpa,

The following DFSORT JCL will give you the desired results.

Code:

//STEP0100 EXEC PGM=SORT                                   
//SYSOUT   DD SYSOUT=*                                     
//FB055    DD DSN=Your 55 byte input file,DISP=SHR
//FB150    DD DSN=Your 150 byte input file,DISP=SHR
//SORTOUT  DD SYSOUT=*                                     
//SYSIN    DD *                                           
  OPTION COPY                                             
  JOINKEYS F1=FB055,FIELDS=(1,18,A),SORTED,NOSEQCK         
  JOINKEYS F2=FB150,FIELDS=(1,18,A),SORTED,NOSEQCK         
  JOIN UNPAIRED                                           
  REFORMAT FIELDS=(?,F2:1,150,F1:1,55)                     
  OUTFIL OMIT=(1,1,ZD,EQ,1),BUILD=(2,205)                 
//*
Back to top
View user's profile Send private message
madishpa

New User


Joined: 18 May 2007
Posts: 28
Location: Hyderabad

PostPosted: Thu Nov 18, 2010 12:54 am
Reply with quote

Hi Kolusu,

Thank you so much.It has worked.
Could you please let me know, how to find a character in position 25 and replace it with a number. The record length in 223 and is FB.

Replace { with 0 at position 25.
Replace A with 1 at position 25.
Replace B with 2 at position 25.
Replace C with 3 at position 25.
Replace D with 4 at position 25.
Replace E with 5 at position 25.
Replace F with 6 at position 25.
Replace G with 7 at position 25.
Replace H with 8 at position 25.
Replace I with 9 at position 25.

Appreciate your help.

Thanks,
Madishpa.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Thu Nov 18, 2010 2:25 am
Reply with quote

madishpa wrote:
Hi Kolusu,

Thank you so much.It has worked.
Could you please let me know, how to find a character in position 25 and replace it with a number. The record length in 223 and is FB.


It sounds like you have sign overpunch Zoned decimal data and you want to see the readable format of them. Is that true? What would you do if the the 25th byte had }JKLMNOPQR which denotes negative numbers?

This is the representation of the ZD numbers . The number on top represents the sign over punch and the lower number represents the readable decimal number
Code:

{ABCDEFGHI}JKLMNOPQR
CCCCCCCCCCDDDDDDDDDD
01234567890123456789 


Hex C0 thru C9 are positive numbers and D0 thru D9 are negative numbers. Try to understand your data before you decide to change them.
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 Merge two VSAM KSDS files into third ... JCL & VSAM 6
Search our Forums:

Back to Top