Decimal Point Not Lining Up
Posted: Fri Apr 05, 2019 4:17 pm
Guys,
Any help would be appreciated on this issue as it is driving me nuts and I cannot see the wood for the trees at this point.
My SALARY field is defined as per the program specification:
05 TRANS_SALARY PIC '(05)9V99',
The detail field in my Report Line is defined as follows (I've gone bare bones here to simplify, no dollar sign, zero suppression or anything):
05 PRT_SALARY PIC '99,999.99' INIT(0),
My assignment code in the program is straightforward too:
PRT_SALARY = TRANS_SALARY;
Yet, when I print my report line the Salary field is displayed as if the last 2 bytes of the input did not exist and the decimal point is moved 2 bytes to the left.
Here's an example with the first record and with the help of some debugging PUT LIST lines:
Record from file with Salary field highlighted - so this is a salary of 123.45:
123456ANITA BATH MR 001234519/02/10STRONG TEAM PLAYER A
On the Output Report it displays as:
TRAN NAME NAME TITLE EMPLOYEE SALARY REVIEW TYPE SURNAME FIRST ID DATE
A BATH ANITA MR 123456 00,001.23 19/02/10
When I display the value in the input file I get:
TRANS_SALARY: 0012345 This is correct from the input file and is 123.45
PRT_SALARY: 00,001.23 This is how it appears on the Report and the PUT LIST command!!!!!!!!!!
It seems to be dropping the last 2 digits to the right of the decimal point so 0012345 becomes 00123 and then when the assignment happens it becomes 001.23
Any help is greatly appreciated.
Thanks,
Eamonn
Any help would be appreciated on this issue as it is driving me nuts and I cannot see the wood for the trees at this point.
My SALARY field is defined as per the program specification:
05 TRANS_SALARY PIC '(05)9V99',
The detail field in my Report Line is defined as follows (I've gone bare bones here to simplify, no dollar sign, zero suppression or anything):
05 PRT_SALARY PIC '99,999.99' INIT(0),
My assignment code in the program is straightforward too:
PRT_SALARY = TRANS_SALARY;
Yet, when I print my report line the Salary field is displayed as if the last 2 bytes of the input did not exist and the decimal point is moved 2 bytes to the left.
Here's an example with the first record and with the help of some debugging PUT LIST lines:
Record from file with Salary field highlighted - so this is a salary of 123.45:
123456ANITA BATH MR 001234519/02/10STRONG TEAM PLAYER A
On the Output Report it displays as:
TRAN NAME NAME TITLE EMPLOYEE SALARY REVIEW TYPE SURNAME FIRST ID DATE
A BATH ANITA MR 123456 00,001.23 19/02/10
When I display the value in the input file I get:
TRANS_SALARY: 0012345 This is correct from the input file and is 123.45
PRT_SALARY: 00,001.23 This is how it appears on the Report and the PUT LIST command!!!!!!!!!!
It seems to be dropping the last 2 digits to the right of the decimal point so 0012345 becomes 00123 and then when the assignment happens it becomes 001.23
Any help is greatly appreciated.
Thanks,
Eamonn