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

Signed Zone Decimal Summing


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Prasanthhere

Active User


Joined: 03 Aug 2005
Posts: 306

PostPosted: Mon Aug 14, 2006 5:10 pm
Reply with quote

Hi,

I am having a file which has records in the following format

Code:

12345-333
123450444
12345-444
12345-555
21345-333
213450444


Here the first five bytes can leave it as it is ,and from the 6 byte till 9 byte i have to add and produce the output as follows

Code:

12345-888
213450111


-888 is(-333+444-444-555)

Could you please share your thoughts on this ?

Thanks
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: Mon Aug 14, 2006 9:32 pm
Reply with quote

-888 and 0111 is a rather strange format. What do you do if the negative value has 4 digits? Assuming that the more usual -888 and b111 (b for blank) is ok, here's a DFSORT job that will do what you want:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
12345-333
123450444
12345-444
12345-555
21345-333
213450444
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  OUTFIL REMOVECC,NODETAIL,
   SECTIONS=(1,5,
     TRAILER3=(1,5,TOT=(6,4,FS,TO=FS,LENGTH=4)))
/*


SORTOUT will have:

Code:

12345-888 
21345 111 
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 Need Help with Packed Decimal Signs DFSORT/ICETOOL 4
No new posts Select a DB2 value in a specific deci... DB2 4
No new posts String has hex character need to conv... COBOL Programming 3
Search our Forums:

Back to Top