z/OS ISPF Services Guide
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


TBDISPL—display table information

z/OS ISPF Services Guide
SC19-3626-00

The TBDISPL service combines information from a panel definition with information stored in an ISPF table. It displays all or certain rows from the table, allowing the application user to scroll the information up and down.

When only certain rows from a table are to be displayed, the TBSARG service is used to define the selection criteria before issuing TBDISPL. Only search arguments established by TBSARG that specify a forward scan through the table (for example, TBSARG specifying the keyword NEXT, either explicitly or implicitly) should be used. In this case, ROWS(SCAN) must be specified on the )MODEL statement in the panel definition.

TBDISPL can produce a display of a table based on a search argument that specifies a backward scan; that is, PREVIOUS on the TBSARG request and ROWS(SCAN) specified on the )MODEL header statement. This would display the table from bottom to top. Top to bottom is the normal table display. However, because TBDISPL does not support scrolling for the bottom-to-top case, scrolling results are unpredictable.

The format of the display is specified by a panel definition, which TBDISPL reads from the panel library. The panel definition specifies the fixed (non-scrollable) portion and the scrollable portion of the display. The fixed portion contains the command field and commonly the scroll amount field. It can also include other input fields as well as text, output fields, dynamic areas and a graphic area.

The scrollable portion is defined by up to eight "model" lines. They indicate which table fields are to be displayed.

Each line of scrollable data can have one or more input (unprotected) fields, as well as text and output (protected) fields. The user can modify the input fields in the scrollable or fixed portions.

Before TBDISPL is invoked, the table to be displayed must be open, such as TBOPEN, and the current row pointer (CRP) positioned to the row at which the display is to begin, such as TBTOP (automatic following TBOPEN), TBBOTTOM, or TBSKIP. When CRP is pointing to the top of the table, it has a value of 0. It is treated as though the CRP were pointing to the first row. Do not attempt to use TBDISPL to display a command table currently in use. This might produce unpredictable results.

The scrollable portion of the display is formed by replicating the model lines from the panel definition enough times to fill the screen. Each of these replications is known as a model set. Table rows are then read to fill in the appropriate fields in the model set replications. Each table row corresponds to a model set.

The table that is displayed in a panel's scrollable area can be built dynamically by the application. This is useful for applications involving large amounts of data that users might wish to access to varying extents. The application can provide a relatively small table as a starter, then expand the table as users scroll beyond the top or bottom table row.

When the user enters data into a model set, the corresponding table row is said to be selected for processing. The user can select several rows. The data must be modified to select the model set. If you simply overtype the existing model set with the same data, the model set is not considered to be selected.

TBDISPL itself does not modify the table. The dialog function can use the information entered by the user to determine what processing is to be performed, and can modify the table accordingly.

TBDISPL operation

TBDISPL allows the user to scroll the data up and down and enter information in the input fields in the scrollable or fixed portions.

TBDISPL operation depends on whether a )REINIT or )PROC section is included in the panel definition. When a )REINIT or )PROC section is included, and if the user makes no modification to the screen and presses the Enter key, TBDISPL returns control to the dialog function. On the other hand, if neither a )REINIT nor a )PROC section is included and if the user makes no modification to the screen and presses the Enter key, TBDISPL treats this as a "no operation" and control does not return to the dialog function. This is for compatibility with the previous version of the product.

During a display of a panel using TBDISPL, any of these user actions will result in control returning to the dialog function:
  • Typing no input and pressing the Enter key, assuming that a )REINIT or )PROC section exists in the panel definition
  • Typing data into the fixed or scrollable portion of the display and pressing the Enter key
  • Typing data into the fixed or scrollable portion of the display and entering the UP or DOWN command
  • Entering the END or RETURN command
  • Scrolling UP or DOWN with scroll return to function defined and not enough table rows to handle the scroll request.

Operational results from user actions

These user actions will not result in control returning to the dialog function:
  • Typing no input and pressing the Enter key (assuming that neither a )REINIT nor a )PROC section exists in the panel definition).
  • Typing no input and entering the UP or DOWN command. This is true if scroll return to function is not defined, but there are enough rows to satisfy the scroll request.
  • Entering a system command other than UP, DOWN, END, or RETURN. For example, HELP, SPLIT, or CURSOR.
  • Entering an application command that SELECTs another dialog.

After display of a panel using TBDISPL, and before control returns to the dialog function:

  1. The contents of all input fields in the fixed portion are stored in the dialog variable specified in the panel definition.
  2. If there were no selected rows to process, the CRP is set to TOP (zero). If scroll return to function is defined and rows are needed to satisfy the scroll request, the scroll return system variables are set in the function pool.
  3. If there were any selected rows, the CRP is positioned to the first of these, and the row is retrieved from the table. The values of all variables from that row are stored into the corresponding dialog variables. All input fields in the selected model set on the display are then stored in the corresponding dialog variables. The input fields can or cannot correspond to variables in the table.

    Variable ZTDSELS contains the number of rows that were selected. The value of ZTDSELS can be checked in the )PROC section of the panel definition, or it can be checked by the dialog function.

  4. The row number that corresponds to the first model set currently displayed on the screen is stored in the system variable ZTDTOP. If, in a dialog, you want to reposition the scrollable data as the user last saw it, you must reposition the CRP to the row number stored in ZTDTOP before reinvoking the TBDISPL service with the panel name specified. This is not necessary if the panel name is not specified.

ZTDTOP and ZTDSELS variables

ZTDTOP and ZTDSELS are variables in the function pool. A command procedure can access them directly. A program can access them through use of the VDEFINE or VCOPY service. If a program function uses the VCOPY service to access the variable, the value will be in character string format. It will not be in fixed binary format.

If the application user selected more than one row in a single interaction, the variable ZTDSELS is 2 or greater, which indicates that selected rows remain to be processed. These rows are called pending selected rows. A call to TBDISPL is required to position the CRP to each pending selected row, retrieve the row from the table, and store input fields from the corresponding model set. After the CRP is positioned to each selected row, the function can process the row, for example, by issuing a TBPUT request to update the table. For these calls, neither the panel-name nor the message-id should be specified. The processing sequence for each of these calls is as described previously, except that the next selected row is processed.

Whenever selected rows remain to be processed, the dialog can choose to ignore them by calling TBDISPL with a specified (nonblank) panel name. This clears out any remaining information about previous calls. If the dialog wants to display another screen before processing pending selected rows from the first display, it must invoke the CONTROL service to save and restore the display environment.
Note: Table display service system variables, ZTD*, are not saved as part of the CONTROL DISPLAY SAVE/RESTORE information. The values of these variables may be saved by the dialog developer and restored before resuming processing of the initial table display.

Command invocation format

Read syntax diagramSkip visual syntax diagram
>>-ISPEXEC--TBDISPL--table-name--+-------------------+---------->
                                 '-PANEL(panel-name)-'   

>--+-----------------+--+--------------------+------------------>
   '-MSG(message-id)-'  '-CURSOR(field-name)-'   

>--+--------------------------+--+-------------------------+---->
   '-CSRROW(table-row-number)-'  '-CSRPOS(cursor-position)-'   

>--+--------------------+--+--------------------+--------------->
   |          .-YES-.   |  '-POSITION(crp-name)-'   
   '-AUTOSEL(-+-NO--+-)-'                           

>--+-------------------+--+----------------------------+-------><
   '-ROWID(rowid-name)-'  '-MSGLOC(message-field-name)-'   

Call invocation format

Read syntax diagramSkip visual syntax diagram
>>-CALL--ISPEXEC--(buf-len,--buffer);--------------------------><

or

