How to define variable 9(20) in COBOL, because compiler
does not allow us to declare variables with Pic 9(18). Can
anyone please let me know the answer... I know one answer
to this question which is to use Compiler option Arith
(Extend) during Compilation. It extends the maximum limit
to 9(32)..Just wanted to know if there is any other way to
extend this?

Answers were Sorted based on User's Feedback



How to define variable 9(20) in COBOL, because compiler does not allow us to declare variables wit..

Answer / abc

try with this:

01 VARIABLE-ABC.
03 VAR-1 PIC 9(18).
03 VAR-2 PIC 9(2).

This may work, please try and see.

Is This Answer Correct ?    10 Yes 1 No

How to define variable 9(20) in COBOL, because compiler does not allow us to declare variables wit..

Answer / vikram

01 VAR-1 PIC 9(18).
change the datatype then it's possible

01 VAR-1 PIC x(20).

Is This Answer Correct ?    1 Yes 0 No

How to define variable 9(20) in COBOL, because compiler does not allow us to declare variables wit..

Answer / dimpy19

try with this:

01 VARIABLE-ABC.
03 VAR-1 PIC 9(18).
03 VAR-2 PIC 9(2).




or
use PROCESS ARITH(EXTEND) before IDENTIFICATION DIVISION

ARITH option syntax

.-COMPAT-.
>>-ARITH(-+-EXTEND-+-)-----------------------------------------><


When you specify ARITH(EXTEND):
The maximum number of digit positions that you can specify in the PICTURE clause for packed-decimal, external-decimal, and numeric-edited data items is raised from 18 to 31.

Is This Answer Correct ?    0 Yes 0 No

How to define variable 9(20) in COBOL, because compiler does not allow us to declare variables wit..

Answer / sachin borase

Use the varchar.

01 var-char-variable.

49 ws-letch s9(4) comp.
49 ws-text 9(20).

Is This Answer Correct ?    2 Yes 9 No

Post New Answer

More COBOL Interview Questions

How to find How Many Lines in Sysin DD * Parameter Thru Cobol Coding? If any one knows the Answer Please Reply .....Thanks From Shree

3 Answers   Merrill Lynch,


If there are two files one with 100 records and other with 101 records. we have to find out the one record that is the odd man out . What are the steps to do it

7 Answers   BirlaSoft,


Size of a column has been changed in DB2 table (Suppose it was of 5 characters and later changed to 4 characters) and forgot to change the DCLGEN in COBOL program, what will happen during the execution of code? If the program Abends then what will be the error? If it doesn't abend then hpw the error can be catched?

5 Answers   IBM,


what is rediffine clause?in what situation it can use?give me real time example?

1 Answers   IBM,


01 a pic x(4) value 'abcd' 01 b pic 9(3) can we move from a to b.if possible what would be stored in b.

15 Answers   ACS,






Hi................... I have records like this aaaa cccc bbbb And i want output like this bbbb cccc aaaa How can it possible ?. Note:Please make sure records are in unsorted order. somebody plzzz help me.

1 Answers  


What is the difference between write & move in COBOL?

3 Answers   CSC, HHB,


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

0 Answers  


write a program to eliminate duplicate records in a input file and send them to output file.

2 Answers   IBM,


What is the default value(s) for an initialize? What keyword will allow for an override of the default?

0 Answers  


if a=b how the flow will complete??? perform test through test-exit. perform activa through activa-exit. test. if a=b then next sentence else move a to c. test-exit. exit. activa. -- -- activa-exit. exit.

1 Answers   IBM,


Explain complete concept of table handling in COBOL with an example?

2 Answers   IBM, TCS, Wipro,


Categories