Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Redisplaying table at certain row 1

Status
Not open for further replies.

telesimke

IS-IT--Management
Jul 21, 2011
27
SI
Hi!

I'm trying to redisplay a table at a certain row? The table is showing a certain row. If the user presses ENTER the table is erased and recreated. I want it to be at the same row as before erasure. I tried that by using ZTDSCRP and got stuck because I can't bring it into main program.

Code:
    DO WHILE RC=0                                     
      CALL getlines                               
      address ISPEXEC                             
                                          
      /*get row value                   
                                          
      "TBERASE TAB1"                              
      "TBCREATE TAB1 NAMES(linet) NOWRITE REPLACE"
      address TSO                                 
      DO num=1 TO QUEUED()                        
         PARSE PULL qline                         
         linet=qline                              
         address ISPEXEC "TBADD TAB1"             
      END                                         
      address ISPEXEC "TBTOP TAB1"  
     /*here i need to set row number*/              
      address ISPEXEC "TBDISPL TAB1 PANEL(DTAB)"

Best regards,
Jaka
 
Since you set address to ISPEXEC, you don't to repeat it in each command

Row_Num = 47 /* i.e. */

"TBTOP TAB1"
"TBSKIP TAB1 Number("Row_Num")"
"TBDISPL TAB1 PANEL(DTAB)"
 
Thank you RxUsr!

Still I have not find a way to get ZTDTOP variable to set Row_Num.
Please help!
BR jaka

 
Does anybody know how to reach variables in ISPF function pool via REXX?

We know that ISPEXEC does not support VDEFINE the access function for function pool. Can we use ISPLINK in REXX?

Thanks!
 
The TBTOP service sets the current row pointer (CRP) to the top of a table, ahead of the first row.

The TBSKIP service moves the current row pointer (CRP) of a table forward or backward by a specified number of rows and retrieves the row to which it is pointing unless the NOREAD parameter is specified.

If you know the row number, TBSKIP should get you there without trying to set any "Z" variable.
(Did you try it?)
 
Yes I did and it works!
But I want to:

-create a table
-scroll through table
-refresh table (PF1)
-display the table at the same row where refresh occurred

Problem is in getting the row number form function pool. Since (so it seems) VDEFINE is only accessible through compiled code and VGET returns a "" I have nothing to put into TBSKIP. The table after it is refreshed points to the first row although ztdscrp="".

"VGET (ztdscrp)"
"TBSKIP TAB1 NUMBER("ztdscrp")"

Life sucks!
 
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.

"TBDISPL TAB1 PANEL(DTAB)"
Row_Num = ZTDTOP
 
I tried this and it doesn't work in my shop. Did it work for you?
Would it work if I compiled the program?
Thanks!
 
My panel:

Code:
[b])Attr[/b]                                                      
! TYPE(OUTPUT) COLOR(TURQ)                                      
% TYPE(TEXT) INTENS(HIGH) COLOR(YELLOW)                         
[b])Body Expand(//)[/b]                                          
                                                                
%Command ===>_zcmd                              %Scroll ===>_amt
[b])Model[/b]                                               
!linet                                                          
[b])Init[/b]                                              
&amt = page                                                     
.cursor=zcmd                                                    
[b])Proc[/b]                                                  
[b])End[/b]

REXX is quite long because program contains a lot of parsing. What it dos it calls TSO commands, traps messages, parses lines and adds them into this single column table.
Basically it produces a scrollable and refreshable TSO output.
BR Jaka

 
Here is a basic REXX to display and re-display a table

/* REXX ---------------------*/
Call ViewText
exit 0
/*--------------------------------*/
/* View Message Text */
/*--------------------------------*/
ViewText:
Address ISPEXEC
TblName = 'TAB1'
"TBCREATE" TblName "NAMES(linet) NOWRITE REPLACE"

Do i = 1 to 100 /* Add text to table */
linet = "Line" i
"TBADD" TblName
End

iRow = 0
"TBTOP" TblName /* Display table */
"TBSKIP" TblName "NUMBER("iRow") NOREAD"
"TBDISPL" TblName "PANEL(Dtab)"
iRow = ZTDTOP
"TBBOTTOM" TblName "NOREAD"

Do i = 101 to 103 /* Add more text to table */
linet = "Line" i
"TBADD" TblName
End

say iRow 'Refresh table'
"TBTOP" TblName /* Display table */
"TBSKIP" TblName "NUMBER("iRow") NOREAD"
"TBDISPL" TblName "PANEL(Dtab)"
iRow = ZTDTOP
say again ZTDTOP iRow
"TBCLOSE" TblName /* Clean-up */
Address
Return
 
When I run your example iRow contains text 'ZTDTOP' instead of row number.
I hate being a pessimist but function pool variables can not be accessed through procedural languages.
 
This was a quick test to figure out how to display the panel on the row where it was last displayed:

Code:
crp = 1                                              
"ISPEXEC TBTOP tbl0"                                 
"ISPEXEC TBSKIP tbl0 NUMBER("crp")"                  
Do Forever                                           
  "ISPEXEC TBDISPL tbl0 PANEL(panel)"              
  If rc <> 0 Then Leave                              
  crp = ztdtop                                       
  "ISPEXEC TBTOP tbl0"                               
  "ISPEXEC TBSKIP tbl0 NUMBER("crp")"                
  Say crp                                            
End                                                  
"ISPEXEC TBCLOSE tbl0"
 
I could not get iROW=ztdtop working.
But this works:
-added keys param:
"TBCREATE TAB1 KEYS(rownum) NAMES(linet) NOWRITE REPLACE"

-get crp:
"TBGET TAB1 POSITION(row)"

-and:
"TBSKIP TAB1 NUMBER("row")"

BR Jaka
 
One more thing:

ztdtop also works but it receives a value only after a scroll command was issued.
Thank you for your help guys!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top