Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Signed numbers with decimal numbers - sum

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

New User


Joined: 18 Apr 2008
Posts: 11
Location: Coimbatore

PostPosted: Thu Jan 21, 2010 6:47 pm    Post subject: Signed numbers with decimal numbers - sum
Reply with quote

Hi,

I've a requirement like this. I need to get the sum of few numbers which are signed and are decimal numbers.

For example,

0314690| 0000001000.10
0314690|-0000002000.80
0314690| 0000000000.00

I need to sum up the amount fields and the result looks like as shown below.

0314690|-0000001000.70

Is there anyway this can be done by sort...

Regards,
Jithu
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu Jan 21, 2010 10:55 pm    Post subject:
Reply with quote

Do you want one sum for all of the records? Or do you want a sum of the records for each key in positions 1-7? You only show one value in 1-7 so it's difficult to tell what you really want. A better example and explanation would help.

Also, what is the RECFM and LRECL of the input file?
Back to top
View user's profile Send private message
Jithucse

New User


Joined: 18 Apr 2008
Posts: 11
Location: Coimbatore

PostPosted: Fri Jan 22, 2010 11:35 am    Post subject: Reply to: Signed numbers with decimal numbers - sum
Reply with quote

Hi,

I want the sum of records based on the value in the key position 1-7.

Here is an example to make it clear.

My input file is

0314690| 0000001000.10
0314690|-0000002000.80
0314695|-0000000500.50
0314690| 0000000000.00
0314695| 0000000500.50


And the output records looks like this

0314690|-0000001000.70
0314695| 0000000000.00

Also, the record format is FB and the LERCL is 22.

Regards,
Jithucse
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Fri Jan 22, 2010 9:59 pm    Post subject:
Reply with quote

Here's a DFSORT job that will do what you asked for:

Code:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/22)
//SORTOUT DD DSN=...  output file (FB/22)
//SYSIN    DD    *
  OPTION EQUALS
  SORT FIELDS=(1,7,CH,A)
  OUTFIL REMOVECC,NODETAIL,
    SECTIONS=(1,7,
      TRAILER3=(1,8,
        TOT=(9,14,SFF,EDIT=(STTTTTTTTTT.TT),SIGNS=(,-))))
/*
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 Joinkeys with decimal scdinesh DFSORT/ICETOOL 3 Fri Feb 10, 2017 4:46 am
No new posts Converting decimal to numeric using I... Balaryan DFSORT/ICETOOL 4 Thu Feb 02, 2017 11:27 pm
No new posts Incorrect output when trying to add n... monica1 PL/I & Assembler 10 Fri Jan 13, 2017 5:02 pm
No new posts Row-Numbers of distinct rows? Auryn DB2 1 Thu Oct 20, 2016 4:38 pm
No new posts Comparing Decimal and CHAR columns rakesh17684 DB2 7 Thu Oct 20, 2016 2:33 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us