Joined: 03 Feb 2007 Posts: 175 Location: PUNE(INDIA)
Hi Frank,
It's great ! Thats so simple to do with SELECT !
But here are my 2 questions.
1) Whats the use of sequence number in CTL1 ? Is it because CTL1 cannot be left blank ?
2) I ran your job and saw intermediate results in T1. Its seq is changed. I guess that's why you are again sorting it. But what if user wants to retain original sequence from input file and just remove unwanted records ?
But you wanted the records in their original order with the 77777 records before the 66666 record. So I had to add the sequence numbers for the original order of the records, do the SELECT which sorts by the ON field, and then do the extra sort on the sequence numbers to get the records back in their original order.
SELECT FROM(IN) TO(T1) ON(1,5,CH) LOWER(3) USING(CTL1)
ICE606I 0 DFSORT CALL 0001 FOR SORT FROM IN TO T1 USING CTL1CNTL COMPLETED
ICE628I 0 RECORD COUNT: 000000000000006
ICE638I 0 NUMBER OF RECORDS RESULTING FROM CRITERIA: 000000000000003
ICE602I 0 OPERATION RETURN CODE: 00
SORT FROM(T1) TO(OUT) USING(CTL2)
ICE606I 0 DFSORT CALL 0002 FOR SORT FROM T1 TO OUT USING CTL2CNTL COMPLETED
ICE602I 0 OPERATION RETURN CODE: 00
ICE200I 0 IDENTIFIER FROM CALLING PROGRAM IS 0001
ICE143I 0 BLOCKSET SORT TECHNIQUE SELECTED
ICE250I 0 VISIT www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES AND MORE
ICE000I 0 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R5 - 13:15 ON WED JAN 16, 2008 -
0 INREC OVERLAY=(81:SEQNUM,8,ZD)
ICE146I 0 END OF STATEMENTS FROM CTL1CNTL - PARAMETER LIST STATEMENTS FOLLOW
DEBUG NOABEND,ESTAE
OPTION MSGDDN=DFSMSG,LIST,MSGPRT=ALL,RESINV=0,SORTDD=CTL1,SORTIN=IN,SOR*
TOUT=T1,DYNALLOC,SZERO,EQUALS,NOVLSHRT,LOCALE=NONE,NOCHE*
CK
SORT FIELDS=(1,5,CH,A)
MODS E35=(ICE35DU,12288)
ICE201I 0 RECORD TYPE IS F - DATA STARTS IN POSITION 1
ICE751I 0 C5-K05352 C6-Q95214 C7-K90000 C8-K05352 E9-K06751 C9-BASE E5-K10929 E6-K90000 E7-K11698
...
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Ok, I see the difference. I'm running with the latest DFSORT PTF which supports INREC with SELECT. You don't have that PTF, so INREC with SELECT is not giving you the correct results. You need z/OS V1R5 PTF UK90007. That PTF has been available since April, 2006. Ask your System Programmer to install it (it's free).
In the meantime, you can use an extra pass to avoid using INREC with SELECT as follow: