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 Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

which is Best IBM Mainframe Training and Placement Institute in Ameerpet Hyderabad

1024


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

682


Write a program to explain size error.

678


What are declaratives and what are their uses in cobol?

714


Why would you use find and get rather than to obtain?

693






What is the LINKAGE SECTION used in COBOL?

895


What happens when we move a comp-3 field to an edited (say z (9). Zz-)?

780


How to get the last record in vsam file in cluster? And how can you get the ksds file records into your cobol program?

650


Write some characteristics of cobol as means of business language.

622


What is rmode(24)

683


What is inspect in cobol ?

806


What are the different rules to perform a Search?

619


What is link edit in cobol?

775


How to traceback if I am getting SOC7 or SOC4 abend? List down the steps

1031


I have program P1 which calls file F1 which has 100 records and following structure 001 .................. 002 .................. 003 .................. 098 .................... 099 ................... 100 .................... Now I want to read these files and write these records in file F2 in following manner. 001 ...... 051 ..... 002 ...... 052 ..... 003 ...... 053 ..... .......... ....... .......... ....... .......... ....... 048 ........ 098 ...... 049 .......... 099 ....... 050 .... 100 ......

10638