Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
Merging two files having different length using Sort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
Author Message
diwansk

New User


Joined: 01 May 2005
Posts: 7
Location: Bangalore

PostPosted: Sun May 01, 2005 3:37 pm    Post subject: Merging two files having different length using Sort
Reply with quote

How can i merge two files having different length using Sort. any help
Back to top
View user's profile Send private message
References
Frank Yaeger

DFSORT Moderator


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

PostPosted: Sun May 01, 2005 9:57 pm    Post subject:
Reply with quote

Assuming the input files have RECFM=FB, you have to pad the shorter one to the length of the longer one before you can merge them. If you need more specific help on this, tell me the RECFM and LRECL of each input file, and whether you actually want to merge the files or just copy them. To merge the input files, they must already be in sorted order and the output records will be in sorted order. Copying the files means the output file will have all of the records of the first input file followed by all of the records of the second input file.
Back to top
View user's profile Send private message
diwansk

New User


Joined: 01 May 2005
Posts: 7
Location: Bangalore

PostPosted: Mon May 02, 2005 2:33 pm    Post subject: Re: Merging two files having different length using Sort
Reply with quote

basically i have two gdg files one with recl 324 & other with recl 80 (trailer). I want to append the second file on the first one
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Mon May 02, 2005 8:47 pm    Post subject:
Reply with quote

You can use the following DFSORT job to do that:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...   input file 2
//SORTOUT DD DISP=MOD,DSN=...  input file 1
//SYSIN    DD    *
  OPTION COPY
  OUTREC FIELDS=(1,80,324:X)
/*


The job pads the 80-byte record from input file 2 with blanks to 324 bytes, and MODs it on to the end of input file 1.
Back to top
View user's profile Send private message
vijayamadhuri

Active User


Joined: 06 Apr 2005
Posts: 187

PostPosted: Mon May 02, 2005 11:49 pm    Post subject: to Mr Frank Yaeger about sort
Reply with quote

Sir,
I have read that while merging the datasets they should have the same record format and that they should have been previously sorted on the same control fields.

Does this actually mean that the sort criteria on both the datasets should have been the same before merging.
Please correct me if I am wrong.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Tue May 03, 2005 12:43 am    Post subject:
Reply with quote

VM,

As I explained above, there is a difference between merging and copying. What diwansk wants to do is copying, not merging.

Quote:
I have read that while merging the datasets they should have the same record format and that they should have been previously sorted on the same control fields.

Does this actually mean that the sort criteria on both the datasets should have been the same before merging.
Please correct me if I am wrong.


Yes, that's correct. If you want to MERGE, SORT or COPY multiple input files, the files must have all have a V-type RECFM (e.g. V, VB, VBS) or an F-type format (e.g. F, FB).

If you want to MERGE files, each file to be merged must already be in the order you use for the MERGE statement. For example, if you want to use:

Code:

   MERGE FIELDS=(11,5,CH,A)


then each input file to be merged must already have been sorted by 11,5,CH,A. If the input files are not already sorted, then you would concatenate and SORT them rather than MERGE them.
Back to top
View user's profile Send private message
diwansk

New User


Joined: 01 May 2005
Posts: 7
Location: Bangalore

PostPosted: Tue May 03, 2005 4:58 pm    Post subject: Re: Merging two files having different length using Sort
Reply with quote

Hi
Thanks for the same
I am getting the following error

OPTION COPY
OUTREC FIELDS=(1,80,388:X)
ICE043A 3 INVALID DATA SET ATTRIBUTES SPECIFIED SORTOUT RECFM
ICE052I 3 END OF DFSORT

i am using the following statement in Proc

/STEP010 EXEC PGM=ICEMAN
/SORTIN DD DSN=&ID.CW.&TLQ.&REST&OSFX&GENIN,DISP=SHR
/SORTOUT DD DSN=&ID.CW.&TLQ.&REST&GENIN,DISP=MOD
/SYSOUT DD SYSOUT=*

All files are GDG
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Tue May 03, 2005 9:12 pm    Post subject:
Reply with quote

The ICE043A indicates that there's a mismatch in the RECFM for the data sets you're using. What is the RECFM and LRECL of your SORTIN file? What is the RECFM and LRECL of your SORTOUT file?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1