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

S0C-7 abend explanation


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Kmr.deepakcs

New User


Joined: 11 Oct 2013
Posts: 37
Location: India

PostPosted: Fri Dec 20, 2013 4:30 pm
Reply with quote

Dear Experts:
This code showing soc-7 but when i exclude s from b. it does not show any abend...please give me info about this....
Code:
 ID DIVISION.                         
 PROGRAM-ID. "DEEPAK".               
 DATA DIVISION.                       
 WORKING-STORAGE SECTION.             
 01 A PIC X(3).                       
 01 B REDEFINES A PIC S9(3).         
 PROCEDURE DIVISION.                 
          MOVE '-1' TO A.             
          ADD 1 TO B.                 
          DISPLAY "VALUE OF A   ",A. 
          DISPLAY "VALUE OF B   ",B. 
          STOP RUN.                   
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7310
Location: Inside the Matrix

PostPosted: Fri Dec 20, 2013 4:50 pm
Reply with quote

You know the code is never going to give a useful answer? Have you gone through the other posts on similar subjects in this forum? Have a look at the code the compiler has generated (compiler options LIST,NOOFFSET).
Back to top
View user's profile Send private message
Naish

New User


Joined: 07 Dec 2006
Posts: 82
Location: UK

PostPosted: Fri Dec 20, 2013 4:53 pm
Reply with quote

When I was young (very young) I would ask such questions on variuos sites/forums to irritate people.. Now I know how it feels.. and the reply I would get from the experts would be to to read the manual which would irritate me icon_smile.gif but, I think that was the best advice I got and now I visit this site to write such comments.

Hope that answers your questions.

Yay! Feels good to be back.
Back to top
View user's profile Send private message
Kmr.deepakcs

New User


Joined: 11 Oct 2013
Posts: 37
Location: India

PostPosted: Fri Dec 20, 2013 5:36 pm
Reply with quote

well THanks bill and naish,
I fully satisfied what you said, that these code irritate..But it also a question.
I need explantaion .
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Fri Dec 20, 2013 5:41 pm
Reply with quote

Quote:
I need explanation

which, as stated, can be found by searching the forum or reading the manual.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Fri Dec 20, 2013 5:41 pm
Reply with quote

Do you know what a S0C7 abend is, and what conditions cause this.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6967
Location: porcelain throne

PostPosted: Fri Dec 20, 2013 6:48 pm
Reply with quote

do not forget, that a display numeric field is handled
(when there is no sign)
the same as x-type.

when a display-numeric field has a sign,
it then adheres to appropriate signed numeric format,
and is stored as such in memory.

start with, what will A contain after moving '-1' to the field?

'202DF1'

I leave it to you to determine the appropriate hex for an S9(3) display field.

since the SEPARATE CHARACTER phrase is not specified
The operational sign is presumed to be associated with the LEADING or TRAILING digit position, whichever is specified, of the elementary numeric data item. (In this instance, specification of SIGN IS TRAILING is the equivalent of the standard action of the compiler.)
for display-numeric data items,
this is termed (old school) as overprint
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1016
Location: Richmond, Virginia

PostPosted: Fri Dec 20, 2013 7:38 pm
Reply with quote

Have you looked at the generated code? I think the option is PMAP (procedure map).

The signed field may be forcing a convert to packed decimal and back, whereas the unsigned field's code does not need that.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7310
Location: Inside the Matrix

PostPosted: Fri Dec 20, 2013 8:22 pm
Reply with quote

We're getting a little lost on this one.

Kmr.deepakcs,

You are using compiler option NUMPROC(NOPFD).

If you add

Code:
       CBL NUMPROC(PFD)


as the first line of your program and recompile, you will discover that you get the abend whether the S is present or not.

Your MOVE of '-1' is just a "string" of value X'60F140'. The 40 appears because the "string" is shorter than the receiving field, so is right-padded with space(s).

When you REDEFINES it as PIC 9(3), if any calculation is done (like ADD 1) then it is absolutely necessary that the left-most low-order half-byte contains one of A-F inclusive.

In the example, said half-byte contains 4. So, abend.

That is, abend with NUMPROC(NOPFD) and S999 or NUMPROC(PFD) and either 999 or S999.

Because you have NUMPROC(NOPFD) the compiler generates code to ensure you have a sign in your unsigned B field before it is used. It is dumb, and it is an easy way to allow rubbish data into your system, but that is the way that it works.

Moral, on input, check that all numeric fields are NUMERIC. If not, reject them. If you don't, with you run the danger of making rubbish look like ordinary data.

NUMPROC(NOPFD) makes this slightly worse by also doing that for data which would otherwise cause an abend, like your example.

PMAP is pre-Enterprise COBOL (Mr Bill may tell us exactly). With Enterprise COBOL, specify LIST,NOOFFSET to get the generated pseudo-assembler listing.
Back to top
View user's profile Send private message
Kmr.deepakcs

New User


Joined: 11 Oct 2013
Posts: 37
Location: India

PostPosted: Fri Dec 20, 2013 9:30 pm
Reply with quote

Thanks, bill
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6967
Location: porcelain throne

PostPosted: Sat Dec 21, 2013 9:16 pm
Reply with quote

signed display numeric without the SEPARATE clause is also called a
zoned decimal. the following chart showing how zoned decimals are stored can be of help.

so, moving '00J' to your x-type field would have been the same as moving -1 (no single quote to form a string [x-type] literal) to the signed display numeric.

as an aside,
i apologize for my error in the earlier post which bill pointed out,
'202DF1'
should have been
'60F140'

20 is an ascii space, 40 is an ebcdic
2D is an ascii subtract, 60 is an ebcdic

managed to get an F1 for an ebcdic 1.
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts ABEND=04E FOR REASON=00E50013 DB2 4
No new posts Any idea about how to solve 3022 aben... IMS DB/DC 3
No new posts Handling abend to prevent termination CICS 0
No new posts Abend deletes last record written ABENDS & Debugging 10
No new posts APCT Abend while running an online CI... CICS 1
Search our Forums:

Back to Top