|
|
|
Prompt: Find the instruction in the following HLASM program that would cause a S0C4 ABEND on a z/OS system.
MYPGM CSECT ,
BAKR R14,0
LR R12,R15
USING MYPGM,R12
*
MVI FIELD1,C'A'
MVI FIELD2,C'B'
MVI FIELD3,C'C'
*
PR ,
FIELD1 DS C' '
FIELD2 EQU 0
FIELD3 DS C' '
DROP R12
END
|
MYPGM CSECT ,
BAKR R14,0
LR R12,R15
USING MYPGM,R12
*
MVI FIELD1,C'A' <-- OK
MVI FIELD2,C'B' <-- POTENTIAL PROBLEM
MVI FIELD3,C'C' <-- OK
*
PR ,
FIELD1 DS C' '
FIELD2 EQU 0 <-- DEFINITE PROBLEM
FIELD3 DS C' '
DROP R12
END
Issue:
MVI FIELD2,C'B'
MVI FIELD2,C'B'The root cause of the abend lies in how FIELD2 is defined in the program's data section:
FIELD2 EQU 0When the processor attempts to execute this MVI instruction, the system's memory protection hardware will detect the unauthorized attempt to write to a protected location, triggering a protection exception, which results in the S0C4 abend.
MVI FIELD2,C'B'Here's why:
The instruction that would cause a S0C4 ABEND on a z/OS system is:
MVI FIELD2,C'B'
The problem lies in how FIELD2 is defined in the program:
FIELD2 EQU 0This EQU 0 directive assigns FIELD2 the absolute address 0 (null pointer). When the MVI FIELD2,C'B' instruction executes, it attempts to store the character 'B' at memory address 0, which is protected memory on z/OS systems.