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 to access vsam files in cobol and how to differentiate that this is ESDS file

1 Answers   EDS,


wht is the difference between goto and perform stmts

7 Answers   DELL,


How to retain the Duplicates in the one records?

3 Answers   CS,


How can you get the ksds file records into your cobol program?

0 Answers  


how do you move only numeric data from A to B 01 A pic x(10) value 'a1b2c34d5e'. 01 B pic x(5).

2 Answers   DELL, Mind Tree,






Can we put move statement in COBOL copybook

3 Answers   Global Logic,


How to read the last 100 records from a COBOL file. The file contains N number of records.

11 Answers   IBM,


What are the access modes of START statement?

0 Answers  


What is "Call by content" and "call by reference"?

4 Answers   ADP, Syntel,


What is the difference between structured cobol programming and object alternativelyiented cobol programming?

0 Answers  


what happens if parmparameter passes zero bytes to the program

0 Answers   HSBC,


how do u list the abended jobs?

1 Answers   IBM,


Categories