|
View previous topic :: View next topic
|
| Author |
Message |
Shriram Jogdand
New User

Joined: 14 Oct 2008 Posts: 65 Location: Pune
|
|
|
|
Hi,
I searched the mainframe forum but was not able to locate post which have both TRAILER3 and COUNT
My requirement is as follows.
There is one control card that is running in production
SORT FIELDS=(3,2,CH,A,101,6,CH,A)
OUTFIL FILES=1,NODETAIL,
INCLUDE=(1,2,ZD,EQ,00,OR,107,1,CH,EQ,C'C'),
SECTIONS=(101,6,TRAILER3=(101,6,COUNT)),REMOVECC
This card is doing summation of the records depending on the field (whcih is starting at 101 and having length 6 byte). If more than one record will have same value then there will be summation which is coming in the o/p file as 6 bytes.
The problem is that, if sum of such records is more than 6 byte then it is getting truncated. Can we increase the length here in sort card so that sum should not truncate? |
|
| Back to top |
|
 |
Anuj Dhawan
Superior Member

Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
Your explantion is fishy, however, what you've asked for, to do that, you can use edit-mask:
| Code: |
| SECTIONS=(101,6,TRAILER3=(101,6,COUNT=(M11,LENGTH=n))),REMOVECC |
replace "n" with desired number. |
|
| Back to top |
|
 |
Anuj Dhawan
Superior Member

Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
Frank,
| Quote: |
| The problem is that, if sum of such records is more than 6 byte then it is getting truncated. |
Is not COUNT a number which will be a right-justified 8-digit field with leading zeros suppressed? |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
| Code: |
SECTIONS=(101,6,TRAILER3=(101,6,COUNT)),REMOVECC
|
| Quote: |
| This card is doing summation of the records depending on the field (whcih is starting at 101 and having length 6 byte). If more than one record will have same value then there will be summation which is coming in the o/p file as 6 bytes. |
No, that's NOT what this card is doing. What it's actually doing is creating a section trailer with positions 101-106 from the last record in the section followed by the COUNT of records in the section. If you want to sum the field at 101-106, you would use something like this:
| Code: |
SORT FIELDS=(3,2,CH,A,101,6,CH,A)
OUTFIL FILES=1,NODETAIL,REMOVECC,
INCLUDE=(1,2,ZD,EQ,00,OR,107,1,CH,EQ,C'C'),
SECTIONS=(101,6,TRAILER3=(TOT=(101,6,ZD,M10,LENGTH=10)))
|
|
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
| Quote: |
| Is not COUNT a number which will be a right-justified 8-digit field with leading zeros suppressed? |
Yes, that's what COUNT does. The OP is NOT doing what he thinks he is. See my previous post for details. |
|
| Back to top |
|
 |
Anuj Dhawan
Superior Member

Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
| Thank you, Frank. |
|
| Back to top |
|
 |
Shriram Jogdand
New User

Joined: 14 Oct 2008 Posts: 65 Location: Pune
|
|
|
|
Hi,
Before changes, my o/p file was coming something like this
Name11 Total01
--------- ------------
ABCDEF 10203040
LMNOPQ 30504070
i.e Name11 as of 6 bytes and count(i.e total01) as of 8 bytes. I ran the job with the above suggested solution. The length of Total01 is increased but not displaying Name11 in o/p file. I want both the fields in o/p file with increased length of Total01 to 9 bytes instead of 8 bytes. |
|
| Back to top |
|
 |
Shriram Jogdand
New User

Joined: 14 Oct 2008 Posts: 65 Location: Pune
|
|
|
|
I got the solution.
The code should be changed as below
SECTIONS=(101,6,TRAILER3=(101,6,COUNT=(M10,LENGTH=9)))
Thanks for the suggestions. |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
You really should try harder to get your terminology right.
You apparently want a count of the number of records with each key. That is NOT the same as saying you are "doing summation of the records depending on the field (whcih is starting at 101 and having length 6 byte)". The latter would imply using TOTAL, not COUNT.
In the future, please try harder to explain clearly what you want to do and include an example of input and expected output. That will save everyone (including you) time. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|