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

Divide and edit the sum - OutRec


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
balaji81_k

Active User


Joined: 29 Jun 2005
Posts: 141

PostPosted: Thu May 02, 2019 4:21 am
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 Member


Joined: 29 Apr 2008
Posts: 939
Location: Maryland

PostPosted: Thu May 02, 2019 4:34 am
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: 141

PostPosted: Fri May 03, 2019 2:11 am
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 Member


Joined: 29 Apr 2008
Posts: 939
Location: Maryland

PostPosted: Fri May 03, 2019 6:17 pm
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

Global Moderator


Joined: 21 Sep 2010
Posts: 2576
Location: NYC,USA

PostPosted: Fri May 03, 2019 8:57 pm
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: 141

PostPosted: Tue May 07, 2019 8:25 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts ISPF Edit Macro with profile commands... TSO/ISPF 14
No new posts Need to open a DSN using REXX & e... CLIST & REXX 10
No new posts Execute Partially Edited Rexx Exec fr... CLIST & REXX 14
No new posts SEQNUM with TRA=ETOA in OUTREC SYNCSORT 5
No new posts Outrec IFTHEN builds data in wrong po... DFSORT/ICETOOL 6
Search our Forums:

Back to Top