Overview
ISPF table service, TBDISPL, is a powerful service! Not only will TBDISPL create a scrollable display of table data using a special ISPF model panel definition, TBDISPL also allows selected row(s) to be processed in a CLIST or dialog manager program one by one.
Add, Change, Delete, Inquiry using ISPF TBDISPL
In the following panel, PEMPL3US, action request(s) (ADD, CHANGE, DELETE, INQUIRY) can be used to ‘mark’ the maintenance action to be performed upon submission. For example, employee (EMPSER) 801 and 812 are ear-marked with the appropriate action code (Change and Inquiry, respectively) for processing when ENTER is depressed.
-------------------------- Employee Serial Listing -- ROW 1 OF 25 OPTION ===> SCROLL ===> PAGE Panel: PEMPL3US PF3-End PF7-Scroll Up PF8-Scroll Down Table: EMPLTBL0 Select the employee for maintenace using the SEL column and press ENTER A Add Employee C Change Employee D Delete Employee I Inquiry Employee More than one selection can be submitted per display screen. SEL Last Name First Name Phone Number EMPSER --- --------------- --------------- ------------ ------ LASTNAME FIRST 800 800 555-1212 800 C LASTNAME FIRST 801 800 555-1212 801 LASTNAME FIRST 802 800 555-1212 802 LASTNAME FIRST 803 800 555-1212 803 LASTNAME FIRST 804 800 555-1212 804 I LASTNAME FIRST 812 800 555-1212 812 LASTNAME FIRST 813 800 555-1212 813 LASTNAME FIRST 814 800 555-1212 814 LASTNAME FIRST 822 800 555-1212 822 LASTNAME FIRST 823 800 555-1212 823 LASTNAME FIRST 824 800 555-1212 824 LASTNAME FIRST 832 800 555-1212 832
The TBDISPL display and selection logic to support the above panel is highlighted in the table below followed by a narrative description:
+-----------------------------------------+----------------------------------------------------------+ | CLIST Command | Description | +-----------------------------------------+----------------------------------------------------------+ | 1. ISPEXEC TBOPEN tablename WRITE | Open table for output | | 2. SET &TRC = 0 | TBDISPL return code variable initialized to 0 | | 3. SET &SEL = &STR( ) | TBDISPL select row variable set to blanks | | 4. DO WHILE &TRC < 8 | Loop until END/RETURN is detected | | 5. ISPEXEC TBDISPL tablename + | Display table rows | | PANEL(panelid) | per model definition | | 6. SET &TRC = &LASTCC | Save TBDISPL rc into TRC variable | | | &TRC = 8, END/RETURN detected | | | &TRC = 4, Two or more rows selected from display | | | &TRC = 0, Zero or one rows selected from display | | 7. SET &SELECTED = YES | Assume rows have been selected for loop control | | 8. DO WHILE (&SELECTED = YES) AND + | Loop while SELECTED = Y and | | (&TRC < 8) | TRC < 8 (not END/RETURN) | | 9. IF &ZTDSELS > 0 | Any selected rows? (ZTDSELS = number of selected rows) | | 10. DO | Yes, | | 11. ... | All table variables available | | 12. ... | for selected row. Specific logic for | | 13. ... | defined action(s) placed here. | | 14. END | | | 15. IF &ZTDSELS > 1 | Do I have more to process? (ZTDSELS adjusted by TBDISPL) | | 16. ISPEXEC TBDISPL tablename | Yes, get next selected row from display | | 17. ELSE | | | 18. SET &SELECTED = NO | No, stop DO-WHILE | | 19. END | DO WHILE SELECTED = YES and TRC < 8 | | 20. END | DO-WHILE &TRC < 8 | | 21. ISPEXEC CLOSE tablename | Save changes and close table | | | | +-----------------------------------------+----------------------------------------------------------+
Upon CLIST start, the table is opened and two variables initialized (lines 1-3).
Two DO-WHILE loops control the display of the table data (outer loop) and processing of selected rows (inner loop).
The outer DO-WHILE (line 4) displays the Employee Serial Listing panel (as shown in panel PEMPL3US without the selection codes C and I) and waits for user input (line 5).
Upon user interrupt (e.g. ENTER or END), the TBDISPL return code (line 6) is saved and the inner DO-WHILE (line 8) initiates unless END or RETURN (RC=8 on END or RETURN) is detected terminating both DO-WHILE loops followed by closing the table (line 21) and terminating the CLIST.
If selections are detected (line 9), the current row is fetched and processed (lines 10-14). If another selection is detected, the next row is fetched (line 16) and the inner DO-WHILE (line 8) reiterates processing that selection (lines 10-14). This inner DO-WHILE continues until no more selections.
When no selections are detected, the inner DO-WHILE (line 8) terminates returning control to the outer DO-WHILE (line 4) resulting in redisplaying the Employee Serial Listing panel and waiting on user input (line 5). The outer DO-WHILE continues until the user terminates with END or RETURN.
Scrolling UP or DOWN is facilitated by ISPF TBDISPL internally and not by the CLIST.
The above representative logic flow is used by CLIST, CEMPL1R, part of a educational and learning set of software titled Using ISPF Table Services in MVS 3.8J. For more information, jump to link on this site.
Updates using ISPF TBDISPL
As another example of TBDISPL updates, panel PEMPL3U facilitates employee updates for the displayed columns (Last Name, First Name, Phone Number) by over-typing employee data and submitting for processing using the ENTER key. Note, the end-user experience is different from specifying action codes.
-------------------------- Employee Serial Listing -- ROW 1 OF 25 OPTION ===> SCROLL ===> PAGE Panel: PEMPL3U PF3-End PF7-Scroll Up PF8-Scroll Down Table: EMPLTBL0 Make changes to any information and press ENTER Last Name First Name Phone Number EMPSER --------------- --------------- ------------ ------ LASTNAME FIRST 800 800 555-1212 800 LASTNAME FIRST 801 800 555-1212 801 LASTNAME FIRST 802 800 555-1212 802 LASTNAME FIRST 803 800 555-1212 803 LASTNAME FIRST 804 800 555-1212 804 LASTNAME FIRST 812 800 555-1212 812 LASTNAME FIRST 813 800 555-1212 813 LASTNAME FIRST 814 800 555-1212 814 LASTNAME FIRST 822 800 555-1212 822 LASTNAME FIRST 823 800 555-1212 823 LASTNAME FIRST 824 800 555-1212 824 LASTNAME FIRST 832 800 555-1212 832 LASTNAME FIRST 833 800 555-1212 833 LASTNAME FIRST 834 800 555-1212 834
The TBDISPL display and selection logic to support the above panel is highlighted in the table below followed by a narrative description:
+-----------------------------------------+----------------------------------------------------------+ | CLIST Command | Description | +-----------------------------------------+----------------------------------------------------------+ | 1. ISPEXEC TBOPEN tablename WRITE | Open table for output | | 2. SET &TRC = 0 | TBDISPL return code variable initialized to 0 | | 3. DO WHILE &TRC < 8 | Loop until END/RETURN is detected | | 4. ISPEXEC TBDISPL tablename + | Display table rows | | PANEL(panelid) | per model definition | | 5. SET &TRC = &LASTCC | Save TBDISPL rc into TRC variable | | | &TRC = 8, END/RETURN detected | | | &TRC = 4, Two or more rows selected from display | | | &TRC = 0, Zero or one rows selected from display | | 6 SET &FSTROW = &ZTDTOP | Save 1st displayed row on current panel | | 7. &SELECTED = YES | Assume rows have been selected for loop control | | 8. DO WHILE (&SELECTED = YES) AND + | Loop while SELECTED = Y and | | (&TRC < 8) | TRC < 8 (not END/RETURN) | | 9. IF &ZTDSELS > 0 | Any selected rows? (ZTDSELS = number of selected rows) | | 10. DO | Yes, | | 11. ISPEXEC TBPUT tablename | Update selected EMPSER with revised table variables | | 12. END | | | 13. IF &ZTDSELS > 1 | Do I have more to process? (ZTDSELS adjusted by TBDISPL) | | 14. ISPEXEC TBDISPL tablename | Yes, get next selected row from display | | 15. ELSE | | | 16. SET &SELECTED = NO | No, stop DO-WHILE | | 17. END | DO WHILE SELECTED = YES and TRC < 8 | | 18. ISPEXEC TBTOP tablename | Position to top of table | | 19. ISPEXEC TBSKIP tablename | Reposition to 1st row displayed before updates commenced | | NUMBER(&FSTROW) | to refresh panel list with applied updates | | 20. END | DO-WHILE &TRC < 8 | | 21. ISPEXEC CLOSE tablename | Save changes and close table | | | | +-----------------------------------------+----------------------------------------------------------+
Upon CLIST start, the table is opened and one variables initialized (lines 1-2).
Two DO-WHILE loops control the display of the table data (outer loop) and processing of selected rows (inner loop).
The outer DO-WHILE (line 3) displays the Employee Serial Listing panel (as shown in panel PEMPL3U) and waits for user input (line 4).
Upon user interrupt (e.g. ENTER or END), the TBDISPL return code (line 5) is saved and the inner DO-WHILE (line 8) initiates unless END or RETURN (RC=8 on END or RETURN) is detected terminating both DO-WHILE loops followed by closing the table (line 21) and terminating the CLIST.
If selections are detected (line 9), the current row is fetched and processed via TBPUT (line 11). If another selection is detected, the next row is fetched (line 14) and the inner DO-WHILE (line 8) reiterates processing that selection (line 11). This inner DO-WHILE continues until no more selections.
When no selections are detected, the inner DO-WHILE (line 8) terminates returning control to the outer DO-WHILE (line 3) resulting in redisplaying the Employee Serial Listing panel and waiting on user input (line 4). The outer DO-WHILE continues until the user terminates with END or RETURN.
Scrolling UP or DOWN is facilitated by ISPF TBDISPL internally and not by the CLIST.
The above representative logic flow is used by CLIST, CEMPL1Q, part of a educational and learning set of software titled Using ISPF Table Services in MVS 3.8J. For more information, jump to this link on this site.
In closing…
The TBDISPL service offers several optional variables to the software developer to tailor messaging and row processing. Refer to an IBM ISPF Developers Reference manual such as release 3 for best table services reference.
Refer to this link for customizing the bottom-of-data message or this link for altering the top-row-data message for table display panels.