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
 

 

Expecting SOC7 to occur but not

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

New User


Joined: 03 Oct 2008
Posts: 25
Location: chennai

PostPosted: Fri Jan 20, 2012 5:06 pm    Post subject: Expecting SOC7 to occur but not
Reply with quote

Hi,

I have following variable declaration -
01 WS-S.
03 WS-NUM PIC S9(2) COMP-3 VALUE ZEROES.
03 WS-CHAR PIC X(2) VALUE 'AB'.

i have run the below piece of code -
MOVE WS-CHAR TO WS-NUM
DISPLAY WS-NUM
ADD +1 TO WS-NUM
DISPLAY 'CHAR :' WS-CHAR
DISPLAY 'NUM1:' WS-NUM
STOP RUN
.
I'm expecting SOC7 to occur since i'm doing arithmetic operation with the non-numeric data.
But i got the following output -
12
CHAR :AB
NUM1:13

Please explain.
Thanks,
Suma
Back to top
View user's profile Send private message

Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1534
Location: Andromeda Galaxy

PostPosted: Fri Jan 20, 2012 5:21 pm    Post subject:
Reply with quote

Please search the forum before posting

DISCUSSED MANY TIMES

http://ibmmainframes.com/viewtopic.php?t=56322&highlight=s0c7

http://www.ibmmainframes.com/viewtopic.php?t=51115&highlight=s0c7


Moderators Please lock it
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: Fri Jan 20, 2012 6:57 pm    Post subject: Reply to: SOC7
Reply with quote

Review the "POPS" (Principles of Operation) manual and find exactly what an Assembler "PACK" instruction does.

You'll then understand why "AB" becomes 12, add 1 and you end up with 13.

The following link should suffice -

http://publibfp.boulder.ibm.com/epubs/pdf/dz9zr006.pdf

Mr. Bill
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Fri Jan 20, 2012 7:15 pm    Post subject:
Reply with quote

suma_infy wrote:
I'm expecting SOC7 to occur since i'm doing arithmetic operation with the non-numeric data.


the above is not true.

only if a source has non/numerics.

and as you proved yourself, the numeric fields contain numeric data.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Fri Jan 20, 2012 7:39 pm    Post subject:
Reply with quote

If you use the SEARCH function on this forum, and use airthmetic non-numeric as your search values, and restrict only to the COBOL forum -- you get 227 returned hits. This topic has been discussed many, many, many times before. Your lack of knowledge about COBOL variables and internal formats indicates you need to spend time reading the COBOL Language Reference and Programming Guide manuals (link at the top of this page).
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7306

PostPosted: Fri Jan 20, 2012 11:57 pm    Post subject: Re: SOC7
Reply with quote

suma_infy wrote:
Hi,

I have following variable declaration -
01 WS-S.
03 WS-NUM PIC S9(2) COMP-3 VALUE ZEROES.
03 WS-CHAR PIC X(2) VALUE 'AB'.

i have run the below piece of code -
MOVE WS-CHAR TO WS-NUM
DISPLAY WS-NUM
ADD +1 TO WS-NUM
DISPLAY 'CHAR :' WS-CHAR
DISPLAY 'NUM1:' WS-NUM
STOP RUN
.
I'm expecting SOC7 to occur since i'm doing arithmetic operation with the non-numeric data.
But i got the following output -
12
CHAR :AB
NUM1:13

Please explain.
Thanks,
Suma


Why would you want to move PIC XX to COMP-3 PIC S99? I've never felt the need to do that.

If I had a PIC XX that should contain a numeric which I want to MOVE to a numeric field, I'd redefine it as PIC 99, test it for NUMERIC and do the move with that.

If you don't do something to deal with it properly, using the NUMERIC test, you will potentially give yourself problems which, at best, will give a S0C7, but at worst will just infect your system with rubbish data which, after you've done the MOVE, looks just like any other number and which may become difficult to track back to the original value for problem determination.

I hope nobody coded anything like that thinking "if it isn't numeric, we'll get a S0C7, so it's OK". If they did, you could well have a long search trying to identify the rubbish.

If you have to embark on the search, it is important to know the implications for your data of the compiler options NUMPROC(NOPFD) and NUMPROC(PFD) (or NUMPROC(MIG) in less-likely cases).
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