View previous topic :: View next topic
|
Author |
Message |
dilip_bangalore
New User
Joined: 29 Sep 2011 Posts: 27 Location: India
|
|
|
|
Hi,
I have a move statement, which moves the alphabets to Numeric field, but still the program finishes without any abend.
01 WS-A PIC X(10).
01 WS-B PIC 9(10).
Move 'ABCDEFGHIJ' TO WS-A.
MOVE WS-A TO WS-B.
DISPLAY 'WS-A :', WS-A.
DISPLAY 'WS-B :', WS-B.
Result of the above code
ABCDEFGHIJ
ABCDEFGHI1
Kindly clarify why am not getting S0C7 abend here.
Kind regards,
Dilip |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Kindly read the similar topics in this forum. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
it appears that there is a contest for the stupidest question asked the most times.
there is a thread within the last week with nearly the same title.
read the thread, read the description for abends,
read the manual. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Maybe to shed some light on why the same question gets asked so often.
Dilip, why do you think it should have abended? |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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. |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
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. |
|
Back to top |
|
|
dilip_bangalore
New User
Joined: 29 Sep 2011 Posts: 27 Location: India
|
|
|
|
@ 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.
Kind regards,
Dilip |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Your training/education and understanding are most incomplete. . .
As others mentioned, read the entire other topic and if you find something that is not clear, post what you found and your doubt.
There is no reason to regurgitate the same info here when you can more easily read it for yourself. Had you done so originally, there would have been no need to re-post this duplicate. . . |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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. |
|
Back to top |
|
|
|