Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
summation of binary field in dfsort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
madishpa

New User


Joined: 18 May 2007
Posts: 27
Location: Hyderabad

PostPosted: Sun Jan 29, 2012 9:58 am    Post subject: summation of binary field in dfsort
Reply with quote

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
View user's profile Send private message

madishpa

New User


Joined: 18 May 2007
Posts: 27
Location: Hyderabad

PostPosted: Sun Jan 29, 2012 10:18 am    Post subject: Reply to: summation of binary field in dfsort
Reply with quote

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
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7314

PostPosted: Sun Jan 29, 2012 3:30 pm    Post subject: Reply to: summation of binary field in dfsort
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Tue Jan 31, 2012 12:50 am    Post subject:
Reply with quote

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:

http://www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000080
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Compare VSAM files using DFSORT pshongal DFSORT/ICETOOL 5 Thu Nov 23, 2017 10:24 am
No new posts Compare and COPY using DFSORT pshongal DFSORT/ICETOOL 3 Fri Nov 17, 2017 9:49 am
No new posts Split files upto certain limit based ... bubbu75 DFSORT/ICETOOL 5 Tue Nov 14, 2017 11:11 pm
This topic is locked: you cannot edit posts or make replies. Incrementing current time field by 30... arunsoods DFSORT/ICETOOL 11 Thu Oct 26, 2017 3:22 pm
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us