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
 
Divide and edit the sum - OutRec

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

Active User


Joined: 29 Jun 2005
Posts: 137

PostPosted: Thu May 02, 2019 4:21 am    Post subject: Divide and edit the sum - OutRec
Reply with quote

Hi Team,

I have a input file which has LRECL=80, RECFM = FB .Out of 80 bytes it has only 35 bytes of data . I need to sort and get sum by date field and amount field which occupies at 10th position and 21st position. Amount is of packed decimal which occupies 10 bytes of length.

I am not getting the expected edited format .

Code:


SORT FIELDS=(10,10,CH,A)
INREC OVERLAY =(40:21,10,PD,TO=ZD,LENGTH=15)
SUM FIELDS=(40,15,ZD)

OUTREC BUILD=(01:01,10,X,12:40,15,ZD,DIV,+1000,EDIT=(I,III,III,IIT),                         
                         80:X)



SORT OUTPUT:-
Code:


01/19/2019  299,543,908
02/20/2018    77,025,384






Expected output:-

Code:


01/19/2019  2,995,439
02/20/2018  770,253



When i change the edit format to

Code:


EDIT=(I,III,IIT)



I am missing the first byte . Please advise what edit should i use to achieve the expected format .

Thanks
Back to top
View user's profile Send private message

sergeyken

Active User


Joined: 29 Apr 2008
Posts: 471
Location: Maryland

PostPosted: Thu May 02, 2019 4:34 am    Post subject:
Reply with quote

Add temporary output of all intermediate results to find out where exactly it goes wrong?

This is the standard way for debugging any code, in any language, and under any circumstances.
Do not try guessing, or asking others to guess for you.
Back to top
View user's profile Send private message
balaji81_k

Active User


Joined: 29 Jun 2005
Posts: 137

PostPosted: Fri May 03, 2019 2:11 am    Post subject:
Reply with quote

Hi Sergeyken,
I am sorry. I almost done in editing the sum value to my expectation but still i am working on get rid of the values after decimal which i don't need .

Code:


SORT FIELDS=(10,10,CH,A)
INREC OVERLAY =(40:21,10,PD,TO=ZD,LENGTH=15)
SUM FIELDS=(40,15,ZD)

OUTREC BUILD=(01:01,10,X,12:40,15,ZD,DIV,+1000,
                        EDIT=(SII,III,III,III,III,III,III,III,III,IIT.TT),SIGNS=(,-),                         
                         80:X)



Thanks
Back to top
View user's profile Send private message
sergeyken

Active User


Joined: 29 Apr 2008
Posts: 471
Location: Maryland

PostPosted: Fri May 03, 2019 6:17 pm    Post subject:
Reply with quote

balaji81_k wrote:
Hi Sergeyken,
I am sorry. I almost done in editing the sum value to my expectation but still i am working on get rid of the values after decimal which i don't need .

Code:


SORT FIELDS=(10,10,CH,A)
INREC OVERLAY =(40:21,10,PD,TO=ZD,LENGTH=15)
SUM FIELDS=(40,15,ZD)

OUTREC BUILD=(01:01,10,X,12:40,15,ZD,DIV,+1000,
                        EDIT=(SII,III,III,III,III,III,III,III,III,IIT.TT),SIGNS=(,-),                         
                         80:X)



Thanks

You've ignored the suggestion to trace intermediate results....

For ZD format, you can use only the first positions from the result of DIV, and ignore the rest of it.
For instance, use another BUILD=(...truncated field(s) …) in OUTFIL.
Other ways are also possible.
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 2174
Location: NY,USA

PostPosted: Fri May 03, 2019 8:57 pm    Post subject:
Reply with quote

Editing numeric fields
Also, sometimes, you need to twist little bit and adjust the EDIT to get your results right, like this.
Back to top
View user's profile Send private message
balaji81_k

Active User


Joined: 29 Jun 2005
Posts: 137

PostPosted: Tue May 07, 2019 8:25 pm    Post subject:
Reply with quote

Thank Rohit for the samples.
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 How to write 0 using outrec sprikitik SYNCSORT 3 Thu Oct 18, 2018 2:55 pm
No new posts ISPF 3.4 edit of a ps file, disp use... Carrie Da Silva TSO/ISPF 3 Fri Sep 21, 2018 3:01 am
No new posts OUTREC w. several IFTHEN variants Auryn DFSORT/ICETOOL 2 Thu Jul 19, 2018 8:11 pm
No new posts Run time proc edit Niki JCL & VSAM 7 Fri Jun 08, 2018 5:42 pm
No new posts LE Modules in Link Edit John Poulakos COBOL Programming 1 Sat Apr 28, 2018 12:14 am

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