View previous topic :: View next topic
|
Author |
Message |
paramita
New User
Joined: 06 Mar 2005 Posts: 14 Location: Bangalore
|
|
|
|
In an assembler program why does a DC H'0' result in a S0C1 abend? |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
Because the programmer (for numerous reasons I'm sure) decided to drive the logic to the label associated with this H'0' definition and an OPCODE of X'00' (first byte of the halfword) is not a valid OPCODE, which results in a S0C1.
Normally, driving logic to a label like this indicates the programmer intentionally wanted to raise an abend/dump.
Regards, |
|
Back to top |
|
|
paramita
New User
Joined: 06 Mar 2005 Posts: 14 Location: Bangalore
|
|
|
|
Bill, thank you for the explanation.
Sorry if my question wasn't clear. What I am trying to figure out is why we need to code a DC H'0' to get the abend - why not a DC F'0' or something similar?
((DC F'0' also has the op-code of X'00' and should result in a S0C1 abend.)) |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
Actually, it could have been a constant X'00'. But, halfword-constants are what I've seen in the past most of the time. I guess the programmer wanted to save two-bytes, because a fullword is four-bytes. Regardless, an OPCODE of X'00' will always raise a S0C1.
Regards, |
|
Back to top |
|
|
paramita
New User
Joined: 06 Mar 2005 Posts: 14 Location: Bangalore
|
|
|
|
Thanks! |
|
Back to top |
|
|
MBabu
Active User
Joined: 03 Aug 2008 Posts: 400 Location: Mumbai
|
|
|
|
In theory, if the last valid instruction before the F'0' ends 2 bytes before the F'0' then the F'0' could be preceeded by 2 bytes of uninitialized storage that might contain a valid instruction. If that instruction happens to be a branch, then it is possible that the bad opcode in an F'0' might never be hit. Or if it is something that affects storage (LR, SVC, etc) then the dump taken by the F'0' will show incorrect data for the time of the abend. That is why people use H'0' to align the bad opcode immediately after the last instruction. If you want to use F'0' say for making it easier to find in a dump, you should preceed it with CNOP directives to insure that the instructions leading up to the aligned fullword are valid NOP instructions. |
|
Back to top |
|
|
paramita
New User
Joined: 06 Mar 2005 Posts: 14 Location: Bangalore
|
|
|
|
Thanks MBabu. |
|
Back to top |
|
|
paramita
New User
Joined: 06 Mar 2005 Posts: 14 Location: Bangalore
|
|
|
|
Hello MBabu,
I am back with some more questions.
First, let me see if I have understood you correctly. Assembler instructions follow the halfword boundary requirement and so does DC H'0'. So, if I code a DC H'0' after some instruction, the DC H'0' will be stored right after the instruction and there will be no unused bytes of storage between the instruction and the halfword zero.
DC F'0' follows the fullword boundary requirement. If I code a DC Fâ0â after an instruction there may be 2 unused bytes of storage if the previous instruction is not on a fullword boundary even though it is on a halfword boundary.
My question is â will something else get stored in these 2 unused bytes of storage?
Next, you mentioned something about LR and SVC affecting storage. How do these instructions affect storage?
Sorry if I am asking too many questions. |
|
Back to top |
|
|
MBabu
Active User
Joined: 03 Aug 2008 Posts: 400 Location: Mumbai
|
|
|
|
Your understanding is correct. The (possible) two bytes of unused storage between the end of the instruction and an F'0' depends on what happened when the module was loaded into storage. I don't remember if the loader zeros the storage first (I hope so, but don't know). If not, those bytes could anything including valid opcodes.
Load Register (LR) won't change storage but it would change a register. Similarly SVCs can do anything since they are basically calls to other programs in the system. Since DC H'0' is often used to force a dump, you want to make sure the registers and storage can't get changed before the dump occurs. |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
Terminating a program with an invalid instruction is not a good practice.
The person running a job (or the operator in the middle of the night) should be able to see immediately if the job canceled by program request it or because of a bug (regardless of any other message that may appear).
That's why you have Sxxx abends and Uxxxx abends.
I'm pretty sure that:
will work. |
|
Back to top |
|
|
paramita
New User
Joined: 06 Mar 2005 Posts: 14 Location: Bangalore
|
|
|
|
MBabu and Marso, thank you for the explanation. |
|
Back to top |
|
|
UmeySan
Active Member
Joined: 22 Aug 2006 Posts: 771 Location: Germany
|
|
|
|
Hi !
As Marso allready told: No good practice.
You could use abend-macro. You could have several points in your programm, where the makro is coded, but using different abend-numbers.
So looking the abend-number you know where it occurs in your programm. So you can dedicate different numbers to different situations.
mvc bla,bla
mvc bla,bla
abend dump,4711 |
|
Back to top |
|
|
paramita
New User
Joined: 06 Mar 2005 Posts: 14 Location: Bangalore
|
|
|
|
Hi UmeySan,
Thanks for letting me know.
Btw, where can I find more information on the abend macro and the Cancel program? |
|
Back to top |
|
|
UmeySan
Active Member
Joined: 22 Aug 2006 Posts: 771 Location: Germany
|
|
|
|
@ paramita
Morning Sir !
Plse have a look at publib.boulder.ibm.com an search for MVS, Z/OS, or VSE Macro Instructions. |
|
Back to top |
|
|
paramita
New User
Joined: 06 Mar 2005 Posts: 14 Location: Bangalore
|
|
|
|
UmeySan,
Good Morning and thanks for the clue.
PS: I am female. :-) |
|
Back to top |
|
|
|