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?

Answers were Sorted based on User's Feedback



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

Answer / suersh ramaiyan

Use REDEFINE.

Example:

01 NUMBER-X PIC X(10).
01 NUMBER-N REDEFINES NUMBER-X
PIC 9(10).

COMPUTE A = NUMBER-N + B

This will surely work.

Is This Answer Correct ?    6 Yes 0 No

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

Answer / anonymous

You cant perform any arithmetic operationon alphabetic and
alphanumeric data items . If u try to perform u ll get SOC7.

Is This Answer Correct ?    2 Yes 0 No

Post New Answer

More COBOL Interview Questions

How can i write a comp-3 variable into a sequential file should i declara the field in the file description as comp- 3?

1 Answers  


Hi pls anybody tell me about " ANALYSIS DOCUMENT PREPARATION AND ESTIMATION OF TASK " (in real time project)."I want to update a sequential file in my project" for that purpose i need both structures i mean analysis document and estimation of task.

0 Answers  


What is the linkage section?

4 Answers  


in how many mode we can open a file ?

4 Answers  


1.What is the default print format in cobol?

5 Answers   HSBC,


01 a pic s9(5) value -12345, if we disply a , the sign will overpunched with last digit but i need to get the miuns sign in the result?

7 Answers  


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

0 Answers  


What is sqlca and why is it needed in any cobol-db2 program?

1 Answers  


How do you define a variable of COMP-1? COMP-2?

3 Answers  


where will u code file status ?

2 Answers   TCS,


there is a file whose ORGANISATION is INDEXED.you want to read the records from the file in RANDOM fashion as well as sequentially.then which of the access mode would you specify? a.SEQUENTIAL b.RANDOM c.DYNAMIC D.ACCESS MODE has nothing to do with it

3 Answers   TCS,


how many bytes does a s9(12)COMP-4 field occupy?? a.2 b.4 c.8 d.1 ans with reason please

2 Answers  


Categories