Portal | 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
 
Accumulating fields using syncsort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> SYNCSORT
View previous topic :: :: View next topic  
Author Message
Hemant L

New User


Joined: 07 Feb 2020
Posts: 2
Location: usa

PostPosted: Fri Feb 07, 2020 2:55 am    Post subject: Accumulating fields using syncsort
Reply with quote

Hi
I am trying to add 2 fields from the same record and store the result in another position on the same record. Example
field1 in pos 1 and field2 in pos 20, sum the 2 fields and store the result in pos 30

fld1 fld2 fld3 (result - sum of fld1 + fld2)
123.23 45.00 168.23

Please let me know how this can be accomplished with syncsort.

Thank you.
Back to top
View user's profile Send private message

Nic Clouston

Global Moderator


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

PostPosted: Fri Feb 07, 2020 4:36 am    Post subject: Reply to: Accumulating fields using syncsort
Reply with quote

Firstly by posting in the Syncsort part of the forum - topic moved.
Secondly - what have you tried?
Thirdly - sorts tend to know nothing about decimals so you need to multiply by 100 beffor adding then divide the sum by 100 (I believe - search the DFSort and Syncsort forums for topics realted to this).
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


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

PostPosted: Fri Feb 07, 2020 6:33 am    Post subject:
Reply with quote

http://ibmmainframes.com/about49323.html
http://ibmmainframes.com/viewtopic.php?p=240304#240304
Back to top
View user's profile Send private message
dneufarth

Active User


Joined: 27 Apr 2005
Posts: 317
Location: Inside the SPEW (Cincinnati OH USA)

PostPosted: Fri Feb 07, 2020 7:37 am    Post subject:
Reply with quote

Curiosity - why store sum when it can be calculated at will?
Back to top
View user's profile Send private message
Joerg.Findeisen

Active User


Joined: 15 Aug 2015
Posts: 307
Location: Bamberg, Germany

PostPosted: Fri Feb 07, 2020 10:37 am    Post subject:
Reply with quote

Let's see what has been tried and what Data formats to expect. Are fixed or floating point decimals used. Negative values and so on.
Back to top
View user's profile Send private message
Hemant L

New User


Joined: 07 Feb 2020
Posts: 2
Location: usa

PostPosted: Fri Feb 07, 2020 8:17 pm    Post subject: Reply to: Accumulating fields using syncsort
Reply with quote

Thank you all for the responses and for pointing me in the right direction.
I was actually trying to add 2 packed fields and store the result in another packed field.

Input shown as packed
Code:
----+----1----+----2---
                            
22244444111444444444444
22C0000011C000000000000
-----------------------
                            
33344444111444444444444
33D0000011D000000000000

Code:
//SYSIN DD *                                       
  OPTION COPY                                     
  INREC OVERLAY=(18:1,3,PD,ADD,9,3,PD,PD,LENGTH=5)
/*   


Result
Code:
2224444411144444400333444
22C0000011C0000000033C000
    ------------------------
                     (   
3334444411144444400444444
33D0000011D0000000044D000                                 

Thank you
H
Back to top
View user's profile Send private message
sergeyken

Active Member


Joined: 29 Apr 2008
Posts: 825
Location: Maryland

PostPosted: Fri Feb 07, 2020 11:53 pm    Post subject: Re: Reply to: Accumulating fields using syncsort
Reply with quote

Hemant L wrote:
Thank you all for the responses and for pointing me in the right direction.
I was actually trying to add 2 packed fields and store the result in another packed field.

Input shown as packed
Code:
----+----1----+----2---
                            
22244444111444444444444
22C0000011C000000000000
-----------------------
                            
33344444111444444444444
33D0000011D000000000000

Code:
//SYSIN DD *                                       
  OPTION COPY                                     
  INREC OVERLAY=(18:1,3,PD,ADD,9,3,PD,PD,LENGTH=5)
/*


Result
Code:
2224444411144444400333444
22C0000011C0000000033C000
    ------------------------
                     (   
3334444411144444400444444
33D0000011D0000000044D000                             

Thank you
H

22222+11111=000033333
(-33333)+(-11111)=(-000044444)

What is not acceptable???
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 -> SYNCSORT All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts FIELDS OVERLAPPING WITH MODE = IN OR ... sandeep prajapati CICS 3 Tue Aug 11, 2020 4:05 pm
No new posts Populating Date and Sequence numer in... PORYES SYNCSORT 11 Thu Jul 16, 2020 5:01 pm
No new posts Insert System Runtime in HEADER In SY... Rick Ryan SYNCSORT 9 Tue May 26, 2020 9:01 pm
No new posts SYNCSORT in Z/VSE nithinkarthika SYNCSORT 24 Mon May 11, 2020 3:44 pm
No new posts Removing Hyphens and Dots using Syncsort PORYES SYNCSORT 8 Tue Apr 28, 2020 9:52 pm

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