Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

summing up the fields based on colum num using sort utility

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

Active User


Joined: 21 May 2009
Posts: 139
Location: United States

PostPosted: Thu May 21, 2009 1:21 pm    Post subject: summing up the fields based on colum num using sort utility
Reply with quote

Hi, how can I sum up a particular field occuring in every row at a specified position, say col 10-15, and then put it at the bottom of my records at a certain position.
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: Thu May 21, 2009 9:14 pm    Post subject:
Reply with quote

Please show an example of the records in your input file and what you expect for output. Give the RECFM and LRECL of the input file. Give the starting position, length and format of the relevant fields.
Back to top
View user's profile Send private message
t5590ag

Active User


Joined: 21 May 2009
Posts: 139
Location: United States

PostPosted: Fri May 22, 2009 1:29 pm    Post subject:
Reply with quote

Code:
INTJV-DOC-CURR-AMT
                    #8
                      ZD 39:13
      <---+----1---->
                   
      ***************
               375.64
               302.00
                73.64
      ***************
               174.38
               170.72
                 3.66
      ***************
               174.38
               170.72
                 3.66
      ***************


Frank, am unable to put a proper screenshot here. Not sure if this makes the format clear to you. starting pos is 39 and it occupies 13 bytes. I have FB/400 file.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri May 22, 2009 2:51 pm    Post subject:
Reply with quote

Hello,

To post data from a screen, use copy/paste and the "Code" tag. This will preserve alignment, saves counting blanks, and looks like a terminal display (your data has been coded but i didn't know what to do with the first bit).

You can then use Preview to see how your post will appear to the forum. When the post appears as you wish, Submit.
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: Fri May 22, 2009 9:43 pm    Post subject:
Reply with quote

t5590ag,

It would have helped if you'd shown the expected output as I requested.

Assuming you just want to add a trailer line containing the total, you can use a DFSORT job like this:

Code:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/400)
//SORTOUT DD DSN=...  output file (FB/400)
//SYSIN    DD    *
  OPTION COPY
  OUTFIL REMOVECC,
    TRAILER1=(39:TOT=(39,13,UFF,EDIT=(IIIIIIIIII.TT)))
/*


SORTOUT would have:

Code:

                                    ***************   
                                             375.64   
                                             302.00   
                                              73.64   
                                    ***************   
                                             174.38   
                                             170.72   
                                               3.66   
                                    ***************   
                                             174.38   
                                             170.72   
                                               3.66   
                                    ***************   
                                            1448.80   


If that's not what you want, then tell me what you do want.
Back to top
View user's profile Send private message
t5590ag

Active User


Joined: 21 May 2009
Posts: 139
Location: United States

PostPosted: Sat May 23, 2009 12:48 am    Post subject:
Reply with quote

thats great Frank. This is what I wanted. I havent tested but yes it'll work am sure. Just tell me what does this UFF and EDIT signify.
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: Sat May 23, 2009 2:08 am    Post subject:
Reply with quote

UFF is unsigned free form format. It extracts the digits from values with decimal points among other things. That EDIT pattern displays the total with leading zeros suppressed and a decimal point.

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/servers/storage/support/software/sort/mvs/srtmpub.html
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 SORT to unpack a feild shr_amar DFSORT/ICETOOL 7 Fri Jul 07, 2017 4:32 am
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am
No new posts Optimize sort inrec parse vishwakotin DFSORT/ICETOOL 6 Mon Jun 26, 2017 11:15 pm
No new posts How to Use DebugTool CodeCoverage Uti... neo4u IBM Tools 0 Thu Jun 22, 2017 6:38 pm
No new posts Search utility(3.14) using JCl and Cobol RKS3 COBOL Programming 12 Sat Jun 10, 2017 10:24 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us