Read syntax diagramSkip visual syntax diagram
>>-CALL--ISPLINK--('TBDISPLb'--,--table-name-------------------->

>--,-+-panel-name-+--,-+-message-id-+--,-+-field-name-+--------->
     '-'b'--------'    '-'b'--------'    '-'b'--------'   

>--,-+-table-row-number-+--,-+-cursor-position-+---------------->
     '-'b'--------------'    '-'b'-------------'   

     .-'YESbbbbb'-.                                     
>--,-+-'b'--------+--,-+-crp-name-+--,-+-rowid-name-+----------->
     '-'NObbbbbb'-'    '-'b'------'    '-'b'--------'   

>--,-+-message-field-name-+-);---------------------------------><
     '-'b'----------------'      

Parameters

table-name
Specifies the name of the table to be displayed.
panel-name
Specifies the name of the panel to be displayed.
message-id
Specifies the identification of a message to be displayed on the panel.
field-name
Specifies the name of the field where the cursor is to be placed on the display. Any setting of the .CURSOR control variable done in the panel definition takes precedence over this parameter.
table-row-number
Specifies the table row number (CRP number) corresponding to the model set on the display where the cursor is to be placed. For a call, this parameter must be a fullword fixed binary number.

Specifying the CSRROW parameter without specifying AUTOSEL(NO) results in the row being retrieved, even if the user did not explicitly select the row. This is called auto-selection.

If the specified row does not have a corresponding model set in the logical table display (the logical table display includes model sets not displayed because of split-screen, PFSHOW, or floating command line), the cursor is placed at the command field. No auto-selection is performed.

Any setting of the .CSRROW control variable done in the panel definition takes precedence over this parameter.

cursor-position
Specifies the position within the field where the cursor is to be placed. This position applies regardless of whether the initial cursor placement was specified in the CURSOR calling sequence parameter, the .CURSOR control variable in the )INIT or )REINIT section of the panel, or is the result of default cursor placement. If cursor-position is not specified or is not within the field, the default is 1.

Any setting of the .CSRPOS control variable done in the panel definition takes precedence over this parameter.

AUTOSEL( YES |NO)
YES specifies that if the CSRROW(table-row-number) parameter is specified or if .CSRROW is set within the )INIT or )REINIT section, the row is to be retrieved, even if the user did not explicitly select the row. This is known as auto-selection.

NO specifies that even if the CSRROW(table-row-number) parameter is specified or if .CSRROW is set within the )INIT or )REINIT section, the row is to be retrieved only if the user explicitly selects the row by entering data into the corresponding model set.

If the CSRROW parameter or the .CSRROW control variable is not specified, the AUTOSEL parameter is ignored.

Any setting of the .AUTOSEL control variable done in the panel definition takes precedence over this parameter.

crp-name
Specifies the name of a variable in which the row number pointed to by the CRP is to be stored. If the CRP is positioned to TOP, the row number returned is zero.
rowid-name
Specifies the name of a variable in which a number that uniquely identifies the row being accessed is to be stored. Later, this identifier can be specified in the ROW parameter of TBSKIP to cause the CRP to be positioned to the row. This identifier is not saved on permanent storage by TBSAVE or TBCLOSE. The variable must be an 8-byte character field.
message-field-name
Used to position the message pop-up window. If the application specifies this parameter, the Dialog Manager positions the message pop-up relative to the named field.

If this parameter is omitted and a message is displayed in a message pop-up window, the window is displayed at the bottom of the logical screen or below the active ADDPOP pop-up window if one exists.

For compatibility with later versions, this parameter should be specified only when the message will display in a pop-up window.

Note: When running in GUI mode, this parameter is ignored.
buf-len
Specifies a fullword fixed binary integer containing the length of "buffer".
buffer
Specifies a buffer containing the name of the service and its parameters in the same form as they would appear in an ISPEXEC call for a command procedure.

Parameter processing

The panel-name and message-id parameters are optional. They are processed as follows:
  • If panel-name is specified and message-id is not specified, the panel definition is retrieved, rows from the table are read, starting at the CRP, to fill the screen, and the screen is displayed without a message. Any information from previous TBDISPL calls, such as pending scroll requests or pending selected rows, is cleared.
  • If panel-name and message-id are both specified, the panel definition is retrieved, rows from the table are read to fill the screen, and the screen is displayed with the specified message.
  • If panel-name is not specified and message-id is specified, the current table display is overlaid with a message, without rebuilding the screen or rereading the table.
  • If neither panel-name nor message-id is specified, the processing depends on whether there are selected rows remaining to be processed. If no selected rows remain to be processed: If the application user's last action was to:
    • Press the Enter key, then rows from the table are again read to fill the screen and the screen is redisplayed.
    • Enter a scroll command, then the scroll function is now honored by reading and displaying the appropriate rows from the table.
    • Enter an END or RETURN command, then the CRP is set to TOP (zero) and control returns to the function issuing the TBDISPL with a return code of 8. If this occurs more than once in immediate succession, a return code of 20 is issued, since the application can be in a loop.

    If there are selected rows remaining to be processed, the CRP is positioned to the first of these, the row is retrieved from the table, and input fields from the selected model set are stored.

Use the CONTROL service to save and restore the environment when a TBDISPL series, in which panel-name is not specified, is to be interrupted by another TBDISPL, DISPLAY, BROWSE, or EDIT operation.
The CURSOR and CSRROW parameters are optional. Their processing is as follows:
  • If the CURSOR parameter is not specified but the CSRROW parameter is specified, the cursor is placed on the first field in the specified row.
  • If the CURSOR parameter is specified, but the CSRROW parameter is not specified or is specified with a value of zero, the current value of the CRP determines the row location, and the cursor is placed in this row on the field specified by the CURSOR parameter. A value of zero in the CRP places the cursor on the command line.
  • If neither the CURSOR nor the CSRROW parameter is specified, the cursor is placed at the command field.
  • If both the CURSOR and CSRROW parameters are specified, the cursor is placed at the field specified by the CURSOR parameter within the model set corresponding to the table row specified by the CSRROW parameter.
  • Whenever the CSRROW parameter is specified without specifying AUTOSEL(NO), the row is retrieved, even if the user did not modify that row. This allows the dialog developer to force the user to correct an error on that row before going on to process other rows.
  • Any setting of the .CURSOR and the .CSRROW control variables done in the panel definition takes precedence over the CURSOR and CSRROW parameters.

Return codes

These return codes are possible:
 0
If the panel definition contains neither a )REINIT nor a )PROC section, the Enter key was pressed, or a scroll command was entered. Any of these occurred:
  • One row was selected in the scrollable part of the display. The CRP is set to point to that table row and the row is retrieved. The input fields from the selected model set on the display are then stored in the function pool.
  • The user entered information into the fixed portion of the display.
  • All of these:
    • A scroll return to function has been specified (ZTDRET defined to UP, DOWN, or VERTICAL).
    • More rows are needed to fill a scroll request.
    • No selected rows remain to be processed.

If the panel definition contains a )REINIT or )PROC section, there is the additional possibility that the user entered no information and just pressed the Enter key.

 4
The Enter key was pressed or a scroll command was entered. The first or both of these occurred:
  • Two or more rows in the scrollable part of the display were selected. The CRP is set to the first selected row and the row is retrieved. The input fields from the selected model set on the display are then stored in the function pool.
  • The user entered information into the fixed portion of the display.
  • If scroll return to function has been specified, and two or more rows are selected for processing, TBDISPL returns a return code 4 until all selected rows are processed. You process the request for more rows to be added to the table only after all selected rows have been processed; that is, only when ZTDSELS has a value of 0.

For subsequent TBDISPL requests with no panel name and no message-id, return code 4 is issued for each request until one selected row remains to be accessed. For this last row, a return code of zero is issued by TBDISPL, still specified with no panel name and no message-id. The variable ZTDSELS will have a value of one.

 8
