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
 

 

Regarding SOC7

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
Amb

New User


Joined: 12 Mar 2010
Posts: 64
Location: India

PostPosted: Tue Mar 01, 2011 5:17 pm    Post subject: Regarding SOC7
Reply with quote

Hi Guys,
I want to know this out of curosity.

I have the following code:

Code:
01 VAR4 PIC X(4) VALUE 'ABCD'.
01 VAR5 PIC 9(4) VALUE ZEROES.


MOVE VAR4 TO VAR5   
DISPLAY 'VAR5:' VAR5
ADD 1 TO VAR5       
DISPLAY 'VAR5:' VAR5


The program is compiling and executing without any error
The output that I am getting is:

Code:
VAR5:ABC4 
VAR5:1235


What I am trying to understand is that VAR5 is a numeric variable that contains non numeric data.
When I add one to this variable 'var5', why am I not getting a SOC7 error
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7932
Location: Bellevue, IA

PostPosted: Tue Mar 01, 2011 5:42 pm    Post subject:
Reply with quote

Quote:
What I am trying to understand is that VAR5 is a numeric variable that contains non numeric data.
When I add one to this variable 'var5', why am I not getting a SOC7 error
Nothing in COBOL prevents you from doing what you did -- it is allowed by COBOL.

S0C7 abends are caused when you have non-numeric data in a COMP-3 variable and you have no COMP-3 variables. When you add 1 to your vairable, the variable is packed (so the first four bits of each byte are removed -- in which case an A is the same as a J is the same as a 1 since they have the same last 4 bits -- and unpacked after the addition.

Study the manual!
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


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

PostPosted: Tue Mar 01, 2011 5:47 pm    Post subject: Reply to: Regarding SOC7
Reply with quote

Compile the code (program) using compile options LIST,NOOFFSET,NOOPT and review the Assembler instructions, especially what's generated from the ADD and review what occurs during a PACK instruction.

You'll then see why (using the data provided) all runs OK and why a S0C7 is not raised.

Familiarization with Assembler would be helpful.

Bill
Back to top
View user's profile Send private message
Amb

New User


Joined: 12 Mar 2010
Posts: 64
Location: India

PostPosted: Tue Mar 01, 2011 6:27 pm    Post subject:
Reply with quote

Thanks Robert.

Apologies. I was under the impression that SOC 7 abend can also occur if you try to do an arithmatic operation on a numeric variable that contains non numeric data. I was not aware that this is true only for COMP-3 variables.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Tue Mar 01, 2011 7:15 pm    Post subject:
Reply with quote

numeric variable
and
display numeric variable

are two very, very different things.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7932
Location: Bellevue, IA

PostPosted: Tue Mar 01, 2011 8:31 pm    Post subject:
Reply with quote

Quote:
SOC 7 abend can also occur if you try to do an arithmatic operation on a numeric variable that contains non numeric data.
This is a true statement -- and it tells me you need to read the manual to find out what a numeric variable is (hint: as Dick alluded, USAGE DISPLAY isn't what you think it is).
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 SOC7 abend- How to resolve it sandeep kumar302 COBOL Programming 24 Wed Apr 30, 2014 5:57 pm
No new posts Want a code of SOC7 with out using co... Kmr.deepakcs COBOL Programming 1 Fri Dec 27, 2013 6:47 pm
No new posts Create DDIO file to view the soc7 karthi_ind Compuware & Other Tools 13 Sat Nov 23, 2013 6:56 pm
No new posts SOC7 Numeric Movement dick scherrer COBOL Programming 7 Tue Sep 11, 2012 7:13 pm
No new posts SOC7 ABEND CONTROL IN CICS BACKGROUND... dick scherrer CICS 7 Mon Aug 13, 2012 10:30 am


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