View previous topic :: View next topic
|
Author |
Message |
johndee
New User
Joined: 06 Dec 2006 Posts: 1 Location: Trivandrum
|
|
|
|
Hi,
We are trying to calculate the record count.
The current situation is that we are generating the trailer in the sort control card and it is apended to the file at the bottom, but the trailer TOT parameter will have the count upto the previous record read only i.e the trailer record is not added to the count.
We need to include this trailer record also in the total count..can we have it done in the same control card .
Currently we have coded the control card as:
Code: |
SORT FIELDS=(44,20,CH,A)
SUM FIELDS=NONE
INREC FIELDS=(1,500,C'1')
OUTFIL REMOVECC,
TRAILER1=(1:C'TRLHSA',7:TOT=(501,1,ZD,EDIT=(TTTTTTTTT)),
16:C'065',19:482X)
|
But now we need to include the trailer record as well , how can we do that in the same control card.
Thanks,
Johndee. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
You don't need to use TOT to total up 1's to get the count. DFSORT has a COUNT parameter for that. And you can even use COUNT+1 to get the count of the data records + 1 for the trailer record. You can do it like this:
Code: |
INREC FIELDS=(1,500) <---- if needed
SORT FIELDS=(44,20,CH,A)
SUM FIELDS=NONE
OUTFIL REMOVECC,
TRAILER1=(1:C'TRLHSA',7:COUNT+1=(EDIT=(TTTTTTTTT)),
16:C'065',19:482X)
|
|
|
Back to top |
|
|
diwansk
New User
Joined: 01 May 2005 Posts: 4 Location: Bangalore
|
|
|
|
I have one more query on this. Can the record count be a variable field. In the example given above, the count will be written to a field of length 7 so if the rec count is 1600 it will come as 0001600. I dont leading zeros, is it possible using Sort ? |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
You can display blanks instead of leading zeros by using:
COUNT+1=(EDIT=(IIIIIIIIT)
Note that the count will still be 7 characters but it will not have the leading zeros.
If you're asking if you can change the length of the count based on omitting leading zeros (e.g. a length of 4 for 1600 and a length of 7 for 1234567), there are no built-in functions for that. |
|
Back to top |
|
|
|