MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Retaining sequence of input records while merging

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
da_one
Beginner


Joined: 15 Oct 2003
Posts: 11
Topics: 4

PostPosted: Thu Dec 25, 2003 3:10 am    Post subject: Retaining sequence of input records while merging Reply with quote

Hi,
Merry Christmas Very Happy

I am confused with how the Merge functions. I have a requirement of Merging Fixed Length files to form a variable length file.

Consider File A (Fixed record length file of 20 bytes)
Records:
10000AAAAAAAAAAAAAAA
10002BBBBBBBBBBBBBBB
10002CCCCCCCCCCCCCCC
10004AAAAAAAAAAAAAAA

Consider File B (Fixed record length file of 10 bytes)
Records:
10000PPPPP
10001PPPPP
10002QQQQQ
10002RRRRR
10004SSSSS

The Output C for the above 2 Input files(Variable Length file)
10000AAAAAAAAAAAAAAA
10000PPPPP
10001PPPPP
10002BBBBBBBBBBBBBBB
10002CCCCCCCCCCCCCCC
10002QQQQQ
10002RRRRR
10004AAAAAAAAAAAAAAA
10004SSSSS

I want the files to be merged on the first 5 bytes such that the Resultant file C that is created is a variable length file. I do not want to combine file A and B in a sort step, but I want to retain the sequence of records in file A and B.
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Thu Dec 25, 2003 11:20 am    Post subject: Reply with quote

You can't merge two FB files with different LRECLs directly. You could pad out the FB 10 file to an FB 20 file and then merge those and convert them to VB, but you would end up with extra blanks you don't need. You can merge two VB files with different LRECLs directly. So the best way to do what you want is to convert each FB file to a VB file separately and then merge them. Here's a DFSORT job to do that:

Code:

//C1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file A (FB)
//SORTOUT DD DSN=&&OA,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//SYSIN    DD    *
* COPY FB FILEA AND CONVERT TO VB
   OPTION COPY
   OUTFIL FTOV
/*
//C2    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file B (FB)
//SORTOUT DD DSN=&&OB,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//SYSIN    DD    *
* COPY FB FILEB AND CONVERT TO VB
   OPTION COPY
   OUTFIL FTOV
/*
//M1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN01 DD DSN=&&OA,DISP=(OLD,PASS)
//SORTIN02 DD DSN=&&OB,DISP=(OLD,PASS)
//SORTOUT DD DSN=...  output file (VB)
//SYSIN    DD    *
* MERGE THE TWO VB FILES
   OPTION EQUALS
   MERGE FIELDS=(5,5,CH,A)
/*

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
da_one
Beginner


Joined: 15 Oct 2003
Posts: 11
Topics: 4

PostPosted: Sat Dec 27, 2003 11:58 pm    Post subject: Reply with quote

Thanks Frank....u the best Very Happy
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group