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
 
Need to get the SUM of two fields using SUM FIELDS only

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

New User


Joined: 31 Aug 2016
Posts: 65
Location: India

PostPosted: Tue Jun 18, 2019 1:27 pm    Post subject: Need to get the SUM of two fields using SUM FIELDS only
Reply with quote

Hello Everyone,

I am trying to calculate the SUM of two fields from the Input file using the SUM FIELDS option of DFSORT. The reason i am looking for SUM FIELDS option only is because part of my application was transferred to Linux and i will run this sort card on Linux and there no other option works except SUM FIELDS.

The sum of first field is working fine but i am getting the issue while summing the second field which is having the decimal value with sign. Below is the file layout :

Code:

----+----1----+----2----+----3----+----4---
********************************* Top of Da
001,"ALAOO","ACTUALS",119986,-0000000167.59
001,"ALAOO","ACTUALS",119986,-0000000186.04
001,"ALAOO","ACTUALS",119986,-0000001380.46
001,"ALAOO","ACTUALS",119986,-0000003265.91
001,"ALAOO","ACTUALS",119986, 0000000009.07
001,"ALAOO","ACTUALS",119986, 0000000023.56
001,"ALAOO","ACTUALS",119986, 0000000047.12
001,"ALAOO","ACTUALS",119986,-0000000004.98
001,"ALAOO","ACTUALS",119986,-0000000004.77


This is the SORT card which i have tried :
Code:
//SYSIN    DD *                                               
 SORT FIELDS=(6,5,CH,A)                                       
 SUM FIELDS=(1,3,ZD,30,14,ZD)                                 
 OUTREC FIELDS=(C'RECCOUNT',9:1,3,C' TOTALAMOUNT ',25:30,14) 
/*                                                           


I am trying to sum on the first 3 bytes of the Input file & 14 bytes starting from 30th byte of Input file but i am getting S0C7. Can anyone please able to help me on this as i am trying to resolve this from quite some time now. I believe i am not using the correct format for second field. Please let me know your thoughts.
Back to top
View user's profile Send private message

Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2205
Location: Hampshire, UK

PostPosted: Tue Jun 18, 2019 4:19 pm    Post subject: Reply to: Need to get the SUM of two fields using SUM FIELDS only
Reply with quote

Have you looked up in the manual the various formats? You should have found, I believe, SFF.
Back to top
View user's profile Send private message
Poha Eater

New User


Joined: 31 Aug 2016
Posts: 65
Location: India

PostPosted: Tue Jun 18, 2019 4:49 pm    Post subject:
Reply with quote

Hi Nic,

Thanks for taking out the time to go through this. This is i have used
Code:
INREC OVERLAY=(30:30,14,SFF,TO=ZD,LENGTH=14)                       
 SORT FIELDS=(6,5,CH,A)                                             
 SUM FIELDS=(1,3,ZD,30,14,ZD)                                       
 OUTREC FIELDS=(C'RECCOUNT',9:1,3,                                   
       C' TOTALAMOUNT ',25:30,14,ZD,EDIT=(STTTTTTTTTT.TT),SIGNS=(,-))

and this is working fine in Mainframe but when i am using this card in Linux, it is giving error on OVERLAY keyword. So wanted to ask if there is any way to achieve this without OVERYLAY and with SUM FIELDS ?
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2205
Location: Hampshire, UK

PostPosted: Tue Jun 18, 2019 6:37 pm    Post subject: Reply to: Need to get the SUM of two fields using SUM FIELDS only
Reply with quote

In what way did it "not work"? Show your DFSORT output.
Back to top
View user's profile Send private message
sergeyken

Active Member


Joined: 29 Apr 2008
Posts: 528
Location: Maryland

PostPosted: Tue Jun 18, 2019 7:08 pm    Post subject: Re: Need to get the SUM of two fields using SUM FIELDS only
Reply with quote

Poha Eater wrote:
Code:

----+----1----+----2----+----3----+----4---
********************************* Top of Da
001,"ALAOO","ACTUALS",119986,-0000000167.59
001,"ALAOO","ACTUALS",119986,-0000000186.04
001,"ALAOO","ACTUALS",119986,-0000001380.46
001,"ALAOO","ACTUALS",119986,-0000003265.91
001,"ALAOO","ACTUALS",119986, 0000000009.07
001,"ALAOO","ACTUALS",119986, 0000000023.56
001,"ALAOO","ACTUALS",119986, 0000000047.12
001,"ALAOO","ACTUALS",119986,-0000000004.98
001,"ALAOO","ACTUALS",119986,-0000000004.77


This is the SORT card which i have tried :
Code:
//SYSIN    DD *                                               
 SORT FIELDS=(6,5,CH,A)                                       
 SUM FIELDS=(1,3,ZD,30,14,ZD)                                 
 OUTREC FIELDS=(C'RECCOUNT',9:1,3,C' TOTALAMOUNT ',25:30,14) 
/*                                                           


The field "30,14" is not in format ZD.
Period.

1) RTFM
2) Specify the meaning of "not working" in plain English
3) Present your code samples, and results

Otherwise it's all just wasting of (our) time.
Back to top
View user's profile Send private message
Poha Eater

New User


Joined: 31 Aug 2016
Posts: 65
Location: India

PostPosted: Tue Jun 18, 2019 7:52 pm    Post subject:
Reply with quote

Hi,

Part of our application was earlier transferred on Linux and that is why some of the SORT keywords do not work in that environment. One of such SORT keyword is 'OVERLAY' which i have used in above given sort card.

So In other words, i have a constraint here where i have to achieve the requirement by using 'SUM FIELDS' & not using 'OVERLAY' keywords. If there is any solution available with these constraints, then please let me know.

I have already given my code above. Below is the sample output which i am expecting.
Code:
----+----1----+----2----+----3----+---
***************************** Top of D
RECCOUNT100 TOTALAMOUNT -0000032429.27
**************************** Bottom of


The sum which is starting from 9th & 25th byte is not the sum of above given sample Input records. It is just for reference that how output should be displayed.
Back to top
View user's profile Send private message
sergeyken

Active Member


Joined: 29 Apr 2008
Posts: 528
Location: Maryland

PostPosted: Tue Jun 18, 2019 8:03 pm    Post subject:
Reply with quote

The field "30,14" is not in format ZD.
Your SUM= cannot work correctly.
Period.
Back to top
View user's profile Send private message
enrico-sorichetti

Senior Member


Joined: 14 Mar 2007
Posts: 10615
Location: italy

PostPosted: Tue Jun 18, 2019 8:49 pm    Post subject: Reply to: Need to get the SUM of two fields using SUM FIELDS only
Reply with quote

if You post to the dfsort forum,
YOU SHOULD EXPECT SOLUTIONS MAKING USE OF ALL THE DFSORT CAPABILITIES

Will a good soul moderator move the topic somewhere else icon_cool.gif
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 Training on numeric fields data formats sergeyken SYNCSORT 12 Thu Aug 01, 2019 8:15 pm
No new posts Compare fields with decimal chandan.inst SYNCSORT 6 Thu Apr 04, 2019 5:29 pm
No new posts Query on summing up the fields abdulrafi DFSORT/ICETOOL 10 Mon Jan 21, 2019 7:18 pm
This topic is locked: you cannot edit posts or make replies. remove the gap b/w 2 fields shymala COBOL Programming 5 Thu Aug 02, 2018 12:05 pm
No new posts Comparing Comp-3 fields with greater ... Prateeksichem1 DFSORT/ICETOOL 11 Fri Jul 13, 2018 8:45 am

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