View previous topic :: View next topic
|
Author |
Message |
nkothako
Active User
Joined: 26 Nov 2008 Posts: 125 Location: chennai
|
|
|
|
Code: |
Working-storage section.
03 FN-TNZ-TOT-AMT-X.
05 FN-TNZ-TOT-AMT PIC S9(11) COMP-3.
05 FILLER PIC X(02).
03 FN-TNZ-TOT-AMT-I REDEFINES FN-TNZ-TOT-AMT-X.
05 FN-TNZ-TOT-AMT-14 PIC S9(15) COMP-3.
procedure division
IF (WH-CENTRE-CODE = 14 AND FN-TNZ-TOT-AMT-14 NOT = WA-TOTAL-AMT) OR
(WH-CENTRE-CODE NOT EQUAL 14 AND FN-TNZ-TOT-AMT NOT = WA-TOTAL-AMT) << [color=red][b]why this condition failed[/b][/color]
MOVE 'FN-TNZ-TOT-AMT NOT = WA-TOTAL-AMT' TO WS-IMSE-REASON-1
IF WH-CENTRE-CODE = 14
DISPLAY 'FN-TNZ-TOT-AMT = ' FN-TNZ-TOT-AMT-14 [color=red][b]<< how come this value is printed in the sysout[/b][/color] ELSE
DISPLAY 'FN-TNZ-TOT-AMT = ' FN-TNZ-TOT-AMT
END-IF
DISPLAY 'WA-TOTAL-AMT = ' WA-TOTAL-AMT
PERFORM 999999-CALL-ABEND
END-IF |
Code: |
SYSOUT :
FN-TNZ-TOT-AMT = 00004476673 404
WA-TOTAL-AMT = 000000004476673
FUNCTION STATUS CODE AT 210400-CHECK-TRAILER-RECORD
PCB --->
SSA1--->
SSA2--->
SSA3--->
SSA4--->
SSA5--->
REAS-1->FN-TNZ-TOT-AMT NOT = WA-TOTAL-AMT
REAS-2->
REAS-3->
CEE3250C The system or user abend U 778 R=00000000 was issued |
.
DUMP VALUES
02 WH-CENTRE-CODE 999 DISP 001
03 FN-TNZ-TOT-AMT S9(11) CMP3 +00004476673
03 WA-TOTAL-AMT S9(15) CMP3 +000000004476673
03 FN-TNZ-TOT-AMT-14 S9(15) CMP3 *** Invalid data for this data type *** Hex 00004476673C 040 |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
The root cause of the problem is you've got non-numeric data in a numeric field. Probably you're using FN-TNZ-TOT-AMT-14 without ensuring it has all digits defined.
Your two questions in BBcode are contradictory. If the second part of the first IF test were being taken, the DISPLAY would be the ELSE part. If WH-CENTRE-CODE has value 14, then the two values in the first IF statement are not equal. You need to figure out where the FN-TNZ-TOT-AMT-14 is getting the invalid data from.
I would classify the WORKING-STORAGE statements as bad coding practice, myself. If you're going to REDEFINE numeric fields, especially COMP-3 numeric fields, you should put the fillers on the FRONT of the variable so the sign is always in the last 4 bits of the variable, no matter which variable you are using. If you had done that, this problem probably would not have occurred. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
you are assuming WH-CENTRE-CODE <> 14.
all i see is something you have titled as DUMP VALUES.
Suggest you display WH-CENTRE-CODE after you set REAS-1.
actually, I don't trust any of your code and displays (dump values).
rerun with the display of WH-CENTRE-CODE within the logic you have provided. |
|
Back to top |
|
|
|