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

Merge Records in a file based on a key


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


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

PostPosted: Tue Dec 07, 2010 2:25 am
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
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 Developer


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

PostPosted: Tue Dec 07, 2010 3:35 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 5
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top