View previous topic :: View next topic
|
Author |
Message |
sandybadam
New User
Joined: 09 Oct 2006 Posts: 14
|
|
|
|
Hi,
I want to merge 2 files using sort.
File1 is a header file with below records
Code: |
Customerno name amount |
File2 is a record file with some hexadecimal feilds in it. 3300000033 is a hexadecimal value.
Code: |
123456789 ABCDEFGHIJ 3300000033
|
I am fomatting the hexadecimal values using sort and in the same sort step i want to concatenate the above 2 files.
OUTREC FIELDS=(64,8,PD,TO=ZD,X) |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
So, concatenate in the JCL. What problem does that give you? |
|
Back to top |
|
|
sandybadam
New User
Joined: 09 Oct 2006 Posts: 14
|
|
|
|
I don't want to format the header file and only want to format the record file.
But as per the below code it will format both the files and header file is having only charcter data hence it is throwing S0C7.
Both the files is having record length of 124.
Code: |
//SORT1 EXEC PGM=SORT
//SORTIN DD DISP=SHR, DSN= Header File
// DD DISP=SHR, DSN= Record file
//SORTOUT DD DSN=output, DISP=SHR
//SYSIN DD *
SORT FIELDS=COPY
OUTREC FIELDS=(1,10,C';',
11,40,C';',
51,10,C';',
61,3,C';',
64,8,PD,EDIT=(SIIIIIIIIIIIIIII),SIGNS=(,-),C';',
72,8,PD,EDIT=(SIIIIIIIIIIIIIII),SIGNS=(,-),C';',
64,8,PD,SUB,72,8,PD,EDIT=(SIIIIIIIIIIIIIII),SIGNS=(,-),C';',
80,3,PD,EDIT=(TTTTT),C';')
|
|
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
If I understand your requiremet please think of using DATASORT |
|
Back to top |
|
|
sandybadam
New User
Joined: 09 Oct 2006 Posts: 14
|
|
|
|
But I have 2 different files.
File1 is header and FILE2 is Record file..
how to use DATASORT in this scenario. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
If you want to use JOINKEYS to avoid writing an IFTHEN=, you can. If you want to do the concatenation in the JCL somewhere "after" this, you can. These would be very poor use of resources (client paying for them, as well).
Or you can use IFTHEN=(WHEN=(logexp to avoid doing anything to the header. |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Hi Sandy,
Bills solution is the best solution , DATASORT cant be used in this particular scenario |
|
Back to top |
|
|
sandybadam
New User
Joined: 09 Oct 2006 Posts: 14
|
|
|
|
Actually I did concatenation after the sort step and it worked.
But I was looking for a better solution to do in single step(SORT step).
Thanks for your time and inputs on the same..
Have a nice weekend. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
in the sort step concatenate in the SORTIN DD the two datasets |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
sandybadam wrote: |
But I have 2 different files.
File1 is header and FILE2 is Record file..
how to use DATASORT in this scenario. |
If both files have the SAME DCB properties you can simply concatenate them and just sort the detail records. |
|
Back to top |
|
|
|