I am using ICETOOL utility in my sort jcl. I have 3 input files having numeric data of 12 bytes from 43rd position. The control card looks like this:
//CTL1CNTL DD *
SORT FIELDS=(1,5,CH,A)
OPTION ZDPRINT
SUM FIELDS=(43,12,ZD)
OMIT COND=(1,5,CH,EQ,C'MODEL')
/*
//TOOLIN DD *
DATASORT FROM(IN) TO(OUT) HEADER USING(CTL1)
/*
It processes all records and includes the HEADER record in the output file. But in my output file , I am having leading zeroes in the numeric section after summation . The output record looks like this:
02354,AAAAAAAAAAAAAAAA ,07/21/2009,Y ,000000050672
My requirement specifies no leading zeroes in the output file:
02354,AAAAAAAAAAAAAAAA ,07/21/2009,Y , 50672
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
soumya swain,
Welcome to the forums.
Can you post a sample input record and the input as well as expected output file attributes. Also since you posted in JCL forum, I assume your sort product is Syncsort and not DFSORT.
Quote:
It processes all records and includes the HEADER record in the output file
Do you want to omit the header record? If yes, a simple SORT would do and I do not think there's a need for DATASORT here.
My sample input record looks like this:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
02978,APPLETREE ,02/12/2009,N , 117759
The OUTPUT after summation looks like this (3 similar fields are added):
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
02978,APPLETREE ,02/12/2009,N ,000000353277
The expected OUTPUT is :
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
02978,APPLETREE ,02/12/2009,N , 353277
And I used DATASORT since I wanted to omit the HEADER from processing i.e during the summation . But I also want the HEADER it in my output.
If HEADER is not omitted during processing it sums up the characters of the 'SCORE COUNTS' field :
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
I agree Craq, I wrote three paragraphs earlier for this topic, then thought I'd better ditch them, as I'm forever telling people to go and get the oddly-produced files from an external system in the correct format.
The only reason I could think of immediately is that if someone wanted to take this and directly put it out as a report/screen without doing any "editing" of the fields. That got me worried about it being "bounced back", so there we go.
Other than for straight display purposes, the field is the same with/without leading zeros.
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
soumya swain,
Your sort card indicates that you're summing a ZD field of length-12 at pos-43. But the sample data does not seem to be of a valid ZD field with length=12.
Here's a Syncsort job which I think does what you're trying to do.
(The below job assumes an input of FB/LRECL=80 and the numeric field at 32, length=6.)
I wasnt familiar with SQZ , so couldnt use it properly. But I tried running the sample sort card provided by you. Thats precisely what I needed for my output.
Thanks a lot .
Craq and Bill : Thanks!!! . Actually the output i need is in the form of a report thats nee to be printed. Thats why leading zeroes are to be excluded.
I am extremely happy (especially since this is my first post).