The END or RETURN command was entered. For panels created by the conversion utility, CANCEL and EXIT commands also give return code 8. If CANCEL and EXIT is requested from a panel displayed using TBDISPL service calls and the panel was defined with Dialog Tag Language (DTL), the dialog manager returns the command in ZVERB and sets a return code of 8 from the display screen. The CRP is set to the first of any selected rows in the scrollable part of the display. The input fields from the selected model set on the display are then stored in the function pool.

If no rows were selected, the CRP is at the top (zero).

To process all selected rows when END or RETURN was entered, continue to issue TBDISPL requests with no panel name or message-id specified until ZTDSELS is one.

If you enter the END command on a table display panel, a subsequent redisplay will result in a return code of 8.

The user might have entered information into the fixed portion of the display.

12
The specified panel, message, cursor field, or message location field could not be found.
16
Truncation or translation error in storing defined variables.
20
Severe error.

Example

Display the table TELBOOK using panel definition TPANEL2 to format the display.
ISPEXEC TBDISPL TELBOOK PANEL(TPANEL2)
Set the program variable BUFFER to contain:
TBDISPL TELBOOK PANEL(TPANEL2)
Set program variable BUFLEN to the length of the variable BUFFER. Issue the command:
CALL ISPEXEC (BUFLEN, BUFFER);
or alternately
CALL ISPLINK ('TBDISPL ','TELBOOK ','TPANEL2 ');

System variables related to TBDISPL

If a program function uses the VCOPY service to access a variable, the value will be in character string format. It will not be in fixed binary format.

System variables used with TBDISPL processing are:

ZTDMARK
Specifies an alternate bottom-of-data marker. ZTDMARK is created by the dialog and can reside in any variable pool. It is an input variable, whose length can be equal to or less than the screen width. If ZTDMARK exists, its value is used as the marker. If ZTDMARK does not exist, the default marker of "BOTTOM OF DATA" with asterisks on each side is used.
For example, this assignment could be made in the )INIT section of a table display panel:
&ZTDMARK = '----> End of Data <----'
ZTDMARK can be blank. That is, this assignment is valid:
&ZTDMARK = ' '
In this case a bottom-of-data marker would not appear on the screen.
ZTDMSG
Specifies the ID of a message to be used as an alternate top-row-displayed indicator. ZTDMSG is created by the dialog and can reside in any variable pool. It is an input variable whose length is 8.

If ZTDMSG exists, TBDISPL invokes the GETMSG service to get the short message and long message text. If the short message exists and is nonblank, it is used as the top-row-displayed indicator. If the short message does not exist, the long message text is used as the top-row-displayed indicator. In both cases, the current values of any variables in the message are placed in the message and the text is placed right-justified on the top line of the display.

If ZTDMSG does not exist, the long form of message ISPZZ100 is used.

The text used for the top-row-displayed indicator is summarized in the z/OS ISPF Dialog Developer's Guide and Reference.

A message ID whose short and long message text is blank (' ') or the null variable (&Z) can be assigned to ZTDMSG. In this case, the table display would not have a top-row-displayed indicator.

No top row is displayed if the user attempts to:

  • Display an empty table
  • Scroll past the bottom row
  • Specify no rows matching the TBSARG criteria and ROWS(SCAN) is specified on the )MODEL statement of the panel definition.

In this case, message ISPZZ101 is used for the top-row-displayed indicator. This has no short message text, and the long message text is '&Z'.

ZTDROWS
Created by TBDISPL to indicate the number of rows in the table most recently displayed. It resides in the function pool. It is an output variable whose length is 6. Unless it has been defined otherwise by a program function, ZTDROWS is 6 characters long and will have leading zeros, if necessary.
ZTDSELS
Created by TBDISPL to indicate the number of selected rows. It includes the current selected row, if one exists, and any pending selected rows. ZTDSELS resides in the function pool. It is an output variable whose length is 4. Unless it has been defined otherwise by a program function, ZTDSELS is 4 characters long and will have leading zeros if necessary.
ZTDTOP
Created by TBDISPL to indicate the table row number of the top row displayed. ZTDTOP resides in the function pool. It is an output variable whose length is 6. Unless it has been defined otherwise by a program function, ZTDTOP is 6 characters long and will have leading zeros if necessary.
ZTDVROWS
Returns the number of visible rows available from the most recent table display. Only complete model sets are counted, so if a model set spans multiple lines and not all of the lines are visible, it is not counted. ZTDVROWS is set to zero if no complete model sets are visible. ZTDVROWS resides in the function pool. It is a six character output pool variable and will have leading zeros if necessary.

System variables ZTDRET, ZTDADD, ZTDSCRP, ZTDLTOP, ZTDLROWS, ZTDSRID, ZTDAMT, and ZTDSIZE are used exclusively when dynamically building the table being displayed.

Table display service system variables, ZTD*, are not saved as part of the CONTROL DISPLAY SAVE/RESTORE information. The values of these variables may be saved by the dialog developer and restored before resuming the processing of the initial table display. Also, the ZVERB is not saved.

Panel control variables related to TBDISPL

Control variables used with TBDISPL processing are as follows:
.AUTOSEL
The variable version of the AUTOSEL parameter. It can be assigned "YES", "NO", or a blank in the )INIT or )REINIT sections. Any assignment made to .AUTOSEL in the )PROC section is ignored.
  • YES indicates that auto-selection should be performed if the CSRROW parameter is specified and the user does not explicitly select the row.
  • NO indicates that auto-selection should not be performed.
  • Specifying a blank value is the same as specifying YES, with one exception: if there are no input fields in the model lines, auto-selection will occur only if YES is explicitly specified.

Any setting of this variable takes precedence over the AUTOSEL parameter.

.CSRROW
The variable version of the CSRROW parameter. It can be assigned the table row number (CRP number) corresponding to the model set on the display where the cursor is to be placed. Any setting of this variable takes precedence over the CSRROW parameter.

Parameter variables related to TBDISPL

Variable names can be specified as TBDISPL parameters, as follows:
POSITION(crp-name)
Specifies the name of the variable in which TBDISPL is to store the row number (CRP number) of the current selected row. If there are no selected rows, the CRP will be at the top and the row number returned is zero.
ROWID(rowid-name)
Specifies the name of the variable in which TBDISPL is to store the rowid of the current selected row.
The difference between a CRP number and a rowid is as follows:
  • A CRP number is an ordinal number; that is, the first row has a CRP number of 00000001, the second row has a CRP number of 00000002, and so on. CRP numbers are associated with "slots" in a table, rather than particular rows. If a new row is inserted after the first row, that new row now has a CRP number of 00000002. What had been row 00000002 is now row 00000003, what had been row 00000003 is now row 00000004, and so on.
  • A rowid is a nominal value that uniquely identifies a row. This value stays with the row, even if the row has other rows inserted before it. Note, however, that this identifier is not saved on permanent storage by the TBSAVE or TBCLOSE service.

Using TBDISPL with other services

