Posted: Mon Dec 08, 2003 10:57 am Post subject: Formatting of Trailer1 in sort/icetool
Hi,I am facing problems trying to format the Trailer1 fields.
The control card
SORT FIELDS=(some criteria)
INCLUDE=( some conditions),
TRAILER1=(<part1>,<part2>,<part3>,COUNT,<part4>)
The requirement that I have is
<part1> = This need to be a 16 byte field, should contain the "High-value"
<part2> = 6 byte field, simple constant X(6), For eg. "ENDREC"
<part3> = 3 byte numeric field, but again a constant 9(3), For eg "008"
COUNT = This is the count function of the sort, but I need it to be in S9(09) COMP-3 format. I do not know what is the default format of the COUNT function.
<part5> = FILLER of 10 bytes
It would be great if anyone can help me with this.
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Mon Dec 08, 2003 11:57 am Post subject:
For information on how DFSORT formats relate to COBOL formats, see the "What are the equivalent DFSORT formats for various COBOL data types?" Ask Professor Sort item at:
<part1> - what do you mean by "High-value"? Do you mean a constant like X'FF.FFF' or C'9...9' or something else?
<part2> - just use C'ENDREC'
<part3> - what is the position, length and format of this numeric field? Do you want to convert it to a value like '008' or is it already a value like '008'?
COUNT - with DFSORT, you can format the COUNT to various printable formats in TRAILER1 but you can't directly convert it to PD format in TRAILER1. You could use TRAILER1 to get the COUNT as a ZD value using COUNT=(M11,LENGTH=9) and then use another COPY step to convert the COUNT to PD using p,9,ZD,TO=PD,LENGTH=5.
<part5> - if you want 10 bytes of blanks as the FILLER,you can use 10X. If you want something else as the FILLER, what do you want?
I can show you how to do what you want with DFSORT, but I need the answers to the questions above. Also, what is the RECFM and LRECL of the input data set? _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Last edited by Frank Yaeger on Fri Aug 25, 2006 6:31 pm; edited 2 times in total
Hi Frank,
<Part 1>: I need High-values as decribed by Cobol "High-values", in the first 16 bytes. I tried giving X'FFFFFFFFFFFFFFFF' earlier but it showing me some syntax errors. I think I am not giving it properly.
<Part 2> this follows Part 1 immediately
<Part 3> is 3 byte numeric field imediately after the above 2 fields. i.e 20-22 bytes.
<COUNT> Will I need another pass on my data to just reformat the COUNT field to comp-3 format ?
<Part 4> I just want the 10X filler.
It would be great if you could let me know. Thanks for such prompt response
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Mon Dec 08, 2003 1:57 pm Post subject:
Well, you didn't really answer all of my questions, but I'll guess at what you need. I'm assuming that your input file has RECFM=FB and LRECL=80. I'm also assuming that you want your output data set to be FB, not FBA, without carriage control characters. Here's a DFSORT/ICETOOL job that will do what I think you want:
Code:
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=.. input file
//RCDS DD DISP=MOD,DSN=... output file - MOD
//TRLR DD DSN=&&T1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//TOOLIN DD *
* Sort records to MOD output file (RCDS) and get ZD COUNT.
SORT FROM(IN) USING(CTL1)
* Set up TRAILER with constants and PD COUNT and
* MOD to end of output file (RCDS).
COPY FROM(TRLR) TO(RCDS) USING(CTL2)
//CTL1CNTL DD *
INCLUDE COND=(condition)
SORT FIELDS=(fields)
OUTFIL FNAMES=RCDS
OUTFIL FNAMES=TRLR,NODETAIL,REMOVECC,
TRAILER1=(COUNT=(M11,LENGTH=9))
/*
//CTL2CNTL DD *
OUTREC FIELDS=(16X'FF',C'ENDREC',C'008',
1,9,ZD,TO=PD,LENGTH=5,10X)
/*
_________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Last edited by Frank Yaeger on Mon Dec 08, 2003 7:28 pm; edited 1 time in total
Hi Frank,
Yes, the file is FB type and u can assume 80 byte length. I want to format the TRAILER1 itself (Not the OUTREC) so that I get the High-values i.e 'FF' in the first 16 bytes. Is this possible. Currently when I give
TRAILER1=(16X'FF',C'ENDFIL',C'008',COUNT,10X)
it gives me the syntax error
<<TRAILER1=16X'FF',C'ENDFIL',C'008',COUNT,10X)
$
ICE007A 6 SYNTAX ERROR
>>
Frank, Also I want to avoid an extra pass over the data to format the count. If that cannot be achived in the single pass, I am comfortable in retaining the Count in ZD format, but in 9 bytes. But I have to get the High-Values in the first 16 bytes.
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Mon Dec 08, 2003 4:55 pm Post subject:
da one,
TRAILER1 does not support nX'hh', so you can't use TRAILER1 for 16X'FF'.
I assumed that you wanted to write the data records and a trailer record. Is that correct, or do you just want to write the trailer record (no data records)? Assuming you do want the data records:
Please try the job I gave you. It will give you what you want. It does two passes over the records, but the second pass is only for 1 record, so it's so close to a single pass that it doesn't matter.
To explain further:
In the first pass, I copy all of the records and create a "count" record with the ZD COUNT. In the second pass, I only read that one "count" record and reformat it to one "trailer" record in the form you want, which I MOD on to the data records.
So in the first pass, I'm reading n records and writing n+1 records. In the second pass, I'm reading 1 record and writing 1 record. Thus, in total, the job reads n+1 records and writes n+2 records. Using TRAILER1 (if you could), you would read n records and write n+1 records. The difference in the number of records read and written is insignificant. _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Mon Dec 08, 2003 6:08 pm Post subject:
Kolusu,
I don't understand what you're doing here. As I said, 16X'FF' is invalid in TRAILER1. You seem to be using 81,16 to try to get 16X'FF', but 81-96 doesn't contain 16X'FF'. I don't see any way to put 16X'FF' in 81-96 so TRAILER1 will pick it up and then remove it from 81-96 in ONE pass. What did you have in mind? You might want to try it to see if it works or not.
You also have C, '008' which is invalid syntax. It should be C'008'. _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Mon Dec 08, 2003 7:26 pm Post subject:
Kolusu,
Oh, I see. This works because TRAILER1 picks up the 16X'FF' from 81-96 of the last INREC RECORD before the OUTREC parameter removes 81-96. Good exploitation of a subtle point.
BTW, you don't need the 80:X in TRAILER1 - the length of TRAILER1 will be set from the OUTREC parameter.
Of course, this doesn't produce the PD count field, but then I guess that was optional. _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Thu Dec 23, 2004 1:09 pm Post subject:
With z/OS DFSORT V1R5 PTF UQ95214 or DFSORT R14 PTF UQ95213 (Dec, 2004), you can now use nX'hh' and stats=(to) in the TRAILERx parameter, so this can be done more easily and efficiently in one pass like this:
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Tue Aug 02, 2005 9:18 pm Post subject:
You didn't show the error message, but I'm guessing from the * under the = that it's a WER message which means you're using Syncsort, not DFSORT. DFSORT supports COUNT=(edit). The error message with the * under the = is telling you that Syncsort does NOT support it. Note that DFSORT also supports COUNT=(to), e.g. COUNT=(TO=ZD,LENGTH=5). _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Wed Aug 03, 2005 6:55 am Post subject:
Shivraj,
As frank mentioned older version of syncsort does not support the formatting of the count field. However the new syncsort z/os 1.2 version supports the formatting. Here is an alternative way of getting the desired results.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum