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
 

 

Merge 2 files horizontally based on key

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

New User


Joined: 18 May 2007
Posts: 27
Location: Hyderabad

PostPosted: Wed Nov 17, 2010 9:50 pm    Post subject: Merge 2 files horizontally based on key
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    Post subject:
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: 27
Location: Hyderabad

PostPosted: Thu Nov 18, 2010 12:54 am    Post subject:
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    Post subject:
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    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 Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 15 Thu Dec 01, 2016 8:28 pm
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm


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