Previous topic |
Next topic |
Contents |
Contact z/OS |
Library |
PDF
TBSCAN—search a table z/OS ISPF Services Guide SC19-3626-00 |
|
The TBSCAN service searches a table for a row with values that match an argument list. The argument list can be established by use of the TBSARG service, or specified in the name-list for TBSCAN. The search can be either in a forward or a backward direction. A forward search starts with the row after the current row and continues to the end of the table. A backward search starts with the row before the CRP and continues to the top of the table. If a match is found, the CRP is set to that row. The row is retrieved unless the NOREAD parameter is specified. All variables in the row, including keys and extension variable, if any, are stored in the corresponding variables in the function pool. A list of extension variable names can also be retrieved. Use of the name-list parameter is optional. If specified, it overrides the search argument set by the TBSARG service for this search only. The values of all variables specified in the name-list parameter become part of the search argument. Key, name, and extension variables can be specified. A value of the form AAA* means that only the characters up to the
"*" are compared. This is called a generic search argument. A generic
search argument is specified by placing an asterisk in the last nonblank
position of the argument. Asterisks embedded in the argument are treated
as data. For example, to perform a generic search for a row value
of DATA*12, the generic search argument is:
The
first asterisk is part of the search argument. The second asterisk
designates the argument as a generic search argument. In a CLIST,
this technique can be used to set a variable to a literal value that
ends with an asterisk:
A null value in a variable is a valid search argument. You can use either a DBCS or a MIX (DBCS and EBCDIC combined) format
string as a search argument. If either is used as a generic search
argument, it must be specified as follows:
Comparisons between the row values and the argument list are always done on a character basis. That is, the values are considered character data, even if they represent numbers. Command invocation format>>-ISPEXEC--TBSCAN--table-name--+--------------------+----------> '-ARGLIST(name-list)-' >--+--------------------+--+-------------------+----------------> '-SAVENAME(var-name)-' '-ROWID(rowid-name)-' .-NEXT-----. >--+----------+--+--------+--+--------------------+-------------> '-PREVIOUS-' '-NOREAD-' '-POSITION(crp-name)-' >--+--------------------------------+-------------------------->< '-CONDLIST(condition-value-list)-' Call invocation format>>-CALL--ISPEXEC--(buf-len,--buffer);-------------------------->< or >>-CALL--ISPLINK--('TBSCANbb'--,--table-name--,-+-name-list-+---> '-'b'-------' .-'NEXTbbbb'-. >--,-+-var-name-+--,-+-rowid-name-+--,-+-'b'--------+-----------> '-'b'------' '-'b'--------' '-'PREVIOUS'-' >--,-+-'NOREADbb'-+--,-+-crp-name-+-----------------------------> '-'b'--------' '-'b'------' >--,-+-condition-value-list-+-);------------------------------->< '-'b'------------------' Parameters
Return codesThese return codes are possible:
ExamplesExample 1For the table TELBOOK: Move table TELBOOK's CRP to the row that fulfills the search argument
as specified in a preceding TBSARG operation. For an example of TBSARG,
see the example in the TBSARG description. Copy values from variables
in that row to function pool variables whose names match those of
the table variables.
Set
the program variable BUFFER to contain:
Set
program variable BUFLEN to the length of the variable BUFFER. Issue
the command:
or alternately
Example 2For the table TELBOOK: Use the TBSCAN service to position the CRP of table TELBOOK to
the row containing the name JOHNSON in variable LNAME, and the zip
code 08007 in variable ZIPCODE. Copy values of the variables in that
row to function pool variables whose names match those of the table
variables.
Set
the program variable BUFFER to contain:
Set
program variable BUFLEN to the length of the variable BUFFER. Issue
the command:
or alternately
If the return code is 0, the row was found and values were copied from the row variables to function pool variables. Example 3Establish a search argument to be used by a TBSCAN operation of the table DATETBL. Assume DATE1 to be a name variable in table DATETBL and that the dates are in a yy/mm/dd format. Specify a scan direction of forward and terminate the scan when the row value of DATE1 is greater than 99/01/31.
|
Copyright IBM Corporation 1990, 2014
|