Consider these items when using TBDISPL with other services:

  1. CONTROL DISPLAY LOCK

    This service specifies that the next display output is to leave the user's keyboard locked as the panel is displayed, and ISPF is to simulate an ENTER. This facility can be used to generate crude animation or display an "in process" message during a long-running operation.

    Table displays done in conjunction with this service should display panels that have a )REINIT or )PROC section. Otherwise, the simulated ENTER is treated as a no-operation, as described under TBDISPL summary.

  2. CONTROL DISPLAY SAVE and CONTROL DISPLAY RESTORE

    If the dialog wants to invoke a display service (BROWSE, EDIT, DISPLAY, another TBDISPL) before processing pending selected rows, it must invoke the CONTROL DISPLAY service to save and restore the current TBDISPL series environment.

    The dialog should invoke CONTROL DISPLAY SAVE before the non-TBDISPL series display service and CONTROL DISPLAY RESTORE after the non-TBDISPL series display service. For example:

    Service
    Description
    TBOPEN TAB1
    Open the table
    TBDISPL TAB1 PANEL(PAN1)
    Display the table and panel
    CONTROL DISPLAY SAVE
    Save control information about PAN1
    DISPLAY PANEL(PAN2)
    Display a second panel
    DISPLAY PANEL(PAN3)
    Display a third panel
    CONTROL DISPLAY RESTORE
    Restore control information about PAN1
    TBDISPL TAB1
    Reinvoke TBDISPL to process the next selection or redisplay the table and panel
    CONTROL DISPLAY SAVE
    Again save control information about PAN1
    DISPLAY PANEL(PAN2)
    Display the second panel again
    DISPLAY PANEL(PAN3)
    Display the third panel again
    CONTROL DISPLAY RESTORE
    Again restore control information about PAN1
    TBDISPL TAB1
    Reinvoke TBDISPL to process the next selection or redisplay the table and panel
  3. BROWSE, EDIT, and DISPLAY

    See item 2.

  4. Command Tables

    Do not attempt to use TBDISPL to display a command table currently in use. The results would not be predictable.

  5. TBSARG

    When only certain rows from a table are to be displayed, the TBSARG service must be invoked before issuing TBDISPL to establish the search criteria. The search criteria should specify a forward scan through the table. In this case, ROWS(SCAN) must be specified on the )MODEL statement in the panel definition.

  6. TBSORT

    The TBSORT service can be used freely with the TBDISPL service, even during a TBDISPL series. Note, however, that the pending selected rows will be processed in their original order; that is, in the order they would have been processed had the dialog not invoked the TBSORT service.

Techniques for using the TBDISPL service

These techniques can be applied in programs and command procedures using the TBDISPL service.

  1. Displaying Only Certain Rows

    When only certain rows from a table are to be displayed, the TBSARG service must be invoked before issuing TBDISPL to establish a search criteria. The search criteria should specify a forward scan through the table. In this case, ROWS(SCAN) must be specified on the )MODEL statement in the panel definition.

  2. Displaying Table Extension Variables

    As TBDISPL creates the scrollable portion of the display, it reads rows from the table and fills in fields in the model sets with their current values. If a field in a model line is an "extension" variable in the table and does not exist in all rows, TBDISPL repeats its value in model sets to which it does not apply. To prevent this, use the CLEAR(var-name, var-name, ...) keyword on the )MODEL statement. This keyword sets to blank the specified variables before each row is read from the table to fill the scrollable portion.

  3. Clearing Already-Processed Select Fields

    As the TBDISPL service is reinvoked to process pending selected rows, the dialog may set to blank the select field for successfully processed rows. This is useful in case there is a redisplay with an error message. The already processed select fields will be blank and the not-yet-processed select fields will still have the user-entered data in them.

    Having these statements in the )REINIT section of the panel definition could achieve this:
    If (.msg=' ')
      &Select=' '
      Refresh(Select)
    where "Select" represents the name of any field in the panel that the dialog wants to clear. The previous three statements shown could be on one line. For example:
    If (.msg=' ')  &Select=' '   Refresh(Select)
  4. Using Auto-Selection
    Consider this situation:
    • The user has entered invalid data in the select field.
    • The panel is redisplayed with an error message.
    • The user does not change the invalid data but performs some action that results in control returning to the dialog function.
    The model set with the invalid data was not user-selected. If the dialog wants to ensure that the user corrects the invalid data, it should use auto-selection in this situation. That is, the CSRROW parameter or control variable should be specified, and the AUTOSEL parameter or control variable should be blank or YES. This will result in the specified row being selected even if the user did not explicitly select it by modifying the corresponding model set on the display.

    The auto-selection feature is normally used when the cursor is placed at invalid data in the scrollable portion and there is an error message displayed. It is not used when the cursor is placed in the scrollable portion for informational purposes.

    If the auto-selected row is not displayed on the logical screen because of split screen, PFSHOW, or a floating command line, the cursor is placed at the command field. The dialog should ensure that the user is aware of the auto-selected row by issuing a message when specifying table-row-number.

  5. Controlling the Top Row Displayed

    As discussed previously, the user can issue the UP or DOWN command to scroll during a TBDISPL display. Scrolling changes the row that is displayed at the top of the scrollable portion. This topic discusses how the dialog function controls the top row displayed.

    In a typical table display dialog, the TBDISPL service is invoked repeatedly in a loop. The first call results in a display ("the first display"). Subsequent calls can produce a display ("subsequent displays") or can process pending selected rows ("no display").

    Controlling the Top Row Displayed in a "First Display"

    The TBDISPL service must be invoked with the PANEL parameter specified to obtain a "first display". In this case, the current row is the top row displayed. For convenience, a table with its CRP at TOP is treated as though the current row was row 1. The dialog can use any of the services that move the CRP, such as TBSKIP or TBTOP, to make the desired table row the current row.

    Controlling the Top Row Displayed in a "Subsequent Display"

    There are three ways to produce a "subsequent display":

    1. Invoke TBDISPL with the PANEL parameter specified.
    2. Invoke TBDISPL without the PANEL parameter specified, but with the MSG parameter or .MSG control variable specified.
    3. Invoke TBDISPL without the PANEL parameter specified and without the MSG parameter, or .MSG control variable, specified when there are no pending selected rows.
    In the first case, the current row is the top row displayed. The system variable ZTDTOP contains the row number of the top row displayed on the previous TBDISPL display. This technique can be useful to control the top row displayed:
    TBTOP  table                     /* Set CRP to TOP        */
    TBSKIP table NUMBER(&ZTDTOP)     /* Set CRP to previous   */
                                     /*  top row displayed    */
    VGET (ZVERB ZSCROLLN)            /* Retrieve variables    */
    Select                           /* Determine Case        */
     When &ZVERB = 'UP' Then         /* - When scroll UP req  */
      TBSKIP table NUMBER(-&ZSCROLLN)/*  skip back toward top */
     When &ZVERB = 'DOWN' Then       /* - When scroll DOWN req*/
      TBSKIP table NUMBER(&ZSCROLLN) /*  skip forward         */
     Otherwise                       /* - Otherwise, not a    */
    End                              /*  scroll request       */
                                     /*                       */
    TBDISPL table PANEL(panel)       /* Disp the table and pnl*/

    In the second case, the top row displayed is the same as that displayed on the previous display. That is, the previous image is "redisplayed" as the user last saw it, except that the specified message is also shown. Certain fields can have been refreshed and the cursor can be in a different place.

    In the third case, any pending scroll request is honored. That is, if the user had entered any data and issued a scroll request on a previous TBDISPL display, that scroll request is now honored. If no scroll request was pending, the top row displayed is whatever it was on the previous display.

  6. Using Variable Model Lines

    Model lines can be specified dynamically through the use of variable model lines. That is, the attribute characters and field names are not specified in the model section. Instead, a variable whose value contains the attribute characters and field names is specified in column one of the model line.

Rules applying to variable model lines

Here are some rules that apply to variable model lines:

  • The variable must begin in column 1.
  • The variable must be the only data on the model line.
  • The length of the value of the variable must not be greater than the screen width.
  • The variable must be initialized before the panel is displayed. It is not acceptable to initialize the variable in the )INIT section of the panel definition.
  • The variable is retrieved from the function pool only once for each TBDISPL with a nonblank panel name. This means that the same model line, including attribute settings, will be in effect for all rows displayed by the TBDISPL.
  • Changes to the variable that occur within the panel or dialog function are not honored until TBDISPL is invoked again with a nonblank panel name.
  • A variable whose value is blank is acceptable.
  • If the variable contains the character string "OMIT" in uppercase, lowercase, or in mixed case, starting in column one, then that variable model line will not be used.
  • There can be from one to eight model lines. Some can be variable model lines and others can be explicitly specified.
  • "Z" variables used as name placeholders are acceptable in variable model lines. Be sure to assign an appropriate value to .ZVARS in the )INIT section.
  • If the SFIHDR keyword is specified on the )MODEL header statement, the first variable model line is assumed to define scroll indicator fields for scrollable fields that are defined on subsequent variable model lines.

