Joined: 26 Nov 2002 Posts: 12367 Topics: 75 Location: San Jose
Posted: Mon Apr 10, 2006 9:24 pm Post subject:
Ranjish,
You cannot sum the display numeric items using ZD format. You either need to convert them to PD format or have the sign on the last nibble of zd format.
If you have latest version of DFSORT then you can use SFF/FS format to get the desired results.
Signed zoned decimal numbers have sign on the last nibble like as shown below.
ex:
Code:
**********************************************************************
* 1 - A -1 - J EXAMPLES: NUMBER REPRESENTATION *
* 2 - B -2 - K 10 00000001{ *
* 3 - C -3 - L 105 00000010E *
* 4 - D -4 - M 0 00000000{ *
* 5 - E -5 - N -234 00000023M *
* 6 - F -6 - O -30 00000003} *
* 7 - G -7 - P *
* 8 - H -8 - Q *
* 9 - I -9 - R *
* 0 - { -0 - } *
**********************************************************************
That is how the signed zoned decimal are reprenstated. Check this link which shows about summing such numbers
Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
Posted: Tue Apr 11, 2006 3:52 am Post subject:
Ranjish,
Check your outrec statement. You had converted your input amount from FS format to PD (Packed Decimal) format at location 225 but in OUTREC you refer it as ZD (Zoned Decimal)
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Tue Apr 11, 2006 10:17 am Post subject:
Here's another way to do it with DFSORT:
Code:
//S2 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file
//SORTOUT DD DSN=... output file
//SYSIN DD *
* Create one contiguous key at end of record for SECTIONS.
INREC OVERLAY=(237:24,16,68,5,112,4,118,2)
* Sort on the contiguous key.
SORT FIELDS=(237,27,CH,A)
OUTFIL REMOVECC,NODETAIL,
* Ensure output length is 39.
BUILD=(39X),
* Use contiguous key as break field.
SECTIONS=(237,27,
* Use TOT with SFF to get total.
TRAILER3=(01:112,04,
05:118,02,
07:024,16,
23:068,05,
28:TOT=(225,12,SFF,EDIT=(STTTTTTTTTTT),SIGNS=(+,-,,))))
/*
_________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum