Portal | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
Hemant L

New User

Joined: 07 Feb 2020
Posts: 2
Location: usa

 Posted: Fri Feb 07, 2020 2:55 am    Post subject: Accumulating fields using syncsort 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.

Nic Clouston

Global Moderator

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

 Posted: Fri Feb 07, 2020 4:36 am    Post subject: Reply to: Accumulating fields using syncsort 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).
Rohit Umarjikar

Senior Member

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

 Posted: Fri Feb 07, 2020 6:33 am    Post subject:
dneufarth

Active User

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

 Posted: Fri Feb 07, 2020 7:37 am    Post subject: Curiosity - why store sum when it can be calculated at will?
Joerg.Findeisen

Active User

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

 Posted: Fri Feb 07, 2020 10:37 am    Post subject: 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.
Hemant L

New User

Joined: 07 Feb 2020
Posts: 2
Location: usa

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

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
sergeyken

Active Member

Joined: 29 Apr 2008
Posts: 825
Location: Maryland

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

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???
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

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

 © 2003-2020 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us