View previous topic :: View next topic
|
Author |
Message |
t5590ag
Active User
Joined: 21 May 2009 Posts: 139 Location: United States
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
t5590ag
Active User
Joined: 21 May 2009 Posts: 139 Location: United States
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
t5590ag
Active User
Joined: 21 May 2009 Posts: 139 Location: United States
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
|