Locating rows in an ISPF Table



IBM's Command List programming language & Restructured Extended Executor

Locating rows in an ISPF Table

Postby zingysayal1985 » Sun Apr 17, 2016 3:36 am

Hi,
I'm displaying a table of 700 or so rows, and want to emulate the LOCATE
command in ISPF, by jumping to a row beginning with, say "F" by typing "L F"
in the command line.

How do I do it?
zingysayal1985
 
Posts: 8
Joined: Sun Mar 20, 2016 7:45 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Locating rows in an ISPF Table

Postby willy jensen » Mon Apr 18, 2016 8:03 pm

Some snippets that might help. Also look at TBSARG in the ISPF dialog guide.

 ttop=0                                                
 "tbtop"   $table                                      
 do while ttop=0 /* search table */                    
  "tbskip" $table "position(p)"                        
   if rc<>0 then ...  /* end of table */                
   if .... then then ttop=p /* found */                
 end                                                    
                                                       
 "tbtop"   $table                                      
 if ttop<>0 then "tbskip" $table "number("ttop") NOREAD"
 "tbdispl" $table "panel(........) rowid(trow)"        
 
willy jensen
 
Posts: 465
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 70 times

Re: Locating rows in an ISPF Table

Postby Pedro » Mon Apr 18, 2016 9:44 pm

Also look at TBSARG

I think it is okay for this usage, per the listed requirement.

But in general, I prefer to use a FIND rather than a LOCATE. I do not like using TBSARG for the following reasons:
1. It searches for the text on a column by column basis. For example, if the text you search for is in the second column, it will not find it until it finds all of the instances in the first column. The user may get confused because they can see it there but it may jump to something off of the screen first.

2. The wildcard cannot be in the first character.
Pedro Vera
User avatar
Pedro
 
Posts: 686
Joined: Thu Jul 31, 2008 9:59 pm
Location: Silicon Valley
Has thanked: 0 time
Been thanked: 53 times

Re: Locating rows in an ISPF Table

Postby zingysayal1985 » Tue Apr 19, 2016 1:48 am

Okay. The mentioned code can be used for locating particular string in ISPF table.
Now , I am facing challenges in catching the string from the Command line. I have used "ARG SRHSTR" for collecting the value of Sting from command line into code, but "SRHSTR" is displaying blank value.
zingysayal1985
 
Posts: 8
Joined: Sun Mar 20, 2016 7:45 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Locating rows in an ISPF Table

Postby zingysayal1985 » Tue Apr 19, 2016 4:55 am

Thanks Willy. The provided code is working very much fine. Much appricated !!!!

@Pedro : How i can impelement "find" in ispf table search ? Can you please throw some light on it.

thanks
Rajeev
zingysayal1985
 
Posts: 8
Joined: Sun Mar 20, 2016 7:45 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Locating rows in an ISPF Table

Postby willy jensen » Tue Apr 19, 2016 3:58 pm

Pedro, I agree, I don't like TBSARG much either, hence the loop through the table in my snippet.
My main objection to TBSARG is that it only supports prefix search, not proper wildcard. And by the way, the same goes for TBSCAN.
willy jensen
 
Posts: 465
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 70 times

Re: Locating rows in an ISPF Table

Postby Pedro » Wed Apr 20, 2016 9:33 pm

How i can impelement "find" in ispf table search ?


Follow Willy's example to scan the table, but on the subsequent TBDISPL service call, position the cursor at the desired row and column name, maybe even cursor position within the field.

I have modified Willy's example:
ttop=0                                                
 "tbtop"   $table                                      
 do while ttop=0 /* search table */                    
  "tbskip" $table "position(p)"                        
   if rc<>0 then ...  /* end of table */      
    do
       /* examine each column of this row.                       */
       /* remember the column name where search string is found, */
       /*    for example, 'columnx'                              */
       if Found then then ttop=p /* found */                
    end      
 end                                                    
                                                       
 "tbtop"   $table                                      
 if ttop<>0 then "tbskip" $table "number("ttop") NOREAD"
 "tbdispl" $table "panel(........) rowid(trow)   CSRROW(ttop) CURSOR(columnx) "  


You also need logic, so if the user repeats the 'find', that it will start from cursor position rather than from the top of the table.
Pedro Vera
User avatar
Pedro
 
Posts: 686
Joined: Thu Jul 31, 2008 9:59 pm
Location: Silicon Valley
Has thanked: 0 time
Been thanked: 53 times


Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post