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

What is difference between comp & comp-4?

6 Answers  


In INITIALIZE what is Repalcing Word will do

1 Answers   CTS,


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

2 Answers   IBM,


what is the maximum error code in mainframe

2 Answers  


have in 100 records in a flat file i want to move records like 1,3,5,7,9,11,.. to Output file1 and 2,4,6,8,10,12,14 .. records moved to Output file2..Pls Provide real time answer..

5 Answers   TCS,


The below is the declaration for a variable ws 01 ws pic 9(3). if you want to insert space how will you do that. in which level u should do it

3 Answers   ADP,


i need a small 3d program using inline and outline.

0 Answers  


Write a program to concert an Indexed file into Sequential file?

1 Answers   Covansys,


What does MAXCC 3 means? It is used in one my codes.

2 Answers   Wipro,


Difference between cobol and cobol-ii?

0 Answers  


What is the meaning of 'TALLING' verb in cobol?

5 Answers  


How do we get current date from system with century?

2 Answers  


Categories