Previous Topic: Search for Data on the Current ScreenNext Topic: Search for a Hexadecimal String


Search for a Character String

The statements from a TSO startup ACL/E program shown below search for the string "ENTER USERID" to determine whether the TSO signon screen is displayed. If the correct screen is displayed, the program enters the user ID and password or password phrase. If the correct screen is not displayed, the program terminates.

          SEARCH 'ENTER USERID' 
          BRANCH EQ,TSO 
          STOP 
TSO       KEY '&USERID' 
          ENTER 
          KEY '&PSWD'
          ENTER 
          STOP

The SEARCH command searches the screen image for the specified string. If the string is found, the SEARCH statement sets a condition code of EQ, which is used by the BRANCH statement. If the string is not found (NE), the program terminates.