Example—panel using variable model lines

Figure 1 is the panel definition for a panel named VARMOD. Figure 2 and Figure 3 are two possible types of TBDISPL displays using panel VARMOD.

Figure 1. Variable Model Lines: Panel Definition
)Attr
  | Type(input)  Intens(high) Just(left)  Caps(on)   Pad('')
  $ Type(&type ) Intens(low ) Just(left)  Caps(off)  Padc('_')
  ø Type(&type ) Intens(low ) Just(left)  Caps(on)   Padc('_')
)Body  Expand(//)
%--/-/-- Customer Information --/-/--
%Command ===>_cmdfld / /  +Scroll ===>_amt +
+ 
+ Show Address? ==>_QAD+(Yes or No)
+ Allow Update? ==>_QUP+(Yes or No)
+ 
%Select
%Code   Account     Name &TITLE2
)Model
&MDL1
&MDL2
&MDL3
)Init
  &amt=page
  If (&QAD=' ') &QAD=NO
  If (&QUP=' ') &QUP=NO
  If (&QUP='YES') &TYPE='Input'
  If (&QUP='NO')  &TYPE='Output'
  If (&QAD='YES') .ZVARS='(State)'
)Proc
  &QAD = Trans(Trunc(&QAD,1) Y,YES N,NO ' ',NO *,*)
  Ver(&QAD,List,YES,NO)
  &QUP = Trans(Trunc(&QUP,1) Y,YES N,NO ' ',NO *,*)
  Ver(&QUP,List,YES,NO)

  If (&QAD='YES')
    &TITLE2='and Address'
    &MDL1='|SCODE+øAccount+   $Name                            +'
    &MDL2='                   $Address                       + 
$City               + øZ +'
    &MDL3='%================================+ 
==============================================='
  If (&QAD='NO')
    &TITLE2=' '
    &MDL1='|SCODE+øAccount+   $Name                          +'
    &MDL2='OMIT'
    &MDL3='OMIT'
)End

Before panel VARMOD is displayed, the dialog function must initialize the variable model lines as follows:

&MDL1='|SCODE+øAccount+   $Name                          +'
&MDL2='OMIT'
&MDL3='OMIT'

This panel is designed to be displayed in a loop. That is, the TBDISPL service is invoked repeatedly to display the table and panel until the user enters the END or RETURN command.

When the panel is displayed, the user can set the "Show Address?" field (QAD) to YES or NO. If this field is NO (the default), only one model line is used, which shows the customer's account number and name. If this field is YES, three model lines are used. The first remains unchanged; the second is the customer's street address, city, and state; and the third contains divider lines. Also, the variable &TITLE2, which appears in the )BODY section, is set to a nonblank value. This is used as part of the column heading for the scrollable portion.

Figure 2. Variable Model Lines: Display 1
 ----------------------------- Customer Information ----------------- ROW 1 OF 8
 Command ===>                                               Scroll ===>
  Show Address? ==> NO  (Yes or No)
  Allow Update? ==> NO  (Yes or No)

 Select
 Code   Account     Name
 ''  KC10001     Rogers, Kelly
 ''  KC10002     Holloway, Rich
 ''  KC10003     Holmes, Karen
 ''  KC10004     Jones, Ann
 ''  KC10005     Donavan, Harold
 ''  KC10006     Bentley, Chris
 ''  KC10007     Seabold, Matthew
 ''  KC10007     Fitzgerald, Therese
******************************* BOTTOM OF DATA *********************************







 
Figure 3. (Part 1 of 2). Variable Model Lines: Display 1
 ----------------------------- Customer Information ----------------- ROW 1 OF 8
 Command ===>                                               Scroll ===>
  Show Address? ==> NO  (Yes or No)
  Allow Update? ==> NO  (Yes or No)

 Select
 Code   Account     Name and Address
 ''  KC10001     Rogers, Kelly
                    253 Main St                     Junction City         KS
 ===============================================================================
 ''  KC10002     Holloway, Rich
                    2810 Curtis Lane                Long Beach            CA
================================================================================
 ''  KC10003     Holmes, Karen
                    3600 Chestnut St                Hyannis               MA
================================================================================
 ''  KC10004     Jones, Ann
                    212 Fallon Ave                  North Hudson          NY
================================================================================
 ''  KC10005     Donavan, Harold
                    180 Berthold Ave                Baton Rouge           LA


 
Figure 4. (Part 2 of 2). Variable Model Lines: Display 2
================================================================================
 ''  KC10006     Bentley, Chris
                    South Mountain Pass             Ashland               NH
================================================================================
 ''  KC10007     Seabold, Matthew
                    42 Dragonica Way                Newark                DE
================================================================================
 ''  KC10008     Fitzgerald, Therese
                    67 Waimea Blvd                  Naalehu               HI
================================================================================
******************************* BOTTOM OF DATA *********************************












 
Panel definition VARMOD has a number of features besides variable model lines:
  • It is in mixed case to improve readability.
  • The TYPE attribute of the fields ACCOUNT and NAME, as well as ADDRESS, CITY, and STATE, when they are shown, is a variable. When the user sets the "Allow Update?" field (QUP) to NO (the default), the customer information fields (ACCOUNT, NAME, ...) become output fields. That is, they are protected and cannot be updated.

    When the "Allow Update?" field is set to YES, the customer information fields become input fields. The user could then update the displayed information and the dialog function would update the table.

  • The title line makes use of the expand character defined on the )BODY statement. This is a convenient way to center the title text. The command line also uses the expand character.
  • Many of the lines in the executable sections, here the )INIT and )PROC sections, have more than one statement in them. This saves space and improves readability.
  • The first two assignments of &MDL2 and &MDL3 make use of the continuation character "+". This is convenient to use when assigning long strings to a variable.

Example—scroll indicator field in first variable model line

Figure 5 shows the panel definition for panel SFIMOD, which is similar to the previous example but uses variable model lines and the SFIHDR keyword on the )MODEL statement to define scrollable fields and scroll field indicators in the model section.

Figure 5. SFIHDR Keyword in Variable Model Lines: Panel Definition
)Attr
  ! Type(input)  Intens(high) Just(left)  Caps(on)   Pad('')
  $ Type(&type ) Intens(low ) Just(left)  Caps(off)  Padc('_')
  ø Type(&type ) Intens(low ) Just(left)  Caps(on)   Padc('_')
)Body  Expand(//)
%--/-/-- Publication List --/-/--
%Command ===>_cmdfld / /  +Scroll ===>_amt +
+
+ Allow Update?  ==>_QUP+(Yes or No)
+ Display format ==>_Z+  1. Name|Doc. Number|Title
+                        2. Doc. Number|Name|Title
+                        3. Title|Name|Doc. Number
+
%Select
%Code   &HDG
)Model sfihdr
&MDSI
&MDL1
)Init
  &amt=page
  .ZVARS='(QFM)'
  If (&QUP=' ') &QUP=NO
  If (&QFM=' ') &QFM=1
  If (&QUP='YES') &TYPE='Input'
  If (&QUP='NO')  &TYPE='Output'
  If (&QFM=' ')  &TYPE='Output'
  ver(&QFM Range,1,3)
  If (&QFM=1)
    &HDG='Name      Doc. Number   Title'
  If (&QFM=2)
    &HDG='Doc. Number   Name      Title'
  If (&QFM=3)
    &HDG='Title                               Name      Doc. Number'
)Proc
  &QUP = Trans(Trunc(&QUP,1) Y,YES N,NO ' ',NO *,*)
  Ver(&QUP,List,YES,NO)
  ver(&QFM Range,1,3)
  If (&QFM=1)
    &HDG='Name      Doc. Number   Title'
    &MDSI='                               $Ttlsind                            +'
    &MDL1='!SCODE+øName    +$Docnum      +$Title                              +'
  If (&QFM=2)
    &HDG='Doc. Number   Name      Title'
    &MDSI='                               $Ttlsind                            +'
    &MDL1='!SCODE+$Docnum      +øName    +$Title                              +'
  If (&QFM=3)
    &HDG='Title                               Name      Doc. Number'
    &MDSI='       $Ttlsind                            +                        '
    &MDL1='!SCODE+$Title                              +øName    +$Docnum      +'
)Field
FIELD(TITLE) SIND(TTLSIND)
)End

