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

In an EVALUATE statement, can I give a complex condition on a when clause?

2 Answers  


give the examples for strings and unstrings in cobol

2 Answers   IBM,


how you read control card into array?

3 Answers   HCL,


I have a table with 3 dimensions like this : 01 ws-table 04 ws-page occurs 3 08 ws-column occurs 2. 12 ws-record occurs 20 pic x(40). How to code with PERFORM varying with 3 dimension...I forgot..

2 Answers   EDS,


How you can read the file from bottom?

0 Answers  






What are the pertinent COBOL commands?

0 Answers   Satyam,


what is the minimum number of lines a Cobol program should have to successfully compile and run

7 Answers  


i friends greetings to the day...!!! I face a quation like"while runnig the programe every day i have to access the previous day updates only...!! Ex:- Let last day 100 customers took bank account i have to select those customers only.."

4 Answers   CSC,


How is sign stored in Packed Decimal fields and Zoned Decimal fields?

6 Answers   ABC, HCL, TCS,


i have two file, each file having : file1 is having 2 fields field1 field2 file2 is having 3 fields field1 field2 field3 my req is to make it one file like: field1 field2 field1 field2 field3 if anyone know please send me syntax, i tried this with DFSORT but could not succeed.

9 Answers   Syntel,


for an INITIALIZE and what keyword allows for an override of the default.

2 Answers  


How to remove the spaces at end of each record in the output file Via COBOL program? note: The file has a VB length

2 Answers   IBM, Wipro,


Categories