John McKown wrote on 04/15/2009 10:19:33 AM: > I want to do something kind of weird and I'm wondering if DFSORT can do it > for me. I have a file where each record has three fields. Field 1 is the > z/OS SYSID. Field 2 is a TOD value. Field 3 is a number. The SYSID field can > only contain one of two values (C'DEV1' or C'LIH1'). I want my output file > to have 5 fields. Field 1 will be the TOD field, converted to a printable > date (DC1) and time (TC1). Field 2 is C'LIH1'. Field 3 is the value of the > "number" for the TOD for C'LIH1'. Field 4 is C'DEV1'. Field 5 is the value > of the "number" for the TOD for C'DEV1'. Field 6 is the sum of output fields > 3 and 5. Would the DFSORT control card below do what I want? > > * FIELD 1 IS 1,4,CH (SYSID) > * FIELD 2 IS 5,8,BI (TOD) > * FIELD 3 IS 13,5,ZD (NUMBER) > SORT FIELDS=(1,11,CH,A) SORT ON DATE+HOUR > INREC IFTHEN=(WHEN=(1,4,CH,EQ,C'LIH1'), > BUILD=(5,8,DC1,C' ',5,8,TC1,C'|', > C'LIH1|',13,5, > C'|DEV1|',C'00000|00000')), > IFTHEN=(WHEN=(1,4,CH,EQ,C'DEV1'), > BUILD=(5,8,DC,C' ',5,8,TC1,C'|', > C'LIH1|',C'00000', > C'|DEV1|',13,5,C'|00000')) > SUM FIELDS=(22,5,ZD,33,5,ZD) > OUTREC OVERLAY=(39:22,5,ZD,ADD,33,5,ZD) > > Please excuse any column errors. I'm more interested in whether the concept > of doing a SUM on two fields and then summing those two fields to overlay an > output field is valid.
Yes, that concept is valid. I changed your 5,8,DC in the second IFTHEN clause to 5,8,DC1 and ran a test and it worked. You could also eliminate the OUTREC statement by doing it with these DFSORT control statements (you don't need ZDPRINT if it's your default): INREC IFTHEN=(WHEN=(1,4,CH,EQ,C'LIH1'), BUILD=(5,8,DC1,C' ',5,8,TC1,C'|', C'LIH1|',13,5, C'|DEV1|',C'00000|',13,5)), IFTHEN=(WHEN=(1,4,CH,EQ,C'DEV1'), BUILD=(5,8,DC1,C' ',5,8,TC1,C'|', C'LIH1|',C'00000', C'|DEV1|',13,5,C'|',13,5)) SORT FIELDS=(1,11,CH,A) SORT ON DATE+HOUR OPTION ZDPRINT SUM FIELDS=(22,5,ZD,33,5,ZD,39,5,ZD) Frank Yaeger - DFSORT Development Team (IBM) - yae...@us.ibm.com Specialties: FINDREP, WHEN=GROUP, DATASORT, ICETOOL, Symbols, Migration => DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort/ ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO Search the archives at http://bama.ua.edu/archives/ibm-main.html