View previous topic :: View next topic
|
Author |
Message |
morfius9 Warnings : 1 New User
Joined: 22 Feb 2006 Posts: 27
|
|
|
|
Hi,
I have an input file which contains a header record and a set of detail records. I want to copy the header record(unsorted) and then sorted output for the rest of the detail records in my output record. Is there any way i can do this in SYNCSORT. |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
Quote: |
Is there any way i can do this in SYNCSORT. |
Yes, there is. please show us sample input and the expected output from that. Please tell us the LRECL/RECFM of input/output also. |
|
Back to top |
|
|
morfius9 Warnings : 1 New User
Joined: 22 Feb 2006 Posts: 27
|
|
|
|
Input File -
XXXXABCDEF
0001NO03MOUNTAIN
0001NO01HILL
0001NO02STREAM
Output File
XXXXABCDEF
0001NO01HILL
0001NO02STREAM
0001NO03MOUNTAIN
The first record which is the header needs to be in the output file as well - same format as in the input file. The output file should be sorted on the second field beginning offset 04, length 04 - alphanumeric. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
To get help, you need to provide requested info. . .
Quote: |
Please tell us the LRECL/RECFM of input/output also |
Someone could guess, but why should they. . . |
|
Back to top |
|
|
morfius9 Warnings : 1 New User
Joined: 22 Feb 2006 Posts: 27
|
|
|
|
My bad. LRECL=200. RECFM=FB of both input & output. Also, XXXX in the input file is low values - if that helps. |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
are the first 4 bytes of the detail records always 0001 ? if so you can use
Code: |
SORT FIELDS=(1,8,BI,A)
|
Gerry |
|
Back to top |
|
|
morfius9 Warnings : 1 New User
Joined: 22 Feb 2006 Posts: 27
|
|
|
|
Input File -
XXXXABCDEF
0001NO03MOUNTAIN
0001NO01HILL
0001NO02STREAM
Output File
XXXXABCDEF
0001HILL NO01
0001STREAM NO02
0001MOUNTAINNO03
Im having to do a reformatting as well now for a file compatibility with other downstream processes using the same file. For this i need to move the Numbering to the end as shown above. In this case my header's ABCDEF is splitting up because im moving the fields around. Is there any way to get the same header record & only have the INREC/SORT statements work on the data records? |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
Your latest example is different than what you have showed in your earlier post. Also, you have not used Bbcode. I tried to align your input/output suign BBcode, however, they did not align well - so I left them as is. Could you please post themm back with proper alignment using BBcode.
Also, what Sort product are you using - if it's SyncSort what release of it are you using? If you tell this may be we can use DATASORT parameter.
On the other hand, keeping the header intact, and sorting "data-fields", you can use the below Job as reference, assuming that your input is FB recfm and 80 bye LRECL and your key to be sorted is first 9 bytes.
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
XXXXXXX - HEADER PART
ZZZZZZZ - DATA PART
TTTTTTTT - DATA PART
DDDDDD - DATA PART
BBBBBBB - DATA PART
AAAAAAA - DATA PART
//SORTOUT DD SYSOUT=*
//SYSIN DD *
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD)),
IFTHEN=(WHEN=(81,8,ZD,GT,1),OVERLAY=(81:C'2'))
SORT FIELDS=(81,1,CH,A,1,9,CH,A),EQUALS
OUTREC BUILD=(1,80)
/* |
output
Code: |
XXXXXXX - HEADER PART
AAAAAAA - DATA PART
BBBBBBB - DATA PART
DDDDDD - DATA PART
TTTTTTTT - DATA PART
ZZZZZZZ - DATA PART |
|
|
Back to top |
|
|
|