I took an existing program, which has run fine since 2008 and expanded a packed field in an occurs clause and now the program is abending and I just can't see what the problem is.
I took the existing program and added displays - here are snapshots of the code and the results of the production version. Below WS-TEST1 and DDICAPT-VOL(WS-SUB3) is a display of the values in hex.
WS-TEST1 = /
CHAR /
ZONE 006144444
NUMR 011C00000
1...5...1
PROCTBL-VOL(WS-SUB2) = 2635
DDICAPT-VOL(WS-SUB3) =
CHAR
ZONE 0000
NUMR 000C
1...
WS-SUB2 = 02
WS-SUB3 = 05
2DICAPT-VOL(WS-SUB3) = 1611 IN THE TEST CODE, IT ABENDS BEFORE THIS DISPLAY
CHAR /
ZONE 0061
NUMR 011C
1...
DDICAPT-DATA 40 143 A
DDICAPT-DATA-TABLE DDICAPT-DATA 13 A OCCURS 11
DDICAPT-PROCESS-DATE DDICAPT-DATA-TABLE 04 P
DDICAPT-NBRAMT DDICAPT-DATA-TABLE +4 01 A
DDICAPT-REC-COUNT DDICAPT-DATA-TABLE +5 04 P
DDICAPT-VOLUME DDICAPT-DATA-TABLE +9 04 P
DDICAPT-NO-DATA-RECEIVED-DAYS 183 02 N
DDICAPT-FILLER 185 16 A
WS-PROCESS-TABLE W 162 A
WS-PROCTBL WS-PROCESS-TABLE 27 A OCCURS 6
WS-PROCTBL-DATEC WS-PROCTBL 8 N VALUE 0 -
MASK('99/99/9999')
WS-PROCTBL-DATEJ WS-PROCTBL +8 4 P VALUE 0
WS-PROCTBL-RECS WS-PROCTBL +12 4 P VALUE 0 -
MASK('ZZZZZZ9')
WS-PROCTBL-VOL WS-PROCTBL +16 4 P VALUE 0 -
MASK('ZZZZZZ9')
WS-PROCTBL-AMT WS-PROCTBL +20 4 P 2 VALUE 0 -
MASK('ZZZZ9.99')
WS-PROCTBL-AMT-VAR WS-PROCTBL +24 1 A VALUE ' '
WS-PROCTBL-REC-VAR WS-PROCTBL +25 1 A VALUE ' '
WS-PROCTBL-VOL-VAR WS-PROCTBL +26 1 A VALUE ' '
WS-TEST1 W 9 A
IF DDICAPT-VOLUME(WS-SUB3) NE 0
MOVE DDICAPT-VOLUME(WS-SUB3) TO WS-TEST1
END-IF
DISPLAYS WERE PLACED HERE
WS-ACTUAL-VARIANCE = 0
IF WS-TEST1 NE ' ' AND +
WS-PROCTBL-VOL(WS-SUB2) NE 0
MOVE WS-TEST1 TO DDICAPT-VOLUME(WS-SUB3) THIS IS THE STATEMENT THAT FAILS IN THE TEST CODE
DISPLAY WAS PLACED HERE
WS-ACTUAL-VARIANCE = +
WS-PROCTBL-VOL(WS-SUB2) / DDICAPT-VOLUME(WS-SUB3)
END-IF
Here is the changed code:
I've changed WS-TEST1 to various sizes (11,7) but there is no difference, still abends. None of the IF logic was changed, just the additional byte to the packed field.
DDICAPT-DATA 40 154 A
DDICAPT-DATA-TABLE DDICAPT-DATA 14 A OCCURS 11
DDICAPT-PROCESS-DATE DDICAPT-DATA-TABLE 04 P
DDICAPT-NBRAMT DDICAPT-DATA-TABLE +4 01 A
DDICAPT-REC-COUNT DDICAPT-DATA-TABLE +5 04 P
DDICAPT-VOLUME DDICAPT-DATA-TABLE +9 05 P
DDICAPT-NO-DATA-RECEIVED-DAYS 194 02 N
DDICAPT-FILLER 196 05 A
WS-PROCESS-TABLE W 168 A
WS-PROCTBL WS-PROCESS-TABLE 28 A OCCURS 6
WS-PROCTBL-DATEC WS-PROCTBL 8 N VALUE 0 -
MASK('99/99/9999')
WS-PROCTBL-DATEJ WS-PROCTBL +8 4 P VALUE 0
WS-PROCTBL-RECS WS-PROCTBL +12 4 P VALUE 0 -
MASK('ZZZZZZ9')
WS-PROCTBL-VOL WS-PROCTBL +16 5 P VALUE 0 -
MASK('ZZZZZZZZ9')
WS-PROCTBL-AMT WS-PROCTBL +21 4 P 2 VALUE 0 -
MASK('ZZZZ9.99')
WS-PROCTBL-AMT-VAR WS-PROCTBL +25 1 A VALUE ' '
WS-PROCTBL-REC-VAR WS-PROCTBL +26 1 A VALUE ' '
WS-PROCTBL-VOL-VAR WS-PROCTBL +27 1 A VALUE ' '
WS-TEST1 = /
CHAR /
ZONE 00614444444
NUMR 011C0000000
1...5...10.
PROCTBL-VOL(WS-SUB2) = 2635
DDICAPT-VOL(WS-SUB3) =
CHAR
ZONE 00000
NUMR 0000C
1...5
WS-SUB2 = 02
WS-SUB3 = 05
12/29/10 12.42.14 CA-EASYTRIEVE PLUS-6.4 0311 PAGE 1
PROGRAMS AND ALL SUPPORTING MATERIALS COPYRIGHT (C) 1982, 1996 BY COMPUTER ASSOCIATES INTL. INC.
280 *******A006 PROGRAM INTERRUPT - CODE 7 (DATA EXCP)
INTERRUPT OCCURRED AT 085A BLOCK 1 FROM EP CA-EASYTRIEVE PLUS 6.4 0311-12/29/10-12.41-JSN00228
INSTRUCTION AT 0000C88A IS F89431262022
FIRST OPERAND ADDRESS 0000B166 CONTENTS 0000000000000000005F
SECOND OPERAND ADDRESS 0007D1F8 CONTENTS 0001611C40
PSW+4 AT INTERRUPT 8000C890
REGISTERS AT INTERRUPT
R0 00008D40 R1 00008508 R2 0007D1D6 R3 0000B040 R4 000084D0 R5 0000A040 R6 0007D190 R7 000094A8
R8 0007D1D6 R9 0000A2A8 R10 A8507626 R11 0000C030 R12 00040B78 R13 000127EC R14 8000C81E R15 00000000
FILE ID/NAME RECORD ADDRESS RECORD LENGTH STATUS
0001 SYSPRINT 00006BF4 62 OPEN
0002 SYSIN 00000000 80 CLOSED
0003 WORK 00000000 0 CLOSED
0004 EZTPRE 00000000 512 CLOSED
0005 DDICAPT 0007D190 200 ACTIVE
0006 FVSCVAR 00000000 0 CLOSED
0007 RPTAMT 00017C14 151 ACTIVE
0008 RPTVOL 00017B74 126 ACTIVE
0009 EZTS001 00000000 104 CLOSED
000A EZTS002 00017B0C 34 CLOSED
WORKING STORAGE
BLOCK ADDRESS
0001 000084D0
0002 000094A8
0003 0000A040
0004 0000B030
*******A014 PREMATURE TERMINATION DUE TO PREVIOUS ERROR(S)