With the SFIHDR keyword specified on the )MODEL statement, the variable &MDSI is assumed to define scroll indicator fields for scrollable fields defined in the variable &MDL1.

Before panel SFIMOD is displayed, the dialog function must initialize the variable model lines as follows:

   &MDSI='                               $Ttlsind                            +'
   &MDL1='!SCODE+øName    +$Docnum      +$Title                              +'

The Title field in the model section is defined as a scrollable field with a separator indicator displayed in panel variable &TTLSIND (refer to the field section of the panel).

With this panel, the user can alter the order in which the fields in the model are displayed using the "Display format" field (QFM). For example, if the user enters 3 in this field the &MDL1 variable is modified so that the fields are displayed in the order Title, Name and Doc. Number, and the &MDSI variable is modified so that the separator indicator field is displayed above the Title field.

Figure 6 shows the panel display when &QFM equals 1.

Figure 6. SFIHDR Keyword in Variable Model Lines: Panel Example 1
 ------------------------------- Publication List ----------- Row 1 to 11 of 11
 Command ===>                                                  Scroll ===> PAGE

  Allow Update?  ==> NO  (Yes or No)
  Display format ==> 1   1. Name|Doc. Number|Title
                         2. Doc. Number|Name|Title
                         3. Title|Name|Doc. Number

 Select
 Code   Name      Doc. Number   Title
                                ---------------------------------->
        ISPZDG20  SC34-4821-02  z/OS V1R5.0 ISPF Dialog Developer's
        ISPZDT20  SC34-4824-02  z/OS V1R5.0 ISPF Dialog Tag Languag
        ISPZEM20  SC34-4820-02  z/OS V1R5.0 ISPF Edit and Edit Macr
        ISPZMC20  SC34-4815-02  z/OS V1R5.0 ISPF Messages and Codes
        ISPZPC20  GC34-4814-02  z/OS V1R5.0 ISPF Planning and Custo
        ISPZRS20  SC34-4816-02  z/OS V1R5.0 ISPF Reference Summary
        ISPZSC20  SC34-4817-02  z/OS V1R5.0 ISPF Software Configura
        ISPZSG20  SC34-4819-02  z/OS V1R5.0 ISPF Services Guide
        ISPZSR20  SC34-4818-02  z/OS V1R5.0 ISPF Software Configura
        ISPZUG20  SC34-4822-02  z/OS V1R5.0 ISPF User's Guide Volum
        ISPZU220  SC34-4823-02  z/OS V1R5.0 ISPF User's Guide Volum
 ******************************* Bottom of data ********************************

Figure 7 shows the panel display when &QFM equals 3.

Figure 7. SFIHDR Keyword in Variable Model Lines: Panel Example 2
 ------------------------------- Publication List ----------- Row 1 to 11 of 11
 Command ===>                                                  Scroll ===> PAGE

  Allow Update?  ==> NO  (Yes or No)
  Display format ==> 3   1. Name|Doc. Number|Title
                         2. Doc. Number|Name|Title
                         3. Title|Name|Doc. Number

 Select
 Code   Title                               Name      Doc. Number
        ---------------------------------->
        z/OS V1R5.0 ISPF Dialog Developer's  ISPZDG20  SC34-4821-02
        z/OS V1R5.0 ISPF Dialog Tag Languag  ISPZDT20  SC34-4824-02
        z/OS V1R5.0 ISPF Edit and Edit Macr  ISPZEM20  SC34-4820-02
        z/OS V1R5.0 ISPF Messages and Codes  ISPZMC20  SC34-4815-02
        z/OS V1R5.0 ISPF Planning and Custo  ISPZPC20  GC34-4814-02
        z/OS V1R5.0 ISPF Reference Summary   ISPZRS20  SC34-4816-02
        z/OS V1R5.0 ISPF Services Guide      ISPZSG20  SC34-4819-02
        z/OS V1R5.0 ISPF Software Configura  ISPZSC20  SC34-4817-02
        z/OS V1R5.0 ISPF Software Configura  ISPZSR20  SC34-4818-02
        z/OS V1R5.0 ISPF User's Guide Volum  ISPZUG20  SC34-4822-02
        z/OS V1R5.0 ISPF User's Guide Volum  ISPZU220  SC34-4823-02
 ******************************* Bottom of data ********************************

Example—using the TBDISPL and TBPUT services

This topic describes the use of the TBDISPL and TBPUT services in a dialog that displays rows of a table for possible modification by a user.

This dialog invokes the TBDISPL service to display a table named TAB1 with a panel named PAN1. The )BODY section of the panel definition corresponds to the fixed (non-scrollable) portion of the display. The )MODEL section of the panel definition corresponds to the scrollable portion of the display. This is where the table rows are displayed. The "model lines" in the )MODEL section are replicated enough times to fill the screen. Each of these replications is known as a model set, and corresponds to a row of the table. The fields in the model sets correspond to table columns.

Changes the user wishes to make in TAB1 are entered on the display directly into fields in the model sets. When the user enters data into a model set, the corresponding table row is said to be selected for processing.

After the user selects one or more rows, the TBDISPL service locates the first selected row and retrieves it. To retrieve a row means to position the CRP to that row, read it, and then store the row values into the function pool. Next, values from the changed model set are stored in the function pool.

The dialog function then invokes the TBPUT service to write the updated function pool variables to the table row. A user can also enter data, such as function commands, into the fixed portion of the display.

The user ends the dialog by entering the END or RETURN command.

This example does not illustrate:
  • Logic to insert or delete rows in the table
  • Verification of user-entered data by the dialog function or by the )PROC section in the panel definition
  • Controlling cursor placement on the display
  • Controlling which is the top row displayed.
The function can be started by a user at a terminal by the ISPSTART command. If the user has already started ISPF, the function can be started from:
  • A menu
  • The command field in any display with an application command that is defined in the current command table to have the SELECT action
  • Another function by using the SELECT service.

What follows is first a listing of the complete function, followed by each statement repeated, with supporting text and figures.

Command procedure function

  1. TBOPEN TAB1 WRITE
  2. Set &RC = 0
  3. Do while &RC < 8
  4. TBDISPL TAB1 PANEL(PAN1)
  5. Set &RC = return code
  6. Process fixed portion input
  7. Do while &PROCFLAG = ON
  8. Process scrollable portion input  TBPUT TAB1
  9. If &ZTDSELS > 1 Then
  10. TBDISPL TAB1
  11. Else
  12. Set &PROCFLAG = OFF
  13. End
  14. End
  15. TBCLOSE TAB1

