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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the cobol coding sheets?

655


What kind of error is trapped by on size error option?

733


i made it to stage 3 of an interview process wednessday they will quiz my knowledge again face to face for an analyst role recruiter said it will be based on Business requirements system is cobol and good ideas what they might ask etc

2096


How to print 10 to 1 if the input have only 10 digit number?

804


What is the difference between external and global variables in COBOL?

804






what happens if parmparameter passes zero bytes to the program

1650


What is the problem of ordered sequential files access?

690


I have program P1 which calls file F1 which has 100 records and following structure 001 .................. 002 .................. 003 .................. 098 .................... 099 ................... 100 .................... Now I want to read these files and write these records in file F2 in following manner. 001 ...... 051 ..... 002 ...... 052 ..... 003 ...... 053 ..... .......... ....... .......... ....... .......... ....... 048 ........ 098 ...... 049 .......... 099 ....... 050 .... 100 ......

10543


What is the usage of comp fields in cobol?

647


How do you reference the following file formats from cobol programs?

689


IF I mention stop run in CICS what happens?

1886


What is the difference between binary search and sequential search?

634


What are different data types in cobol?

678


What is a SSRANGE and NOSSRANGE?

809


What is static and dynamic call in cobol?

588