Discussion:
DFOSRT and headers
Add Reply
R.S.
2017-05-19 20:53:16 UTC
Reply
Permalink
Raw Message
How to exclude header lines from being sorter/filtered?

For example, I have the following file:

FIRSTNAME LASTNAME YEAR OTHERDATA
---------- --------- ---- ---------
JOHN SMITH 1945 eeeeeeeee
JOE ZAWINUL 1932 rrrrrrrrr
GEORGE ALTMARK 1954 fffffffff



I want to sort by lastname:
FIRSTNAME LASTNAME YEAR OTHERDATA
---------- --------- ---- ---------
GEORGE ALTMARK 1954 fffffffff
JOHN SMITH 1945 eeeeeeeee
JOE ZAWINUL 1932 rrrrrrrrr



Actually I see the solution: copy header to temp file (STOPAFT=2) and merget it with sortout, but I believe there is simpler way to do that.



Regards
--
Radoslaw Skorupka
Lodz, Poland

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to ***@listserv.ua.edu with the message: INFO IBM-MAIN
Sri h Kolusu
2017-05-19 21:11:33 UTC
Reply
Permalink
Raw Message
Radoslaw,

You can use the DATASORT operator to just sort the data and ignore the
headers/trailers. Here is a sample JCL. I assumed that the lastname starts
at position 15 for a length of 13.

//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD *
FIRSTNAME LASTNAME YEAR OTHERDATA
---------- --------- ---- ---------
JOHN SMITH 1945 EEEEEEEEE
JOE ZAWINUL 1932 RRRRRRRRR
GEORGE ALTMARK 1954 FFFFFFFFF
//OUT DD SYSOUT=*
//TOOLIN DD *
DATASORT FROM(IN) TO(OUT) HEADER(2) USING(CTL1)
//CTL1CNTL DD *
SORT FIELDS=(15,13,CH,A)
//*

Further if you have any questions please let me know

Thanks,
Kolusu
DFSORT Development
IBM Corporation
Date: 05/19/2017 01:54 PM
Subject: DFOSRT and headers
How to exclude header lines from being sorter/filtered?
FIRSTNAME LASTNAME YEAR OTHERDATA
---------- --------- ---- ---------
JOHN SMITH 1945 eeeeeeeee
JOE ZAWINUL 1932 rrrrrrrrr
GEORGE ALTMARK 1954 fffffffff
FIRSTNAME LASTNAME YEAR OTHERDATA
---------- --------- ---- ---------
GEORGE ALTMARK 1954 fffffffff
JOHN SMITH 1945 eeeeeeeee
JOE ZAWINUL 1932 rrrrrrrrr
Actually I see the solution: copy header to temp file (STOPAFT=2)
and merget it with sortout, but I believe there is simpler way to do
that.
Regards
--
Radoslaw Skorupka
Lodz, Poland
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to ***@listserv.ua.edu with the message: INFO IBM-MAIN
Loading...