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 rules are followed by the search verb.

0 Answers  


Identify the invalid dataname from the following: (A) savings-account (B) annual-allocation-for-overhead (C) samount250 (D) 12demand

4 Answers   TCS,


We have 3 programms A,B,C.In the middle of the program A the controls goes to program B and in the middle of the program B control wants to go program C,after completion of program C again control comes to program B and again after completion of program B control comes to program A.How the process will takes and what are the controls we use for that process.If it is possible anybody of you explain with example?

5 Answers   IBM,


Explain Restart Logic in Cobol?

1 Answers   L&T, Syntel,


01rec1. 05 a pic 999v99 value 123.12 05 b pic 99v9 value 45.9 02 rec2. 05 x pic 999v99 05 y pic 99v99 05 z pic x(3) value 'abc' if rec1 is moved to rec2 then what is the value of rec2?

5 Answers   Amdocs,






when iam reading a flat file which has 100 records through cobol program when iam reading 50th records it gets abends .. so when i run the program again it should read from 50th record .where it got abened ? how it is possible

1 Answers   Patni,


How to Pass table from a cobol program to another cobol program and how to use that table in called program

8 Answers   Patni, SunGard,


I have one ps file in which there are 3 fileds emp_no,emp_name and leave_app.this ps file information give the detail of employee which is going to apply for leave.suppose emp_no=113430,emp_name=ajay,leave_app=1 that means he is going to apply for 1 day leave.and accordingling the table in db2 will be updated means if he has that no of leave in his account then he will get dat leave and updated acc. in table(leave_balance=previous leave present in table-leave_app).Now i want to check whther the updated result is correct or not by comparing the two ps file using IEBCOMPARE or icetool so what is going to be the two ps file and how its is going to be compare.

0 Answers   Cap Gemini,


Give some examples of command terminators?

0 Answers  


01 xxx pic 9(4). 01 yyy pic 9(6). move 123456 into yyy. move yyy to xxx. display yyy. what would be the value of yyy

13 Answers   HSBC,


Why we need to use redefine clause when we can define the variable seperately... what is actual need....

5 Answers   Accenture,


Suppose a program has the following code. What will be the output? MAIN-PARA. DISPLAY 'MAIN-PARA' PERFORM SECTION-A. STOP RUN. SECTION-A. PARA-A1. DISPLAY 'SECTION A PARA A1'. PARA-A2. DISPLAY 'SECTION A PARA A2'.

4 Answers  


Categories