Search Presentation Space (6)

Top  Previous  Next

The Search Presentation Space function lets your EHLLAPI program examine the host presentation space for the occurrence of a specified string.








Prerequisite Calls


Connect Presentation Space (1)



Call Parameters



Standard Interface

Enhanced Interface

Function Number

Must be 6.


Data String

Target string for search.



Length of the target data string. Overridden in EOT mode.


PS Position

Position within the host presentation space where the search is to begin (SRCHFRWD option) or to end (SRCHBKWD option). Overridden in SRCHALL (default) mode.




Return Parameters


This function returns a length and a return code.




The following codes are defined:




= 0

The string was not found.

> 0

The string was found at the indicated host presentation space position.


Return Code


The following codes are defined:


Return Code



The Search Presentation Space function was successful.


Your program is not connected to a host session.


An error was made in specifying parameters.


The host presentation space position is not valid.


A system error was encountered.


The search string was not found.





1.Four sets of parameters under the Set Session Parameters (9) function are related to this function. They are the SRCHALL/SRCHFROM, STRLEN/STREOT, SRCHFRWD/SRCHBKWD, and the EOT=c session options.
2.You can use the Set Session Parameters (9) function to specify SRCHBKWD. When this option is in effect, the search operation locates the last occurrence of the string.
3.The Search Presentation Space function normally checks the entire host presentation space. However, you can use the Set Session Parameters (9) function to specify SRCHFROM. In this mode, the calling PS position parameter specifies a beginning or ending point for the search.
If the SRCHFRWD option is in effect, the search for the designated string begins at the specified PS position and proceeds toward the end of the host presentation space.
If the SRCHBKWD option is in effect, the search for the designated string begins at the end of the PS and proceeds backward toward the specified PS position. If the target string is not found, the search ends at the PS position specified in the calling PS position parameter.
4.The SRCHFROM option is also useful if you are looking for a keyword that might occur more than once in the host presentation space.
5.The Search Presentation Space function is useful in determining when the host presentation space is available. If your EHLLAPI application is expecting a specific prompt or message before sending data, the Search Presentation Space function allows you to check for a prompt message before continuing.
6.DBCS Only: If the start position of the specified search function is the second byte in a double-byte character, the search is started from the next character for SRCHFRWD and from the character for SRCHBKWD. If the last character of the specified string is the first byte of a double-byte character, the character is not searched for.
The search ignores a pair of SO and SI in the presentation space. When you search a double-byte control character, put SO (X'0E') before the character and SI (X'0F') after it. For example, X'0E000C0F' in the data string is treated as a double-byte character FF (X'000C').