|
View previous topic :: View next topic
|
| Author |
Message |
madishpa
New User
Joined: 18 May 2007 Posts: 28 Location: Hyderabad
|
|
|
|
Input file : 10 bytes in length and record format is FB
first field in input file : binary field of 2 bytes in length
second field : character data of 8 bytes in length
first field (binary field in 2 bytes) contains positive and negative values
I need grand total of value present in first field.
Output file should contain only grand total (total value wil not exceed 2 bytes).
Please provide me dfsort job to sum the binary value present in 2 bytes
Thanks
Madishpa |
|
| Back to top |
|
 |
madishpa
New User
Joined: 18 May 2007 Posts: 28 Location: Hyderabad
|
|
|
|
adding additional information to above query
values in the inut files are:
10
-1
-2
above values in the file are in binary format (first 2 bytes)
resultant value in output file:
7
output file should contain only resultant value, it would be good to have data in output file in readable format
Thanks
Madishpa |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
madishpa,
You could try something like the following. The first step I did to generate the test data. The second I based on something "stolen" from one of Frank's solutions in the beginner's forum a couple of days ago.
This can get you started. Expect a better solution later from San Jose.
I've included both positive and negative signs (and tested their production). I've not bothered chopping the leading zeros, because I suspect there is no need, and it gives you something to do if you are keen and feel it necessary.
| Code: |
//TSTDATA EXEC PGM=SORT
//SYSIN DD *
OPTION COPY
OUTFIL BUILD=(-1,TO=FI,LENGTH=2,3,8,/,
-2,TO=FI,LENGTH=2,3,8,/,
+10,TO=FI,LENGTH=2,3,8)
//SYSOUT DD SYSOUT=*
//SORTOUT DD DSN=&&TMP,SPACE=(TRK,1),UNIT=SYSDA,DISP=(,PASS)
//SORTIN DD *
**********************
//SUMSBIN EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=&&TMP,DISP=(OLD,PASS)
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
OUTFIL REMOVECC,NODETAIL,
TRAILER1=(TOT=(1,2,FI,EDIT=(STTTT),SIGNS=(+,-)))
|
|
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
| Quote: |
| Expect a better solution later from San Jose. |
madishpa,
If all you want is a grand total of all the FI values, then Bill's TRAILER1 solution should do it. If you want something else, you need to explain more clearly what you want.
If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:
www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000080 |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|