Highlighted
Absent Member.
Absent Member.
2639 views

occurs clause - screen section

Does anyone know of a way to have a variable occurs clause in the screen section.

Example :  old method                05           OCCURS 15 TIMES.

                    new method              05           OCCURS WS-MAX-LINES TIMES

Where WS-MAX-LINES TIMES is a field in working storage defined as PIC 9(2).

0 Likes
7 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: occurs clause - screen section

78  my-times  value 15.

01  my-data OCCURS my-times.

          03 myd1 pic x(12).

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: occurs clause - screen section

Can it be variable? I want the occurs to be 1 up to 30.

Thanks,

David

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: occurs clause - screen section

I don't think so ... OCCURS table-size TIMES

Syntax Rules

1.Table-size is an integer that specifies the number of occurrences of the screen entry.

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: occurs clause - screen section

I think the compiler needs the value in order to set up the table. So a 78 level constant works. A data-tem pic 99 even with a value statement is rejected.

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: occurs clause - screen section

yes the 78 level works but I need it as a variable. I think I would have to have separate screens for each occurs that I would provide. I do thank you for responding to this.

Thanks,

David

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: occurs clause - screen section

Hi DavidP, Try this way :

05  .....    ENTRY-FIELD OCCURS 30

     .......   ............ ............. ...........

     .......   ............ ............. ...........

              VISIBLE TAB-VISIBLE.

Where TAB-VISIBLE is :

77 TAB-VISIBLE PIC 9 OCCURS 30.

Then you set, in your program, the TAB-VISIBLE (cpt) as you want, before to display the screen : the first 10 to 1 and the last 20 to ZERO : the screen will display ten ENTRY-FIELDS !

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: occurs clause - screen section

The options do work for what you are describing. Thanks for the information.

But what I am trying to do is

1) Allow a user to have a default occurs such as 10, 15, 20, and so on.

2) Based on this value the window would be created and the occurs would be what is allowed

If the occurs was 10 then the window would be 16 lines with headings and functions at the bottom

with the occurs being 10.

If the occurs was 20 then the window would be 26 lines with headings and functions at the bottom

with the occurs being 20.

This would all be variable with the variable able to be changed.

This would allow small device screens to show a certain amount and large screens could show more.

Thanks,

David

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.