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

Author Message
Prasanthhere

Active User

Joined: 03 Aug 2005
Posts: 306

Posted: Mon Aug 14, 2006 5:10 pm    Post subject: Signed Zone Decimal Summing

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)

Thanks

Frank Yaeger

DFSORT Moderator

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

Posted: Mon Aug 14, 2006 9:32 pm    Post subject:

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

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics Extend the decimal values in DIVISION Balaryan DFSORT/ICETOOL 3 Thu Oct 05, 2017 4:05 pm Joinkeys with decimal scdinesh DFSORT/ICETOOL 3 Fri Feb 10, 2017 4:46 am Converting decimal to numeric using I... Balaryan DFSORT/ICETOOL 4 Thu Feb 02, 2017 11:27 pm Summing on Mixed Case Literals Roy Ware SYNCSORT 3 Tue Jan 03, 2017 10:18 pm Comparing Decimal and CHAR columns rakesh17684 DB2 7 Thu Oct 20, 2016 2:33 am

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