Regardless of how INITIALIZE functions, I've never noticed a case of dead store elimination, even with OPT(2) being set. Take the following simple example:
process nooff list opt(2) identification division. program-id. deadstor. data division. working-storage section. 01 one pic x value 'x'. procedure division. move 'a' to one move 'b' to one display one goback. end program deadstor.
This results in the following pseudo-assembler:
[...] 000124 1818 000002 LR R1,R8 000126 A52A 8100 000002 OILH R2,0x8100 00012A 5010 8000 000000 ST R1,0(,R8) # BLT_1 00012E 92A7 1028 000000 MVI 40(,R1),X'A7' # ONE 000132 5020 1070 000002 ST R2,112(,R1) # IPCB_Status 000136 4100 1004 000000 LA R0,4(,R1) # 00013A 4120 1008 000000 LA R2,8(,R1) # 00013E 5000 1004 000000 ST R0,4(,R1) # BLT_2 000142 5020 1008 000000 ST R2,8(,R1) # BLT_3 000146 000002 L0005: EQU * 000146 000002 USER-ENTRY: EQU * 000146 000002 SNAPSHOT ENTRY 000008: 001610 move 'a' to one 000146 4100 8028 000008 LA R0,40(,R8) # 000010: 001630 display one 00014A 4120 D098 000010 LA R2,152(,R13) # _ArgumentList 00014E 000008 SNAPSHOT STMT 00014E 9281 8028 000008 MVI 40(,R8),X'81' # ONE 000152 1812 000010 LR R1,R2 000009: 001620 move 'b' to one 000154 000009 SNAPSHOT STMT 000154 9282 8028 000009 MVI 40(,R8),X'82' # ONE 000158 000010 SNAPSHOT STMT 000158 D217 D098 309C 000010 MVC 152(24,R13),156(R3) # _$CONSTANT_AREA+156 00015E 5000 D0A0 000010 ST R0,160(,R13) # 000162 58F0 3068 000010 L R15,104(,R3) # _ACON 000166 58C0 D080 000010 L R12,128(,R13) # _@CAA 00016A 0DEF 000010 BASR R14,R15 # Call "IGZXDSP" [...]
As far as I can tell, the field named "one" is initially set to 'x' (X'A7), then to 'a' (X'81'), then to 'b' (X'82), even though the setting to 'b' is the only one that matters in the end.
fswarbrick