[ Previous | Next | Contents | Search ]
3270 Host Connection Program 2.1 and 1.3.3 for AIX: Guide and Reference



Examines a field within the connected host Presentation Space (PS) for the occurrence of a specified string.

Prerequisite Calls

This function requires a prerequisite call to the CONNECT PRESENTATION SPACE (1) function.


hllc (func, apistring, len, ret)
int *func;
char *apistring;
int *len;
int *ret;

Supplied Parameters

Supply the following parameters to invoke the SEARCH FIELD function:

func Specifies the number of the function called; must be 30 for the SEARCH FIELD function.
apistring Specifies the target data string for search.
len Specifies the length of the target data string. This parameter is not applicable if in EOT mode.
ret Identifies the target field. For SRCHALL, this parameter can be the PS position of any byte within the target field. For SRCHFROM, this parameter is the beginning point of the search for SRCHFRWD or the ending point of the search for SRCHBKWD.

Returned Parameters

len The following codes are valid:
=0 Specifies that the string was not found.
>0 Specifies that the string was found at the indicated host PS position.
ret The following codes are valid:
0 Specifies that the SEARCH FIELD function was successful.
1 Specifies that your program was not connected to the host session.
2 Specifies that an error was made in specifying parameters.
7 Specifies that the host PS position was invalid.
9 Specifies that a system error occurred.
24 Specifies that the search string was not found, or the host PS was unformatted.


When you issue the SEARCH FIELD function call, the function examines a field you specify for the occurrence of a specified string. If the target string is found, this function returns the position of the string numbered from the beginning of the host PS. The upper-left corner (row 1, column 1) is position 1. This function can be used to search either protected or unprotected fields, but only in a field-formatted host PS.

Four sets of parameter options from the SET SESSION PARAMETERS (9) function are related to this function.

The SEARCH FIELD function normally checks the entire field (SRCHALL is the default mode). However, you can use the SET SESSION PARAMETERS (9) function to specify SRCHFROM. In this mode, the PS position parameter does more than identify the target field. It also provides a beginning or ending point for the search. Use the SET SESSION PARAMETERS (9) function to determine whether your searches will search forward (SRCHFRWD) or search backward (SRCHBKWD).

DBCS Remarks

If the specified position where a forward search is to begin is the second byte of a DBCS character, the search begins from the next position. If the last character of the target data string is the first byte of a DBCS character, it is not included.

SO/SI in the presentation space is ignored while searching. Two-byte control characters to be searched must be enclosed between SO(X'OE') and SI(X'OF').

Related Information


[ Previous | Next | Contents | Search ]