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

whn do i get soc7 abend while moving alphanumeric to numeric or while moving numeric to aplhanumeric please reply ASAP?

9 Answers  


System Testing for Mainframe Developers What is System Testing? integration testing ? what's the procedure ..

0 Answers   Amdocs,


When would you use in-line perform?

2 Answers  


What is the Purpose of POINTER Phrase in STRING command

3 Answers  


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

2 Answers   IBM, TCS, Wipro,






can i use multiple when statements in search & search all ? justify ur answer?

2 Answers  


How many types of sorts are there in cobol?

5 Answers   Cap Gemini,


what is the basic concept of mainframe? what knowledge is needed for learn this mainframe?

4 Answers   CSE, TCS, Wipro,


can any one help -s806

6 Answers  


how would find total records in files using seqientional

1 Answers   HSBC,


TO abend the data sholud open in which mode? 1.new 2.old 3.mod 4.shr

1 Answers   MNC,


Can you please let me know the centre name of INS certification in Kolkata.

0 Answers  


Categories