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 Records in a file based on a key

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

New User


Joined: 14 Aug 2007
Posts: 14
Location: Chennai

PostPosted: Tue Dec 07, 2010 12:54 am    Post subject: Merge Records in a file based on a key
Reply with quote

Hi,

I have an Input file similar to the one given below

Code:
000001XXXXXXSPACESYYYYYSPACES
000001SPACESZZZZZZSPACESAAAAAA


I have to merge the two records in the I/P file based on the key 000001 (1:6)

The output should look like

Code:

000001XXXXXZZZZZYYYYYAAAAA


Is there any way to do this using DFSORT or ICETOOL?

Your help is appreciated.

Regards
Santhosh
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: Tue Dec 07, 2010 2:25 am    Post subject:
Reply with quote

Your output doesn't seem to match your input. For example, in the input you show 6 X's but in the output you show 5 X's, etc.

Does your input file only have two records, or can it have more? If more, then show a better example with more records.

Give the RECFM and LRECL of the input file. Give the starting position, length and format of each field in the input record, and in the output record.

BTW, this is not a "merge". It's a SPLICE.
Back to top
View user's profile Send private message
sthirumalai

New User


Joined: 14 Aug 2007
Posts: 14
Location: Chennai

PostPosted: Tue Dec 07, 2010 3:27 am    Post subject: Reply to: Merge Records in a file based on a key
Reply with quote

Hi Frank,

Thanks for your response

My input file is 80 Bytes FB

I apologize for the incorrect I/P data. Here is the corrected one

000002XXXXXSPACESYYYYYSPACES
000001XXXXXSPACESYYYYYSPACES
000001SPACESZZZZZSPACESAAAAA
000002SPACESZZZZZSPACESAAAAA

The output file is 80 Bytes FB and that should look like
000001XXXXXZZZZZYYYYYAAAAA
000002XXXXXZZZZZYYYYYAAAAA

My I/P files will contain more than two records.

Key - 1,6,CH
FIELD1 - 7,5,CH
FIELD2 - 12,5,CH
FIELD3 - 17,5,CH
FIELD4 - 22,5,CH

Please let me know if you need more details

Regards
Santhosh
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: Tue Dec 07, 2010 3:35 am    Post subject:
Reply with quote

Quote:
My I/P files will contain more than two records.


Ok. But it's still not clear what your input can look like.

Will each key have a pair of records as shown in your example?

Could a key have only one record? Could a key have more than two records? If so, what does the input look like for these variations and what do you want for output?

For the same key, does the record with field1 always come before the record with field2, or could they be reversed, e.g.

000003SPACESZZZZZSPACESAAAAA
000003XXXXXSPACESYYYYYSPACES

I really need a complete picture of what variations you can have for the input records before I can give you a complete solution.
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 SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
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


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