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

Getting SOC7 while adding num value to packed decimal field


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

New User


Joined: 27 Sep 2007
Posts: 14
Location: hyderabad

PostPosted: Tue Nov 06, 2007 1:59 pm
Reply with quote

i am getting soc7 find below screen

==> IF QK-DURBASE-Y = OD-DUR + 2
=>
=> ASRA ABEND (0C7) detected and prevented. Caused by invalid decimal
=> arithmetic data format.
=>
=> Press PF1 for a detailed description.
=>
---------------------------------------------------------
data type declaration for the variables

05 QK-DURBASE.
10 QK-DURBASE-Y PIC S99 VALUE ZERO.

OD-DUR PIC S999 COMP-3.

can any body give me some idea?
Back to top
View user's profile Send private message
vasanthkumarhb

Active User


Joined: 06 Sep 2007
Posts: 275
Location: Bang,iflex

PostPosted: Tue Nov 06, 2007 2:35 pm
Reply with quote

Hi,


A SOC7 is a data exception. It occurs when you try to move a non-numeric data into a numeric data item. Check the data in the (OD-DUR PIC S999 COMP-3. ). You might be getting SOC7 because COMP-3 variable contains PACKED DECIMAL values and the one variable you are adding with contains numeric data.

Any Suggesstion Accepted.
_________________

Regard's
Vasanth..... icon_smile.gif

"Never Give Up Until U Succeed"
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Tue Nov 06, 2007 2:41 pm
Reply with quote

Vasanth,

Quote:
COMP-3 variable contains PACKED DECIMAL values and the one variable you are adding with contains numeric data.

Tell me you are not serious and just joking.
Back to top
View user's profile Send private message
vasanthkumarhb

Active User


Joined: 06 Sep 2007
Posts: 275
Location: Bang,iflex

PostPosted: Tue Nov 06, 2007 2:59 pm
Reply with quote

Hi Murali,


I just want him to check the data either by manually or Exped the variables, He may be getting SOC7 may be due to garbage value in the comp-3 variable.

Just i need to inform him the data format in both the variable types.

That's y i put the words like that, leads in confusion.

with apology

Regard's

Vasanth........... icon_smile.gif

"Never Give up Until u Succeed"
Back to top
View user's profile Send private message
Raphael Bacay

New User


Joined: 04 May 2007
Posts: 58
Location: Manila, Philippines

PostPosted: Tue Nov 06, 2007 3:20 pm
Reply with quote

Hi,

I don't htink it is possible to have an arithmetic operation on a conditional.
Maybe you can just make a temp field

TEMP = OD-DUR + 2
IF QK-DURBASE-Y = TEMP

to avoid the SOC-7



Thanks.
Back to top
View user's profile Send private message
vasanthkumarhb

Active User


Joined: 06 Sep 2007
Posts: 275
Location: Bang,iflex

PostPosted: Tue Nov 06, 2007 3:25 pm
Reply with quote

Hi Raphael,


Do you sure SOC7 is coming due to this reason.

Regard's
Vasanth...... icon_smile.gif
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Tue Nov 06, 2007 4:27 pm
Reply with quote

vasanth,

Quote:
A SOC7 is a data exception. It occurs when you try to move a non-numeric data into a numeric data item.


Moving a non-numeric data to a pic 9 display format field will NOT cause an 0C7. You will get that abend only when you attempt to perform arithmetic operations with the pic 9 field containing invalid data.

If am right this was discussed few days before.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Tue Nov 06, 2007 4:32 pm
Reply with quote

Quote:

don't htink it is possible to have an arithmetic operation on a conditional


I am reasonably sure what you mean, but what you said makes no sense - you are not using the word conditional properly.The IF statement is syntactically correct.

QK-DURBASE-Y and QK-DURBASE both define the same memory, one is numeric and the other is alpha. I would guess that the durbase field contains non-numerics.

but, as said before, either use displays or xpeditor to see what is in the fields, and then determine how the non-numerics ended-up in numeric fields.
Back to top
View user's profile Send private message
vasanthkumarhb

Active User


Joined: 06 Sep 2007
Posts: 275
Location: Bang,iflex

PostPosted: Tue Nov 06, 2007 4:34 pm
Reply with quote

Aaru,


Thank you for the correction.

Regard's
Vasanth.......... icon_smile.gif
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


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

PostPosted: Tue Nov 06, 2007 6:47 pm
Reply with quote

This thread make very clear an important concept:

If you really want to know if something work - try it yourself, or look it up first, rather than relying on others who may not know more than you do.

Conditional statements in almost all languages do allow arbitrarily complicated expressions.

Moving garbage to a packed decimal field is OK (as clarified above) - just don't try to use it.

Packed decimal is numeric, as is binary and display. It's the contents that make it numeric or otherwise, not the form in which it is coded.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Tue Nov 06, 2007 7:39 pm
Reply with quote

Hi PP,

As I recall, a move to a COMP-3 field generates an Assembler ZAP (zero and add packed) instruction.

That's an arithmatic instruction and will cause an 0C7.

Display numeric moves generate an MVC (move char) instruction and this won't cause an 0C7.

And of course, ANYTHING in a COMP field is a valid numeric and won't cause an 0C7.
Back to top
View user's profile Send private message
Sandy Zimmer

Active Member


Joined: 13 Jun 2007
Posts: 826
Location: Wilmington, DE

PostPosted: Wed Nov 07, 2007 1:15 am
Reply with quote

How about - did you initialize your working storage fields at the GROUP level. Group levels are always alpha-numeric.

[I don't htink it is possible to have an arithmetic operation on a conditional.]

I think Raphael is correct. You may want to code it as


[compute ws-temp-fld = QK-DURBASE-Y + 2
on size error, etc - do something imperative]

[/quote][/code]
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Wed Nov 07, 2007 1:26 am
Reply with quote

Sandy Zimmer wrote:
[I don't htink it is possible to have an arithmetic operation on a conditional.]

I think Raphael is correct. You may want to code it as


[compute ws-temp-fld = QK-DURBASE-Y + 2
on size error, etc - do something imperative]

[/code][/quote]

BS
Either QK-DURBASE-Y or OD-DUR contains invalid data.
Back to top
View user's profile Send private message
Sandy Zimmer

Active Member


Joined: 13 Jun 2007
Posts: 826
Location: Wilmington, DE

PostPosted: Wed Nov 07, 2007 1:30 am
Reply with quote

Craq Giegerich,

Yes, "on size error" will catch anything not numeric. Then he will know exactly which field is the problem. Who is BS?
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 Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Adding QMF and SPUFI to the ISPF menu DB2 20
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts Adding first / last acct numerber to ... DFSORT/ICETOOL 7
Search our Forums:

Back to Top