IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

summing up the fields based on colum num using sort utility


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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 Developer


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

PostPosted: Thu May 21, 2009 9:14 pm
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
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

Moderator Emeritus


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

PostPosted: Fri May 22, 2009 2:51 pm
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 Developer


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

PostPosted: Fri May 22, 2009 9:43 pm
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
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 Developer


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

PostPosted: Sat May 23, 2009 2:08 am
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:

Use [URL] BBCode for External Links
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 8
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts REASON 00D70014 in load utility DB2 6
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
Search our Forums:

Back to Top