I have a field with data type X(10). I want to perform
arithmetic operation on this field? I tried doing it by
moving the value into a numeric field. but it didn't work
out. I am getting a S0C7 abend. Pls let me know if there is
any way of getting this done?
Answer / quasar chunawala
You cannot perform Arithmetic Operations on Textual
Character Data.
01 WS-TEXT PIC X(02) VALUE '15'.
ADD +1 TO WS-TEXT
This is a S0C-7(Data Exception in COBOL).
If you still want to acheive this effect, I suggest you do
it this way -
01 WS-TEXT PIC X(02) VALUE '15'.
01 WS-NUMBER REDEFINES WS-TEXT PIC 9(02).
ADD +1 TO WS-NUMBER
| Is This Answer Correct ? | 10 Yes | 0 No |
What is the maximum data length for Numeric DataType ?
What is the local-storage section?
How to pass return codes from cobol to jcl?
What is the default value(s) for an initialize and what keyword allows for an override of the default?
77 I pic 99 value 5 Perorm para-A I times. Para -A. move 10 to I. How many times the para-A will be executed.?
What is EIBCALEN? Why it is used?
Can we use goto statement in inline_perform ?
01rec1. 05 a pic 999v99 value 123.12 05 b pic 99v9 value 45.9 02 rec2. 05 x pic 999v99 05 y pic 99v99 05 z pic x(3) value 'abc' if rec1 is moved to rec2 then what is the value of rec2?
How to find out the closest prime number of an input number? I believe it has something to do with SEARCH and COBOL Linear Array.
Can we move SPACES to numeric field and ZEROES to alphabetic field? If yes what are the way doing this?
COMP field occupy ?
i want to learn mainframes. i completed MCA ,whats the future of mainframes