|
|
| Author |
Message |
diwansk
New User
Joined: 01 May 2005 Posts: 7 Location: Bangalore
|
|
|
|
| How can i merge two files having different length using Sort. any help |
|
| Back to top |
|
 |
References
|
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4579 Location: San Jose, CA
|
|
|
|
| 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 |
|
 |
diwansk
New User
Joined: 01 May 2005 Posts: 7 Location: Bangalore
|
|
|
|
| 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 |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4579 Location: San Jose, CA
|
|
|
|
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 |
|
 |
vijayamadhuri
Active User
Joined: 06 Apr 2005 Posts: 187
|
|
|
|
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 |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4579 Location: San Jose, CA
|
|
|
|
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 |
|
 |
diwansk
New User
Joined: 01 May 2005 Posts: 7 Location: Bangalore
|
|
|
|
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 |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4579 Location: San Jose, CA
|
|
|
|
| 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 |
|
 |
|
|