Skip to main content

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).

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).

78  my-times  value 15.

01  my-data OCCURS my-times.

          03 myd1 pic x(12).


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).

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

Thanks,

David


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).

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.


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).

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.


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).

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


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).

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 !


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).

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