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

What are the different data types available in COBOL?

4 Answers  


input:-AABBCCDDEFGHIIJ output:- ABCDEFGHIJ Here in input we hav the duplicate characters i.e repeating characters.SO we should eliminate the duplicate characters and should display the output in ascending order.

6 Answers  


Can a Search can be done on a table with or without Index?

0 Answers  


i friends greetings to the day...!!! I face a quation like"while runnig the programe every day i have to access the previous day updates only...!! Ex:- Let last day 100 customers took bank account i have to select those customers only.."

4 Answers   CSC,


please..could u give an example about USAGE IS POINTER ..and explain why and when we use it ?

0 Answers   EDS,






Name the sections present in data division.

0 Answers  


how to display the dataset information?

2 Answers  


What are the access modes of START statement?

0 Answers  


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

0 Answers   Hewitt, TCS,


Explain the difference between an internal and an external sort, the pros and cons, internal sort syntax etc.

3 Answers  


How to pass return codes from cobol to jcl?

5 Answers  


what is jcl approach for programming?

4 Answers   IBM,


Categories