For the many people who ask this question, here is a link to the z/Architechture Principles of Operation. In the link there is a table, which shows all the "Instructions" which can cause S0C7, data exception. In the table, the column where Dd is shown indicates those which can S0C7, all except the "Test Decimal" instruction (it would be embarassing for someone if that S0C7'd).
If you want to make a S0C7, the first thing you have to do is to use one of those instructions.
In Cobol, the easiest way to use one of these is to do any sort of calculation.
It is possible with a MOVE or an IF, but depends on what the Compiler actually generates for your particular MOVE or IF (depending on Compiler options (esp. NUMPROC), type of fields involved, signed/unsigned).
However Don't just think you can fill up a field with letters, add one to it and you'll get an abend.
Above is a four digit zoned-decimal (PIC 9(5)/S9(5) with default USAGE of DISPLAY).
In the above representation, the Z is the "Zone" half of each byte (except the sign). The N is the "Numeric" part of each byte. The S is the "Sign".
It is entirely irrelevant what the Z's actually contain. You could fill them with chocolate (a little-known extended-OPCODE) and it would not matter. Why? Because they are ignored when you PACK the field to make it PACKED-DECIMAL (Comp-3 in Cobol) which is the format of field that the decimal instructions act upon.
The N half-bytes must be numbers, 0-9. The S half-byte must be letters A-F.
Above is the field after it has been PACKED. In a packed-decimal all the N must be 0-9 and the sign A-F. The reason the DISPLAY has those constraints, is because they are the constraints of the packed format, and the decimal instructions (the only things that can cause S0C7) only act on valid packed formats - otherwise, S0C7.
Now, go through all the other posts in the various topics, and take huge notice of the possibility of rubbish entering your system and then passing itself off as valid numeric data.
Just an additional note on the sign. "A-F? But I thought..." I hear you say.
The decimal instructions will accept A-F as valid "input". All results from decimal instructions will only contain the signs C (indicating positive) and D (negative).
If you want to know more about the NUMERIC test to preserve your system from rubbish data pretending to be numbers, consult your manual for that, for NUMPROC, and compiler installation option NUMCLS. Search in this forum for the same.
When you join a forum you should read the rules - the rules for most fora, and this one is no exception, state that before posting you should search the forum to see if your question has already been answered. There is a search button right at the top to help you with this but even an eyeball search would have found the topic Bill referred to as it is only, currently, 4 or 5 lines below yours.
@ Bill, the main reason why this question was asked is, as per the basics of S0C7 abend, it occurs when there is a numeric operation on a non numeric data, in case of numeric data we are moving non-numeric, in case of numeric comparison we are finding space.
When you move alphabets into a numeric field 9(). then it would abend with s0c7. But it wasn't happening so to get clarified on this, the question was asked.
Please throw some light on this if you have more information.
As Dick indicates, it is difficult to keep answering the same question without simply restating what we have already restated.
[quote="dilip_bangalore[...]as per the basics of S0C7 abend, it occurs when there is a numeric operation on a non numeric data, in case of numeric data we are moving non-numeric [...][/quote]
Look, these are computers we are using. With computers you have to be exact, as they have no minds of their own.
A "numeric operation" in a number of cases cannot give you an S0C7. The "binary" arithmetic, which is "numeric" and has "op-codes" so is "operations" cannot give you a S0C7.
When you narrow down (I've done it for you above) which instructions can give you a S0C7 (and I notice the table misses CVB, but that is another thing) then you can find out the formats that are valid for that type of instruction and discover whethe your data is "numeric" for those instructions. Oh, I already did that above as well.
Read the posts mentioned several times. Read the responses here. Look at the manuals, including the Principles of Operations. Then if there is something you don't understand, explain clearly what that is and we can give you a push in the right direction.