IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Signed numbers with decimal numbers - sum


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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 Developer


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

PostPosted: Thu Jan 21, 2010 10:55 pm
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
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 Developer


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

PostPosted: Fri Jan 22, 2010 9:59 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Generate random number from range of ... COBOL Programming 3
No new posts Need Help with Packed Decimal Signs DFSORT/ICETOOL 4
No new posts Select a DB2 value in a specific deci... DB2 4
Search our Forums:

Back to Top