Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum 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: 141

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 Member


Joined: 29 Apr 2008
Posts: 810
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: 141

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 Member


Joined: 29 Apr 2008
Posts: 810
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: 2443
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: 141

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 ISPF Edit Macro with profile commands... Lynne Schuler TSO/ISPF 14 Thu Jun 18, 2020 7:25 pm
No new posts Need to open a DSN using REXX & e... Y Marwaha CLIST & REXX 10 Fri Jun 05, 2020 7:30 pm
No new posts Execute Partially Edited Rexx Exec fr... AllenSieracki CLIST & REXX 14 Tue Jun 02, 2020 7:56 pm
No new posts SEQNUM with TRA=ETOA in OUTREC juares castro SYNCSORT 5 Sat May 30, 2020 5:40 am
No new posts Outrec IFTHEN builds data in wrong po... saikarthik94 DFSORT/ICETOOL 6 Sun Mar 01, 2020 2:14 pm

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