Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Sum the values in alphanumeric format

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

Active User


Joined: 02 Oct 2008
Posts: 151
Location: India

PostPosted: Sat Oct 15, 2011 3:10 am    Post subject: Sum the values in alphanumeric format
Reply with quote

My requirement is sum the amount in the file that is declared as alphanumeric (X15) as mentioned below

Input layout
01 WS-ITEM PIC 9(3)
01 FILLER PIC X(2)
01 WS-PREM PIC X(15)

Code:
123              100.50
123             -250.50
123            -1000.50
234                1.25
234               -1.25


Ouput should be
Code:
123            -1150.50
234                0.00

I have tried converting char format to ZD using UFF, M11 however it is not taking the signed format. Here we need to consider the -ve sign too.

Please help or guide me how to accomplish this task using DFSORT

Thanks
Vinu
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Sat Oct 15, 2011 3:20 am    Post subject: Reply to: Sum the values in alphanumeric format
Reply with quote

What do you think the "U" in UFF might mean?

This topic is using a trailing sign. See if you can get to a leading sign.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Sat Oct 15, 2011 3:32 am    Post subject: Reply to: Sum the values in alphanumeric format
Reply with quote

Assuming the data is sorted on the first 3 bytes, the following DFSORT JCl will give you the desired results. If the data is not sorted , change the

Code:

  SORT FIELDS=COPY


to

Code:

  SORT FIELDS=(1,3,CH,A)


Code:

//STEP0100 EXEC PGM=SORT                                           
//SYSOUT   DD SYSOUT=*                                             
//SORTIN   DD *                                                   
----+----1----+----2----+----3----+----4----+----5----+----6----+--
123           100.50                                               
123          -250.50                                               
123         -1000.50                                               
234             1.25                                               
234            -1.25                                               
//SORTOUT  DD SYSOUT=*                                             
//SYSIN    DD *                                                   
  SORT FIELDS=COPY                                                 
  OUTFIL REMOVECC,NODETAIL,                                       
  SECTIONS=(1,3,                                                   
  TRAILER3=(1,3,X,                                                 
            TOT=(6,15,SFF,EDIT=(SIIIIIIIIIIIIIIT.TT),SIGNS=(,-))))
//*     
Back to top
View user's profile Send private message
vinu78

Active User


Joined: 02 Oct 2008
Posts: 151
Location: India

PostPosted: Thu Nov 03, 2011 10:38 pm    Post subject:
Reply with quote

Thanks Kolusu. This works like a charm.

Regards
Vinu
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 Extend the decimal values in DIVISION Balaryan DFSORT/ICETOOL 3 Thu Oct 05, 2017 4:05 pm
No new posts Fetch Previous month & year in MM... girishb2 DFSORT/ICETOOL 3 Thu Sep 21, 2017 9:54 pm
No new posts Working with hex values in Filemanage... Emile Straker IBM Tools 0 Tue Sep 12, 2017 1:42 am
No new posts DB2 NULL Values display V S Amarendra Reddy DB2 3 Thu Sep 07, 2017 6:59 pm
No new posts Moving values to a variable of copybo... Vignesh Sid COBOL Programming 6 Wed Sep 06, 2017 1:04 pm

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