Sumup of the fields in sort
Moderators: Frank Yaeger, Moderator Group
Sumup of the fields in sort
hi,
please let me know...
in sort sumup will the truncatation will happen???
i have input file which contains 10 fields with 10 records.
i want the the output file with summed up the five amount fileds and control on five fields. when ever any change in the first five fields i wnat the sum for alll the similar records.
when it is summing up is there any truncation will happen in the oputput file or not.
bye,
Cruise.
please let me know...
in sort sumup will the truncatation will happen???
i have input file which contains 10 fields with 10 records.
i want the the output file with summed up the five amount fileds and control on five fields. when ever any change in the first five fields i wnat the sum for alll the similar records.
when it is summing up is there any truncation will happen in the oputput file or not.
bye,
Cruise.
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
Let me explain by example. When you use DFSORT statements like this:
for input records like this:
the first two records will be summed, but since the third record would cause the sum to overflow (that is, be greater than the 5 digits allowed for it), you will get an overflow message and the third record will be kept as is. So your output will be:
You can use OVFLO=RC0, OVFLO=RC4 or OVFLO=RC16 to control what happens when you get an overflow. Overflow does not cause the values to be truncated, but it does cause values not to be summed.
You can avoid an overflow by using INREC to add zeros in front of the field to increase it's length.
If that doesn't answer your question, then please provide more details about what you want to know, preferably with examples.
Code: Select all
SORT FIELDS=(6,3,CH,A)
SUM FIELDS=(1,5,ZD)
Code: Select all
12345AAA
35218AAA
71234AAA
Code: Select all
4756CAAA
71234AAA
You can avoid an overflow by using INREC to add zeros in front of the field to increase it's length.
If that doesn't answer your question, then please provide more details about what you want to know, preferably with examples.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Sumup of the fields in sort
Hi Frank,
Thanks for the reply.
i have one more doubt.
let me explain my problem with example.
i have input file with
SSN X(9)
AMOUNT S9(9) COMP-3
i want output file with sumup of the amount for the same SSN. and i want the all the records sum in one file.
so please tell me how to give the sort card
INREC = ????
SORT FIELDS = (1,9,CH,A)
SUM FIELDS=(10,5,PD)
regards,
Cruise
Thanks for the reply.
i have one more doubt.
let me explain my problem with example.
i have input file with
SSN X(9)
AMOUNT S9(9) COMP-3
i want output file with sumup of the amount for the same SSN. and i want the all the records sum in one file.
so please tell me how to give the sort card
INREC = ????
SORT FIELDS = (1,9,CH,A)
SUM FIELDS=(10,5,PD)
regards,
Cruise
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
Those are the correct control statements if your sum won't exceed 9 digits. If you're worried about your sum exceeding 9 digits, you can use these controls statements to add 2 extra digits of zeros at the start of the sum field to extend it from 5 bytes (max of 9 digits) to 6 bytes (max of 11 digits):
If you need even more digits, extend the PD values with more X'00' bytes in front.
Code: Select all
INREC FIELDS=(1,9,10:X'00',11:10,5)
SORT FIELDS=(1,9,CH,A)
SUM FIELDS=(10,6,PD)
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
Glad I could help.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
FREE TUTORIALS
Tutorials
Free tutorials from mainframegurukul
- JCL Tutorial
Covers all important JCL concepts. - Cobol Tutorial
This tutorials covers all Cobol Topics from STRING to COMP-3. - DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. - SORT Tutorial
This Tutorial covers all important aspects of DFSORT with examples - CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions
- Cobol Interview Questions
50+ Interview Questions - JCL Interview Questions
50+ Interview Questions - DB2 Interview Questions
100+ Interview Questions - CICS Interview Questions
70+ Interview Questions - VSAM Interview Questions
27 Interview Questions
Other References
Mainframe Tools and others
- XPEDITER Reference
Explains how we can debug a program - FILEAID Reference
Explains how to browse , edit and delete datasets - Change Man Reference
Quick Start tutorial on Changeman - Abend Reference
Important Abend codes explained - FaceBook Page
MainframeGurukul FaceBook Page - LinkedIn Page
MainframeGurkul Linkedin Page