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

In file1 have 80 records are like d1,d2,d3......D80. File2 have 1000records are like a1d1,a1d2,a3d3.....Etc. I want matching records in file3 ? Plse tell me the matching logic???I want answer only in cobol ?Not using any tool or jcl?

1 Answers   CSC,


how we can edit records in vsam data set and non vsam data sets

2 Answers   ACS,


i am a btech cs 2009 passout. i am opting for mainframe course. is it good to do this course? pls. anyone suggest me

4 Answers  


Can we use icetool in cobol program?

3 Answers  


why 02 level number can't be use as a separate level number like 01 or 77 ?

3 Answers  






u have passed sme charecters thru parm parameter in jcl. how do u code in cobol to recieve the values u gave in parm ?

2 Answers   IBM,


WT R TECHNICAL MAINFRAME QUESTION ASKED IIN ANJANASOFTEARE??

1 Answers  


What are differences between Static Call and Dynamic Call?

10 Answers   IBM, KBC, Keane India Ltd, Verizon,


DATAONLY, MAPONLY functionality?

1 Answers   IBM,


wht is the diff b/w if and evaluate stmts ?

2 Answers   DELL,


Mention the guidelines to write a structured cobol program?

0 Answers  


How you can delete a record from a ps file in cobol?

1 Answers  


Categories