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

S0C7 with no packed decimal involved !!!


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

New User


Joined: 07 Jan 2006
Posts: 31

PostPosted: Tue Apr 03, 2007 4:52 pm
Reply with quote

Hi All,

I was testing this piece of code and am hit with a S0C7 ABEND.
I was trying to justify the same but failed to do so. My understanding is that S0C7 occurs ONLY when Packed Decimal values are involved.

Code:
01 WS-VAR1.                     
   05 WS-VAR2          PIC X(2).
   05 WS-VAR3 REDEFINES WS-VAR2.
      10 WS-VAR4         PIC 99.

MOVE SPACES TO WS-VAR2       
EVALUATE TRUE               
     WHEN WS-VAR4 = 14   
          DISPLAY "OK"       
     WHEN OTHER               
          DISPLAY "NOT OK"   
 END-EVALUATE             



Help me out Please !!!

Thanks,
Raveendra.[/code]
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Tue Apr 03, 2007 4:57 pm
Reply with quote

Not being a programmer, I'd hazard a guess that the field WS-VAR4 does not contain numeric data.
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Tue Apr 03, 2007 5:13 pm
Reply with quote

'Program attempting to do math on illegal data'. This is the reason why you got s0c7. icon_smile.gif
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Tue Apr 03, 2007 6:15 pm
Reply with quote

Hi There,

You have niether initialized WS-VAR4 nor move any numeric value to WS-VAR4 that why it's contain junk data & giving SOC7
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Tue Apr 03, 2007 7:51 pm
Reply with quote

Since you compare a numeric field against a numeric literial, the compiler generated a compare packed instruction for the test. That required a pack instruction for the data.
Possibly if you did "WS-VAR4 = '14'" instead, the compiler might generate a simpler character compare.....
Back to top
View user's profile Send private message
raveendra_ibm
Currently Banned

New User


Joined: 07 Jan 2006
Posts: 31

PostPosted: Tue Apr 03, 2007 8:46 pm
Reply with quote

Thanks "expat", Abhijit and Ekta for your replies....

And thank you William, you could identify the area of my concern.

Does the compiler generate a packed instruction for all the "compare" operations ? i.e, numeric field against numeric literal, numeric field against another numeric field..etc.

I tried replacing the numeric literal with a numeric field and again got a S0C7... On the other hand changing the numeric literal to a character ( '14' ), was successful ....

Could you please explain what are all the scenarios wherein the compiler generates a packed instruction for compare...

Thanks.
Raveendra.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Tue Apr 03, 2007 9:08 pm
Reply with quote

raveendra_ibm wrote:
Does the compiler generate a packed instruction for all the "compare" operations ? i.e, numeric field against numeric literal, numeric field against another numeric field..etc.
Yes
Quote:
I tried replacing the numeric literal with a numeric field and again got a S0C7...
Of course. "numeric field against another numeric field"
Quote:
On the other hand changing the numeric literal to a character ( '14' ), was successful ....
Since the variable was zoned decimal (display), comparing characters was the only way to go against an alpha-numeric literal
Quote:
Could you please explain what are all the scenarios wherein the compiler generates a packed instruction for compare...
Anytime numeric operations go against comp-3 or display numeric, it will be done with packed instructions
Back to top
View user's profile Send private message
raveendra_ibm
Currently Banned

New User


Joined: 07 Jan 2006
Posts: 31

PostPosted: Tue Apr 03, 2007 9:38 pm
Reply with quote

Thanks a lot William !!!

It was indeed helpful .....

Regards,
Raveendra.
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 PD not working for unsigned packed JO... DFSORT/ICETOOL 5
No new posts Def PD not working for unsigned packe... JCL & VSAM 3
No new posts Need Help with Packed Decimal Signs DFSORT/ICETOOL 4
No new posts S0C7 - Field getting overlayed COBOL Programming 2
Search our Forums:

Back to Top