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

Regarding SOC7


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue Mar 01, 2011 5:42 pm
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: 2501
Location: Atlanta, Georgia, USA

PostPosted: Tue Mar 01, 2011 5:47 pm
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
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
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: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue Mar 01, 2011 8:31 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts SOC7 error with DFSORT DFSORT/ICETOOL 9
No new posts SOC7 abend- How to resolve it COBOL Programming 24
No new posts Want a code of SOC7 with out using co... COBOL Programming 1
No new posts Create DDIO file to view the soc7 Compuware & Other Tools 13
No new posts SOC7 Numeric Movement COBOL Programming 7
Search our Forums:

Back to Top