i declare a Table as OCCURS 2000 TIMES.If the input file
has more than 2000 records will the COBOL program fail?

Answers were Sorted based on User's Feedback



i declare a Table as OCCURS 2000 TIMES.If the input file has more than 2000 records will the COBOL..

Answer / giri

No. Program will not fail

Is This Answer Correct ?    14 Yes 0 No

i declare a Table as OCCURS 2000 TIMES.If the input file has more than 2000 records will the COBOL..

Answer / vidhya

If you compile the Program using SSRANGE = Y then the,
program will fail, if not the program will not fail.

Is This Answer Correct ?    14 Yes 0 No

i declare a Table as OCCURS 2000 TIMES.If the input file has more than 2000 records will the COBOL..

Answer / giri

Veena, as far as I knw, An OCCURS clause is used to
indicate the repeated occurrences of items of the same
format in a structure. It is nothing to do with the number
of records in the file. As per your question the filed
which you declare in the table occurs 2000 times. And this
is not the number of record. So your program will read all
the records in the input file. You can display any
occurance of the field like FIELD-NAME(1998) will result in
the value stored in that position, i mean to say 1998th
occurance. When you try to read beyond 2000,the program
will abend with SOC4. I hope I have cleared your doubt!

Is This Answer Correct ?    11 Yes 0 No

i declare a Table as OCCURS 2000 TIMES.If the input file has more than 2000 records will the COBOL..

Answer / cobol will never die

I don't know how one can answer given the lack of
specificity of the question but.... Are we assuming all
records are loaded into the table and no check is made if
the index or subscript is > 2000? In other words are we
loading more than 2000 records data into the program? Can
we also assume this record has numeric definitions?

Given this scenario, and also given the executable code has
no knowledge of a symbolic copybook layout a S0C7 will not
occur as long as the data in the records being loaded is
wholesome. A S0C7 will occur, however, if any of any
numeric data item is corrupted by the overflow, then
referenced by any one of a dozen instructions.

Is This Answer Correct ?    7 Yes 0 No

i declare a Table as OCCURS 2000 TIMES.If the input file has more than 2000 records will the COBOL..

Answer / prem

Occur clause is a kind of an array which holds the data of
simalar type in a particular record.
Ex: If we define an occur clause which hold the marks of a
particular student scored in 3 subjects. The code for this
would be as mentioned below

01 Student.
02 Name PIC X(20).
02 MARK OCCURS 3 times PIC 9(03).

So, For a Student "A" marks would be stored in MARK[1], MARK
[2], MARK[3], for "B" MARK[2], MARK[2], MARK[2] likes wise.

In a record format it would be displayed as below
A___________________052060080

B___________________060068070

Total length of the record is 20 + (3*3) = 29

This code will process n number of records no matter what
is the size of occur clause but if the length of the
records is beyond 29 then only the job will abend.

I hope this answers your query.

Is This Answer Correct ?    5 Yes 0 No

i declare a Table as OCCURS 2000 TIMES.If the input file has more than 2000 records will the COBOL..

Answer / veena

Thanks for the reply ..then will all input file records get
processed or only first 2000 records be processed?

Is This Answer Correct ?    3 Yes 0 No

i declare a Table as OCCURS 2000 TIMES.If the input file has more than 2000 records will the COBOL..

Answer / sivakumar sekharannair

Yeah vidhya's answer is correct. If the complier option is
set with SSRANGE=Y then the program will fail. Other wise
it will not... the default option is NOSSRANGE...

Is This Answer Correct ?    2 Yes 0 No

i declare a Table as OCCURS 2000 TIMES.If the input file has more than 2000 records will the COBOL..

Answer / veena

But when i tested with more than 2000 records it not
abending.all input records are process and written to
output file.Thats why i am confused.

Is This Answer Correct ?    0 Yes 0 No

i declare a Table as OCCURS 2000 TIMES.If the input file has more than 2000 records will the COBOL..

Answer / sadaf rehan

Table OCCURS Clause has nothing to do with the number of
records in the input file..
if you are reading sequentially all the records will get
processed..

Is This Answer Correct ?    0 Yes 0 No

i declare a Table as OCCURS 2000 TIMES.If the input file has more than 2000 records will the COBOL..

Answer / kingmanish

Its in our hands whether we want the program to abend in
case of data overflow or not.
If we specify SSRANGE = Y the program will abend when the
number to records go beyond 2000.

Otherwise for NO SSRANGE the program will not abend.
Though that data will be lost as we cannot reference it.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More COBOL Interview Questions

What is diff between vsam and db2?what is advantage of db2 over vsam?which is best suited one?

1 Answers   Fidelity,


Consider the following: 77 A PIC 9(10) 77 B PIC 9(10) 77 C PIC 9(19) MULTIPLY AB BY B GIVING C Which of the following is true ? (a) The execution of the above may result in size error. (b) The execution of the above will result in size error. (c) The definition of C is invalid resulting in compilation error. (d) No error will be thee and the program would proceed correctly.

4 Answers   TCS,


write a program to eliminate duplicate records in a input file and send them to output file.THIS IS IGATE RECENT QUESTIONN.....JUST 1 WEEK BACKKKK...

5 Answers   iGate,


COMP-3 field occupy ?

8 Answers  


INREC AND OUTREC? HOW TO SPLIT 5K RECORDS TO DIFFERENT FILES IN A FILE IN COBOL? RESTART IN COBOL-DB2? ISOLATION LEVELS?

0 Answers  






explain sorting techniques in cobol program?

0 Answers  


I try to use some column names in my cobol progorm but these column not in db2 table ..when do i get error ..while bind time or runtime?

2 Answers  


Can we use icetool in cobol program?

3 Answers  


In A cobol program , we can use COPY Statement in FILE- SECTION / WORKING-STORAGE SECTION / ENVIRONMENT DIVIION basically what is the difference

3 Answers   IBM,


study the following 01 A PIC 99V0 VALUE 5 01 B PIC 9V9 VALUE 6 01 C PIC 99V9 VALUE 2.5 01 D PIC 99 VALUE 3 COMPUTE A ROUNDED B C = A+B*C/D ON SIZE ERROR PERFORM PRINT-ERROR the comments of A.B.C after execution of the above statement are a.A=10 B=0 C=10 b.A=10 B=9.9 C=9.9 c.A=10 B=0 C=9.9 d.A=10 B=6 C=10

4 Answers   TCS,


Can the OCCURS clause be at the 01 level?

2 Answers  


C1 C2 C3 are three conditions whose TRUTH values are as folloes. C1-TRUE C2-FALSE C3-TRUE A,B,C are defined as given below A:C1 AND(NOT C2) OR C3 B.(NOT C1) OR (NOT C2 AND NOT C3) C.(C1 OR C2)AND C3 D.C1 AND C2 OR C3 given the above information which of the following statements are valid? a.only A,B and C are TRUE b.only A,C and D are TRUE c.A,B,C and D are TRUE d.only C and D are TRUE

1 Answers   TCS,


Categories