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
 

 

S0C7 with no packed decimal involved !!!

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: S0C7 with no packed decimal involved !!!
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: 8593
Location: Back in jolly old England

PostPosted: Tue Apr 03, 2007 4:57 pm    Post subject:
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: 686
Location: Earth

PostPosted: Tue Apr 03, 2007 5:13 pm    Post subject:
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: 1187
Location: Bangalore,India

PostPosted: Tue Apr 03, 2007 6:15 pm    Post subject:
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: 3158
Location: Tucson AZ

PostPosted: Tue Apr 03, 2007 7:51 pm    Post subject:
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    Post subject: Re: S0C7 with no packed decimal involved !!!
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: 3158
Location: Tucson AZ

PostPosted: Tue Apr 03, 2007 9:08 pm    Post subject: Re: S0C7 with no packed decimal involved !!!
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    Post subject: Re: S0C7 with no packed decimal involved !!!
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    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 READ A PACKED "NEGATIVE" FI... jdesouza CA Products 3 Tue May 02, 2017 11:43 pm
No new posts Joinkeys with decimal scdinesh DFSORT/ICETOOL 3 Fri Feb 10, 2017 4:46 am
No new posts Converting decimal to numeric using I... Balaryan DFSORT/ICETOOL 4 Thu Feb 02, 2017 11:27 pm
No new posts Comparing Decimal and CHAR columns rakesh17684 DB2 7 Thu Oct 20, 2016 2:33 am
No new posts Convert Decimal to hexadecimal Steve Ironmonger DFSORT/ICETOOL 5 Fri May 27, 2016 4:19 pm


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