Description of function steps

  1. TBOPEN TAB1 WRITE

    Open the table. Read table TAB1 into virtual storage for update. Here are the contents of table TAB1:

    Figure 8. Five Rows in Table TAB1
    EMPSER        LNAME        FNAME       I         PHA         PHNUM
    ------        ------       ------      --        ----        ------
    
    598304        Robertson    Richard     P         301         840-1224
    172397        Smith        Susan       A         301         547-8465
    813058        Russell      Charles     L         202         338-9557
    395733        Adams        John        Q         202         477-1776
    502774        Kelvey       Ann         A         914         555-4156
  2. Set &RC = 0

    Create a variable that will hold the return code from the TBDISPL service. In this example, the variable is called "RC". Initialize it to zero so that it will enter the loop in step 3.

  3. Do while &RC < 8

    Start the main loop. This will keep invoking TBDISPL to display the table until the user enters the END or RETURN command.

  4. TBDISPL TAB1 PANEL(PAN1)

    Display information from table TAB1 on panel PAN1. The current row, which is the row the CRP is pointing to, will be the top row displayed. If the CRP is at the top (CRP number zero), then the first row of the table will be the first row displayed. The display, as it appears at the terminal, is shown in Figure 9. Format of the display is controlled by a panel definition named PAN1, shown in Figure 10. TBDISPL, besides displaying the table, allows the user to scroll up and down the scrollable data in the display.

    Figure 9. Table TAB1 as Displayed Using Panel PAN1
     ----------------------------- Employee List ------------------------ ROW 1 OF 5
     Command ===>                                            Scroll ===> PAGE
    
        Notes ==>
     Make changes to any information except Employee Serial:
    
     ------ Employee Name --------         --- Phone ---          Employee
     Last         First         MI         Area  Number            Serial
    
     Robertson    Richard       P          301   840-1224          598304
     Smith        Susan         A          301   547-8465          172397
     Russell      Charles       L          202   338-9557          813058
     Adams        John          Q          202   477-1776          395733
     Kelvey       Ann           A          914   555-4156          503774
     ****************************** BOTTOM OF DATA *********************************
    
    
    
    
    
    
    
    
     
    Figure 10. Table Display Panel Definition PAN1
      )Attr
        _Type(Input) Intens(Low)
        # Type(Input) Intens(Low) Caps(off)
      )Body
      %----------------------------  Employee List  ---------------------------------
      %Command ===>_CMDFLD                                       %Scroll ===>_amt +;
      %
      +   Notes ==>#NOTES
      +Make changes to any information except Employee Serial:
      + 
      +------ Employee Name -------          --- Phone ---        Employee
      +Last         First        MI          Area  Number          Serial
      + 
      )Model
      _LNAME     _FNAME    _I       _PHA _PHNUM      _EMPSER
      )Init
        &AMT  = PAGE
      )Proc
        VPUT (Notes) Profile
      )End
    Control will be returned to the dialog function when the user performs one of these actions:
    • Presses the Enter key. The user may or may not have typed data into the fixed or scrollable portion of the screen.
      An exception to this condition occurs if all of these were true:
      • The user typed no data into the fixed portion of the screen.
      • The user typed no data into the scrollable portion of the screen.
      • The user pressed the Enter key.
      • Panel PAN1 had neither a )REINIT nor a )PROC section. PAN1 does in fact have a )PROC section.
      In this case, control would not be returned to the dialog function.
    • Enters the END or RETURN command. This may have been done by the user pressing a function key or by typing the command into the command field and pressing the Enter key. Panel PAN1, which is shown in Figure 10, has a command field named CMDFLD. The user may or may not have typed other data into the fixed or scrollable portion of the screen.
    • Enters the UP or DOWN scroll command when data has been typed into the fixed or scrollable portion of the screen.
    Control will not be returned to the dialog function when the user performs one of these actions:
    • Presses the Enter key when no data has been typed into the fixed or scrollable portion of the screen and the panel definition contains neither a )REINIT nor a )PROC section.
    • Enters the UP or DOWN scroll command when no data has been typed into the fixed or scrollable portion of the screen.
    • Enters a system command other than UP, DOWN, END, or RETURN. For example, HELP, SPLIT, or CURSOR.
    • Enters an application command that selects another dialog.

    When a model set in the scrollable part of the display has been changed, the corresponding table row is said to be a selected row. TBDISPL retrieves the selected row. To retrieve a row means to position the CRP to that row, read it, and then store the row values into the function pool. Next, values from the changed model set are stored in the function pool. If there are no selected rows, then the CRP is set to zero.

  5. Set &RC = return code
    Save the return code from TBDISPL in variable RC. This variable controls the loop starting in step 4. These return codes are possible:
     0
    There were zero or one selected rows
     4
    There were two or more selected rows
     8
    The user entered the END command. Any number of rows, including zero, may have been selected.

    It is possible that TBDISPL will issue severe error return codes of 12 or 20. Because CONTROL ERRORS CANCEL, the default value, is in effect, ISPF will cancel the dialog function.

  6. Process fixed portion input
    Process the data the user typed into the fixed portion of the display. On a table display panel definition, the )BODY section defines the fixed portion of the display and the )MODEL section defines the scrollable portion of the display. Panel PAN1, shown in Figure 10, has three input fields in the )BODY section:
    CMDFLD
    The command field
    AMT
    The scroll amount field
    NOTES
    A "notepad" field

    Users can enter ISPF system commands such as END, RETURN, UP, DOWN, HELP, and SPLIT in the CMDFLD field. Or, they can enter an application command that SELECTs another dialog, if there is such a command defined in the active command table. Users can also enter function commands. These are commands that are handled by the dialog function. CANCEL is an example of a function command. The function could check if CMDFLD had the value CANCEL. If so, a TBEND could be issued. In this example, there would also have to be logic to leave the TBDISPL loop after the TBEND is issued.

    The second input field, AMT, is the scroll amount field. Changes to this field are always handled by ISPF. The TBDISPL service does not consider changes to this field as "input to the fixed portion of the screen".

    The third input field, NOTES, could be used as a small on-screen notepad. The )PROC section of PAN1 uses the VPUT service to put this variable into the profile pool. In this field, the user could write short notes that are to be remembered from one session to the next.

    This example shows the processing of the fixed portion input as step 6. It is done before the processing of the scrollable portion input. This would be natural for handling a CANCEL command. However, if for example, the dialog function also handled a SAVE command, which would result in a TBSAVE, the dialog writer may want that processing to occur after the scrollable portion input processing.

    The processing of the fixed portion input can be placed:

    1. Before the processing of all selected rows (step 6)
    2. After the processing of all selected rows (between steps 13 and 14)
    3. Before the processing of each selected row (between steps 7 and 8)
    4. After the processing of each selected row (between steps 8 and 9)
  7. Set &PROCFLAG = ON

    Create a variable that indicates there are selected rows. In this example, the variable is called "PROCFLAG". Initialize this flag to ON so it will enter the loop in step 8.

  8. Process scrollable portion input  TBPUT TAB1

    Process the scrollable portion input. Here, the current selected row is processed. In this example, the TBPUT service is invoked to update the row. The function pool values of variables corresponding to table columns are written to the table row.

    If the processing of the scrollable portion input includes invoking any service that resulted in a display, such as BROWSE, EDIT, DISPLAY, or another TBDISPL, then the CONTROL service must be invoked to save and then restore the table display control information, such as pending selected rows. Example:
    TBDISPL TAB1 PANEL(PAN1)
    Display table TAB1 with panel PAN1, assuming you select several rows
    CONTROL DISPLAY SAVE
    Save "control" information
    DISPLAY PANEL(PAN2)
    Display panel PAN2
    CONTROL DISPLAY RESTORE
    Restore the "control" information
    TBDISPL TAB1
    Invoke TBDISPL to get the next selected row
    CONTROL DISPLAY SAVE
    Save "control" information
    DISPLAY PANEL(PAN2)
    Display panel PAN2
    CONTROL DISPLAY RESTORE
    Restore the "control" information

    If non-ISPF displays are processed, instead of using CONTROL DISPLAY SAVE and CONTROL DISPLAY RESTORE, use CONTROL DISPLAY REFRESH either before or after the non-ISPF display is done.

  9. If &ZTDSELS > 1 Then

    Determine if there are any pending selected rows. If ZTDSELS is zero, there were no selected rows and this step would not have been reached (see Step 7). If ZTDSELS is one, then there was one selected row. This is the current row and there are no pending selected rows. If ZTDSELS is more than one, then there is the current selected row and at least one pending selected row.

  10. TBDISPL TAB1

    Reinvoke TBDISPL without the PANEL or MSG parameter to get the next selected row. That is, the CRP will be positioned to the next selected row to retrieve that row, and the function pool values of variables corresponding to fields in the scrollable portion will be updated to reflect changes made to the corresponding model set on the display.

  11. Else

    Since ZTDSELS is not greater than one (Step 9) but is greater than zero (Step 7), then ZTDSELS must equal one. This means that there are no pending selected rows.

  12. Set &PROCFLAG = OFF

    Force control to leave the loop started in Step 7. All selected rows have been processed.

  13. End

    End the selected row processing loop.

  14. End

    End the main loop, which displays table TAB1 with panel PAN1.

  15. TBCLOSE TAB1

    Close table TAB1. Write the updated version of TAB1 to disk, and delete the virtual storage copy.

