IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

ISPF - TBDELETE help to delete a row from a table


IBM Mainframe Forums -> TSO/ISPF
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
epicdave

New User


Joined: 11 Oct 2007
Posts: 20
Location: New York

PostPosted: Wed Oct 24, 2007 9:07 pm
Reply with quote

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 icon_rolleyes.gif 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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Wed Oct 24, 2007 9:56 pm
Reply with quote

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
View user's profile Send private message
epicdave

New User


Joined: 11 Oct 2007
Posts: 20
Location: New York

PostPosted: Sat Oct 27, 2007 1:07 am
Reply with quote

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!!

icon_biggrin.gif David
Back to top
View user's profile Send private message
AbuHaya

New User


Joined: 30 Jul 2008
Posts: 1
Location: Rochester, MN

PostPosted: Wed Aug 20, 2008 12:29 am
Reply with quote

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
View user's profile Send private message
ermanjitsingh

New User


Joined: 08 Jun 2009
Posts: 19
Location: Banglore

PostPosted: Wed Jul 15, 2009 4:51 pm
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Wed Jul 15, 2009 4:57 pm
Reply with quote

What does it say in the manual ?
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> TSO/ISPF

 


Similar Topics
Topic Forum Replies
No new posts DELETE SPUFI DB2 1
No new posts Load new table with Old unload - DB2 DB2 6
No new posts DSNTIAUL driven delete IBM Tools 0
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Looking for a little history of ISPF ... TSO/ISPF 5
Search our Forums:

Back to Top