IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Assembler program why does a DC H'0' result in a S0C1 abend


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
paramita

New User


Joined: 06 Mar 2005
Posts: 14
Location: Bangalore

PostPosted: Tue May 19, 2009 5:54 pm
Reply with quote

In an assembler program why does a DC H'0' result in a S0C1 abend?
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Tue May 19, 2009 6:21 pm
Reply with quote

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
View user's profile Send private message
paramita

New User


Joined: 06 Mar 2005
Posts: 14
Location: Bangalore

PostPosted: Tue May 19, 2009 6:32 pm
Reply with quote

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
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Tue May 19, 2009 6:45 pm
Reply with quote

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
View user's profile Send private message
paramita

New User


Joined: 06 Mar 2005
Posts: 14
Location: Bangalore

PostPosted: Tue May 19, 2009 6:49 pm
Reply with quote

Thanks!
Back to top
View user's profile Send private message
MBabu

Active User


Joined: 03 Aug 2008
Posts: 400
Location: Mumbai

PostPosted: Wed May 20, 2009 5:17 am
Reply with quote

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
View user's profile Send private message
paramita

New User


Joined: 06 Mar 2005
Posts: 14
Location: Bangalore

PostPosted: Wed May 20, 2009 12:42 pm
Reply with quote

Thanks MBabu.
Back to top
View user's profile Send private message
paramita

New User


Joined: 06 Mar 2005
Posts: 14
Location: Bangalore

PostPosted: Wed May 20, 2009 2:15 pm
Reply with quote

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
View user's profile Send private message
MBabu

Active User


Joined: 03 Aug 2008
Posts: 400
Location: Mumbai

PostPosted: Thu May 21, 2009 12:29 am
Reply with quote

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
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Thu May 21, 2009 2:54 am
Reply with quote

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:
Code:
          CALL 'CANCEL'
will work.
Back to top
View user's profile Send private message
paramita

New User


Joined: 06 Mar 2005
Posts: 14
Location: Bangalore

PostPosted: Thu May 21, 2009 1:18 pm
Reply with quote

MBabu and Marso, thank you for the explanation.
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 771
Location: Germany

PostPosted: Thu May 28, 2009 5:26 pm
Reply with quote

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
View user's profile Send private message
paramita

New User


Joined: 06 Mar 2005
Posts: 14
Location: Bangalore

PostPosted: Tue Jun 02, 2009 1:49 pm
Reply with quote

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
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 771
Location: Germany

PostPosted: Tue Jun 02, 2009 2:13 pm
Reply with quote

@ 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
View user's profile Send private message
paramita

New User


Joined: 06 Mar 2005
Posts: 14
Location: Bangalore

PostPosted: Tue Jun 02, 2009 2:51 pm
Reply with quote

UmeySan,

Good Morning and thanks for the clue.

PS: I am female. :-)
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts Using API Gateway from CICS program CICS 0
No new posts ISAM and abend S03B JCL & VSAM 9
No new posts DB2 Event passed to the Application P... DB2 1
No new posts How to pass the PARM value to my targ... COBOL Programming 8
No new posts REXX code to expand copybook in a cob... CLIST & REXX 2
Search our Forums:

Back to Top