TBDISPL summary

  1. Floating command line

    If the command line for a table display panel has been moved to the bottom position, and if no alternate placement has been specified for the long message line, the line directly above the repositioned command line is reserved (left blank) for the display of long messages. Otherwise, if a user entered erroneous data on that line, a long message could overlay that data.

    ISPF adjusts display scrolling to account for the line reserved for long messages.

  2. TBDISPL does not modify the table

    TBDISPL itself does not modify the table. The dialog function can use the information entered by the user to determine what processing is to be performed and can modify the table accordingly.

  3. Displaying an empty table

    It is acceptable to invoke TBDISPL to display a table with no rows. The scrollable portion will consist only of the bottom-of-data marker. In previous versions, this resulted in a severe error, return code = 20, message = ISPT051.

  4. CSRROW and auto-selection

    Specifying the CSRROW parameter or control variable without setting the AUTOSEL parameter or control variable to "NO" results in the row being selected, even if the user did not explicitly select the row. This is called auto-selection.

  5. Dual defaults for CAPS and JUST

    In the )BODY section of a table display panel, input and output fields default to CAPS(ON) and JUST(LEFT). In the )MODEL section, they default to CAPS(OFF) and JUST(ASIS). These dual defaults exist to allow both new capability in this version and compatibility with previous versions of the product.

  6. Effect of having a )REINIT or )PROC section

    TBDISPL behavior is affected by whether a )REINIT or )PROC section is included in the panel definition. When a )REINIT or )PROC section is included, and the user makes no modification to the screen and presses the Enter key, TBDISPL returns control to the dialog function. On the other hand, if neither a )REINIT nor a )PROC section is included, and the user makes no modification to the screen and presses the Enter key, TBDISPL treats this as a "no operation", and control does not return to the dialog function. This is to allow both new capability in this version and compatibility with previous versions of the product.

  7. Search arguments in conjunction with TBDISPL

    Only search arguments specifying a forward scan through the table should be used in conjunction with TBDISPL. Otherwise, TBDISPL does not support scrolling through the display.

  8. TBDISPL parameters and their categories:
               Required    Optional
     Service   Parameter   Parameters                  Categories
    
     TBDISPL   table-name                              in  name
                           [PANEL(panel-name)]         in  name
                           [MSG(message-id)]           in  name
                           [CURSOR(field-name)]        in  name
                           [CSRROW(table-row-number)]  in  number
                           [CSRPOS(cursor-position)]   in  number
                           [AUTOSEL(YES|NO)]           in  key
                           [POSITION(crp-name)]        out number
                           [ROWID(rowid-name)]         out number
    in
    Indicates that the parameter is used to pass information from the dialog to ISPF.
    out
    Indicates that the parameter is used to enable ISPF to pass information to the dialog. ISPF will create a variable with the indicated name.
    key
    Indicates it is a keyword parameter.
    name
    Indicates the value specified in the parameter is a name.
    number
    Indicates the value specified in the parameter is a number.
  9. These items can appear in the )BODY section of a table display panel definition:
    • Text
    • Variables within text, such as "&XYZ"
    • Input fields
    • Output fields
    • Dynamic areas that are not scrollable or extendable
    • A graphic area that is not extendable.
  10. These items cannot appear in the )BODY section of a table display panel definition:
    • Dynamic areas that are scrollable or extendable
    • More than one graphic area. This is true for any panel
    • A graphic area that is extendable. Graphic areas are never scrollable.
  11. These items can appear in the )MODEL section of a table display panel definition:
    • Text
    • Variable model lines
    • Input fields
    • Output fields.
  12. These items cannot appear in the )MODEL section of a table display panel definition:
    • Variables within text
    • Dynamic areas
    • Graphic areas.
  13. During TBDISPL display, these user actions return control to the dialog function:
    • Pressing the Enter key. See item 6 in TBDISPL summary for an exception.
    • Entering the END or RETURN command
    • Entering the UP or DOWN scroll command when data has been typed into the fixed or scrollable portion of the screen
    • Entering the UP or DOWN scroll command when using dynamic table expansion and more rows are needed to satisfy the scroll request.
  14. During TBDISPL display, these user actions do not return control to the dialog function:
    • Pressing the Enter key when no data has been typed into the fixed or scrollable portion of the screen and the panel definition has neither a )REINIT nor a )PROC section
    • Entering the UP or DOWN scroll command without typing data into the fixed or scrollable portion of the screen. Also, control does not return to the dialog function in either of these two cases:
      • Dynamic table expansion is not defined
      • Dynamic table expansion is defined and the table already contains enough rows to satisfy the scroll.
    • Entering a system command other than UP, DOWN, END, or RETURN. For example: HELP, SPLIT, PRINT, or CURSOR.
    • Entering an application command that selects another dialog.
  15. These return codes are possible from TBDISPL:
     0
    There were zero or one selected rows. A scroll may be pending.
     4
    There were two or more selected rows.
     8
    The END or RETURN command was entered. Any number of rows, including zero, may have been selected.
    12
    The specified panel or message could not be found or the specified table was not open.
    20
    Severe error.
  16. Levels of commands:
    System commands
    Provided by ISPF and always available to a user, unless explicitly overridden by an application. For example: END, UP, HELP, PRINT.
    Application commands
    Available to a user throughout operation of an application. For example: a command defined in the active command table that SELECTs another dialog.
    Function commands
    Meaningful only while operating a particular function within an application. For example, the dialog function can be designed so that TBSORT is invoked when the user enters "SORT" in the command field.
  17. Commands can be entered by:
    • Typing information into the command field and pressing the Enter key
    • Pressing a function key
    • Selecting an ATTENTION FIELD using the light pen or cursor select key.
  18. TBDISPL does not rebuild the display until all selected rows have been successfully processed. Therefore, the CRPs of the displayed table will not match those of the actual table if the order or structure of the table is changed within a TBDISPL series. This can affect correct cursor row placement for a redisplay with message while in the series.

    It is recommended that any verification of selected rows be done for all selected rows before performing operations that change the order or structure of the table. This requires that selected row IDs be saved until all selected rows have been retrieved and validated. This affects only the cursor placement as just described. The value passes back in the name specified with the POSITION keyword contains the CRP of the row in the actual table.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014