View previous topic :: View next topic
|
Author |
Message |
epicdave
New User
Joined: 11 Oct 2007 Posts: 20 Location: New York
|
|
|
|
Hi all,
I'm working on a project where I need to dynamically update a table displayed in an ISPF panel I've created. This updating is done depending on the position of the cursor when the command is issued. So for example, if the panel displays a table of information, and the user scrolls down to a line and executes a command, the table will be altered to display only some of the data.
I've got the table setup and the machine is able to determine where the cursor is and what rows of the table need to be deleted. My issue is with TBDELETE. The ISPF Reference Summary gives you
Quote: |
TBDELETE—delete a row from a table
Command invocation format
-----------------------------------
ISPEXEC TBDELETE table-name
Call invocation format
---------------------------
CALL ISPEXEC (buf-len, buffer); OR CALL ISPLINK (’TBDELETE’, table-name); TBCLOSE service
Return codes
----------------
0 Normal completion.
8 Keyed tables: the row specified by the value in key variables does not exist; CRP set to TOP (zero). Non-keyed tables: CRP was at TOP (zero) and remains at TOP.
12 Table is not open.
20 Severe error. |
which isn't very helpful I understand that TBDELETE will remove the line of a table that the row pointer currently points to. I've tried setting the row pointer to the line(s) I need to delete but it doesn't seem to work.
Does anyone know how to specify which row(s) you want TBDELETE to delete? |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
I do not know if it will help You, but here is a snippet of code that works
it updates the ispf command table reading from a file
if the verb is found it deletes the row and adds the new one
( easier then replace all the columns )
Code: |
Do While ( getcmds() = 0 )
call $ispex("TBTOP ISPCMDS" )
zrc = $ispex("TBSCAN ISPCMDS ARGLIST(ZCTVERB) NOREAD ")
Select
When zrc = 0 Then Do
call $ispex("TBDELETE ISPCMDS ")
call $ispex("TBADD ISPCMDS ")
End
When zrc = 8 Then Do
call $ispex("TBADD ISPCMDS ")
End
Otherwise do
zerrsm = left(_commnd,8)"- Table Error"
zerrlm = "Rc("zrc") Scanning table ISPCMDS"
zretc = 4
call $term
exit
End
End
End
$ispex:
trace "O"
Address ISPEXEC arg(1)
isp_0rc = rc
return isp_0rc |
|
|
Back to top |
|
|
epicdave
New User
Joined: 11 Oct 2007 Posts: 20 Location: New York
|
|
|
|
I should have mentioned in my first post that using TBSCAN would have been problematic as the search string would have been numeric, and appears multiple times in each line of the table. My mentor came up with a useful bit of code that allows you to delete specific ranges of rows from a table, w/o having to start from the top and scan the whole thing. Below is a bit of sample code that demonstrates the function's capabilities:
Code: |
/* REXX */
ADDRESS ISPEXEC
'TBCREATE EXTABLE KEYS(LINE) NAMES(EXA) NOWRITE'
/* ADD 25 ENTRIES TO TABLE */
LINE = 1
DO UNTIL (LINE > 25)
EXA = 'A'||LINE
'TBADD EXTABLE'
'TBPUT EXTABLE'
'TBQUERY EXTABLE ROWNUM(ROWS)'
LINE = LINE + 1
END
/* DELETE LINES 6 THROUGH 10 */
CALL XTBD('6' '10')
/* DELETE LINES 13 AND 14 */
L1 = 13
L2 = 14
CALL XTBD(L1 L2)
/* DISPLAY WHAT IS IN TABLE NOW */
LINE = 1
DO UNTIL (LINE > 25)
'TBGET EXTABLE'
IF (RC=0) THEN
DO
SAY LINE EXA
END
LINE = LINE + 1
END
'TBEND EXTABLE'
/* SUBROUTINE FOR DELETING LINES FROM TABLE */
XTBD:
PARSE ARG FIRST LAST
LINE = FIRST
DO UNTIL (LINE > LAST)
'TBDELETE EXTABLE'
LINE = LINE + 1
END
RETURN
|
I hope that helps anyone else who has the same issue, and as always, thank you for all your help!!
David |
|
Back to top |
|
|
AbuHaya
New User
Joined: 30 Jul 2008 Posts: 1 Location: Rochester, MN
|
|
|
|
when calling the table to display, give a variable for the row number
Like this:
Code: |
address ISPEXEC "TBDISPL <TableName> PANEL(<PanelName) ROWID(rowloc)" |
when deleting, "rowloc" will return the row the user choose
Like this:
Code: |
Address ISPEXEC "TBDELETE <TableName> ROWID(rowloc)" |
|
|
Back to top |
|
|
ermanjitsingh
New User
Joined: 08 Jun 2009 Posts: 19 Location: Banglore
|
|
|
|
AbuHaya wrote: |
when deleting, "rowloc" will return the row the user choose
Like this:
Code: |
Address ISPEXEC "TBDELETE <TableName> ROWID(rowloc)" |
|
"TBDELETE vcdtbl ROWID(rowloc)"
I tried this line of code. And its giving the error :
Code: |
ISPS103
Too many parameters
Unexpected parameters were found on the dialog service statement.
Current dialog statement:
TBDELETE vcdtbl ROWID(rowloc)
|
I don't think that we can use ROWID option with TBDELETE.
Any one have any idea that can we use ROWID with TBDELETE or not ? |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
What does it say in the manual ? |
|
Back to top |
|
|
|