Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

S0C-7 abend explanation

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: S0C-7 abend explanation
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Fri Dec 20, 2013 4:50 pm    Post subject: Reply to: soc-7 abend explanation
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    Post subject: Reply to: soc-7 abend explanation
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    Post subject:
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: 1715
Location: UK

PostPosted: Fri Dec 20, 2013 5:41 pm    Post subject:
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: 8593
Location: Back in jolly old England

PostPosted: Fri Dec 20, 2013 5:41 pm    Post subject:
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: 6966
Location: porcelain throne

PostPosted: Fri Dec 20, 2013 6:48 pm    Post subject:
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

Active Member


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

PostPosted: Fri Dec 20, 2013 7:38 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Fri Dec 20, 2013 8:22 pm    Post subject: Reply to: soc-7 abend explanation
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    Post subject:
Reply with quote

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

Global Moderator


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

PostPosted: Sat Dec 21, 2013 9:16 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts IMS BMP program causes 878 system abend Artemk IMS DB/DC 7 Tue Nov 22, 2016 8:26 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm
No new posts hot to get details when "EXEC CI... Andi1982 CICS 11 Tue Sep 20, 2016 5:01 pm
No new posts S213-14 ABEND explantion Apurva Mehta JCL & VSAM 5 Thu Jul 07, 2016 10:56 pm
No new posts How to determine where is error in ab... jackzhang75 PL/I & Assembler 13 Fri Apr 15, 2016 2:01 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us