Page 1 of 1

Conditional Display [TBDISPL] before using any panel

PostPosted: Tue Jul 19, 2016 5:03 pm
by nkulkarni
Hi,

In a program I display an ISPF table using below code (which is working fine :-) )...


display_coll:                                
                                             
do forever                                  
   zcmd = ''                                
   ztdsels = 0                              
   "ISPEXEC TBDISPL COLLDATA PANEL(SIAELM98)"
   prc = rc                                  
   SELECT                                    
     WHEN ztdsels > 0 THEN DO                
         "ADDPOP ROW(01) COLUMN(03)"        
         "DISPLAY PANEL(SIAELM97)"          
          prc = rc                          
         "REMPOP ALL"                        
          END                                
     WHEN prc <> 0 then do                  
          leave                              
          end                                
     OTHERWISE NOP                          
   END                                      
 


I want to display contents of the table "COLLDATA" conditionally using the panel "SIAELM98" when table has more than 1 row...Else I want to display the data using panel "SIAELM97"

Could you please help ?

Re: Conditional Display [TBDISPL] before using any panel

PostPosted: Tue Jul 19, 2016 7:02 pm
by willy jensen
The TBQUERY command can return the number of rows.

Re: Conditional Display [TBDISPL] before using any panel

PostPosted: Tue Jul 19, 2016 9:14 pm
by Pedro
... and after knowing how many panels you have, use a variable for the panel name:

if tablrows > 1 Then
  panname = SIAELM98
Else
  panname = SIAELM97
do forever                                  
   zcmd = ''                                
   ztdsels = 0                              
   "ISPEXEC TBDISPL COLLDATA PANEL("panname")"
 

Re: Conditional Display [TBDISPL] before using any panel

PostPosted: Wed Jul 20, 2016 3:56 pm
by nkulkarni
Thank you Pedro & Willy Jensen. I have used TBQUERY command to load the number of rows in the table to a variable and used it in conditional processing...