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?



I have a field with data type X(10). I want to perform arithmetic operation on this field? I tried..

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

Post New Answer

More COBOL Interview Questions

How many times the loop runs here 01 a pic 9(2) value 10. perform para1 a times stop run. para1: move 20 to a.

3 Answers  


what is scope terminator

2 Answers   IBM,


can anybody post me about file-aid and changemen tools pls and give me reference if any mainframe guys are there

1 Answers  


i want to enter the name 'pandu' into ur table how?

1 Answers   Fidelity,


created cluster using IDCAMS ..that is empty ..when i write a program for read using Input ..wil it open the cluster or gives any error?

2 Answers   HCL,






how to know that the file has 300 records how to acess it?

0 Answers   Hewitt, TCS,


describe 805 error

6 Answers   DELL,


what is the minimum number of lines a Cobol program should have to successfully compile and run

11 Answers   ABC, Societe Generale,


If i got a job on mainframe technology, will i have a bright future?. Some people are discouraging me. Let me know, is it true? Please bring back me from the confusion.

2 Answers  


How can I tell if a module is being called DYNAMICALLY or STATICALLY?

3 Answers   CTS,


how do you define single dimensional array and multidimensional array in your cobol?

0 Answers  


Which is the default, TEST BEFORE or TEST AFTER for a PERFORM statement?

0 Answers  


Categories