Page 1 of 1

Regarding SOC7 or SOC 's

PostPosted: Tue Aug 14, 2012 10:30 am
by kandrepavan
Hi All,

Please can any one post a code for getting soc7 error in sample cobol program(in detail).
Please execute and post it.

Thanx and regards.
pavan

Re: Regarding SOC7 or SOC 's

PostPosted: Tue Aug 14, 2012 10:53 am
by NicC
Why not try yourself. If you want us to do your work for you, how much are you prepared to pay us?

PostPosted: Tue Aug 14, 2012 11:25 am
by kandrepavan
Hi All,

I tried ...but i could not..get....
and will you reply if u are paid .....? then please dont reply to any ones post
Thanx in advance
pavan

Re: Regarding SOC7 or SOC 's

PostPosted: Tue Aug 14, 2012 11:27 am
by NicC
Yup, send me the money and I will code up a job that will do the necessary and mail you the results. But it will be a LOT cheaper to google s0c7, as I did just now, and read some of the links.

Re: Regarding SOC7 or SOC 's

PostPosted: Tue Aug 14, 2012 12:19 pm
by Monitor
The 0C7, Data Exception, is normally not a programming error. Data from files or databases are not in the format that the program expects.
So, any program is a candidate for a 0C7-abend.
Read on as suggested.

Re: Regarding SOC7 or SOC 's

PostPosted: Tue Aug 14, 2012 1:39 pm
by Monitor
Here is a free one!

Identification Division.                       
Program-Id. ABEND0C7.                           
Data Division.                                 
Working-Storage Section.                       
01 TheData.                                     
   05 TheCharacter   Pic X(02) Value 'A'.       
   05 TheNumber      Redefines TheCharacter     
                     Pic 9(02) Packed-Decimal. 
Procedure Division.                             
    Add 1 to TheNumber                         
    GoBack                                     
    .                                           

Re: Regarding SOC7 or SOC 's

PostPosted: Tue Aug 14, 2012 2:41 pm
by BillyBoyo
pavan,

To get a Data Exception, you need to arrange that an instruction which can create one is used.

If you do some research, you should get to references in the Principles of Operation which gives you a fairly short list of assembler instructions that can cause a S0C7. If you have trouble finding the list, search the document for CVB.

All the instructions relate to packed-decimal data, so a packed-decimal (aka COMP-3) data definition is a good candidate to start with.

You then need to know what will cause the S0C7.

You should discover that all the "digits" part must be between 0 and 9, in each hafl-byte, and that the right-most half-byte contains the "sign" and should also have a specific valid value.

However, the thing about the "sign" is not the end of the story, as the Enterprise Cobol compile option NUMPROC comes into it (if you have a different mainframe Cobol, it is a different option).

If you want to go with Monitor's example, make sure you have NUMPROC(PFD).

Also another Cobol thing is the treatment of signed and non-signed data. If you look for references to "sign fixing" and "sign rectification" you'll start to get some idea of what goes on there. Don't worry if you don't understand everything at once, but there will be occasions you'll say to yourself "why didn't that abend?" or "why did that abend?" and then you'll have some ideas about what to consider.

A more secure way to obtain a S0C7 is to forget the sign and go for the digits part.
    01 TheData.                                     
       05 TheCharacter   Pic X(02) Value '.A'.       
       05 TheNumber      Redefines TheCharacter     
                         Pic S9(03) Packed-Decimal.


I've made a couple of changes to Monitor's definition. I've change the value to ".A" from "A ". In hex this should show you "4BC1" where the B, C and 1 (in the sign) are all potential S0C7 causers. NUMPROC might "mess you about" with the "1", but the B and the C will either of them in those positions definitely abend 100% of the time. I've also made the redefinition signed and made the field size an exact match.

PS. Don't think you can just copy and paste all that I have written above and put it into your homework. This is an explanation of how to find out the detail, not of the detail itself. If you want to post what you discover from your research and any questions you have on that, you'll receive appropriate clarifications.

PPS. I also think it would lead you to far more detail than is required for your assignment. It could easily take a couple of years to comprehend all the information you get to, so for now get a grip on the "numeric" in the numeric part, "valid sign" in the sign part, and be aware that NUMPROC can upset your thoughts about the sign, so go with clobbering something in the numeric part.

Re: Regarding SOC7 or SOC 's

PostPosted: Tue Aug 14, 2012 7:02 pm
by dick scherrer
Hello,

Regarding SOC7 or SOC 's
If you want to force an S0CB, divide some valid number by zero . . .