VSNINSPECT_TEXT

This procedure searches specified text for characters that are present or not present in a requested truth set. The SCANNED_CHARS parameter is an integer that represents the number of characters that were searched when the criteria specified in the FLAG parameter were met. If SCANNED_CHARS is equal to INSPECT_LEN, then all the characters were searched, but none met the criteria. Otherwise, adding the TEXT_START value to the SCANNED_CHARS value gives the location of the character, from the start of the array, that met the search criteria.

Example

This example examines a record that contains two fields, a name and a phone number. The name is verified to contain only alphabetic characters as defined by the France ccsversion. The MultiLingual System Administration, Operations, and Programming Guide can be used to determine that the ccsversion number for France is 35. This number can also be retrieved by calling VALIDATE_NAME_RETURN_NUM with the name France.

BEGIN

 $ INCLUDE INTL="SYMBOL/INTL/ALGOL/PROPERTIES." 10000000 - 49999999
  DEFINE IDNUMLEN = 10 #
       ,NAMELEN = 30 #
       ,TEXT_START = 0 #
       ,INSPECT_LEN = IDNUMLEN #;

  FILE OUT(KIND=DISK,UNITS=CHARACTERS,FILEUSE=IO,FILETYPE=0,NEWFILE,
           MAXRECSIZE=80,TITLE="OUT/ALGOL/VSNINSPECT_TEXT.");
  EBCDIC ARRAY TEXT[0:NAMELEN+IDNUMLEN];
  INTEGER SCANNED_CHARS
        ,RESULT
        ,VSN_NUM;

  REPLACE TEXT[0] BY "7775961089John Alan Smith               ";
  VSN_NUM := 35;
  RESULT := VSNINSPECT_TEXT(VSN_NUM, TEXT, TEXT_START, INSPECT_LEN,
            CS_NUMERICSV, CS_NOTINTSETV, SCANNED_CHARS);
  WRITE(OUT,<"RESULT = ",J4>,RESULT);
  IF RESULT EQL CS_DATAOKV THEN
     BEGIN
     WRITE(OUT,<"SCANNED CHARACTERS = ",J4>,SCANNED_CHARS);
     IF SCANNED_CHARS NEQ IDNUMLEN THEN
        WRITE(OUT,<"ERROR - INVALID ID, BAD CHARACTER FOUND">);
     END;
  CLOSE(OUT,LOCK);
END.

Output

RESULT = 1
SCANNED CHARACTERS = 10

In this call, the parameters have the following meanings:

VSN_NUM is an integer passed to the procedure. It specifies the ccsversion to be used. The ccsversion contains the rules for applying a truth set.

The following are the values allowed for VSN_NUM:

Value

Meaning

Greater than or equal to 0

Specifies a ccsversion. The numbers of the ccsversions are listed in the MultiLingual System Administration, Operations, and Programming Guide.

–2

Specifies the system default ccsversion. If the system default ccsversion is not available, an error is returned.

TEXT is an EBCDIC array passed to the procedure. The array is then searched using the requested truth set.

TEXT_START is an integer passed to the procedure. It contains the byte offset (0 relative) in TEXT where the search starts.

INSPECT_LEN is an integer passed to the procedure. It specifies the number of characters to be searched beginning at TEXT_START. In other words, it specifies that maximum length of the search.

CS_NUMERICSV represents an integer that indicates that a numeric truth set be used for the search. It is one of six options:

Value

Sample Data Name

Meaning

12

CS_ALPHAV

Alphabetic truth set. It identifies the characters defined as alphabetic in the specified ccsversion.

13

CS_NUMERICSV

Numeric truth set. It identifies the characters defined as numeric in the specified ccsversion.

14

CS_PRESENTATIONV

Presentation truth set. It identifies the characters in the ccsversion that can be represented on a presentation device, for example a printer.

15

CS_SPACESV

Spaces truth set. It identifies the characters defined as space in the specified ccsversion.

16

CS_LOWERCASEV

Lowercase truth set. It identifies the characters defined as lowercase alphabetic in the ccsversion.

17

CS_UPPERCASEV

Uppercase truth set. It identifies the characters defined as uppercase alphabetic in the ccsversion.

A ccsversion is not required to have a definition for each of these truth sets. Some of the truth sets are optional. Options 16 and 17 are not required. A result of CS_DATA_NOT_FOUNDV (4002) might be returned if the truth set has not been defined for the ccsversion. The input text remains unchanged.

CS_NOTINTSETV represents an integer that indicates the type of search to be performed. It is one of two options:

Value

Sample Data Name

Meaning

0

CS_NOTINTSETV

Search TEXT until a character is found that is not in the requested truth set.

1

CS_INTSETV

Search TEXT until a character is found that is in the requested truth set.

SCANNED_CHARS is an integer returned by the procedure. It contains the number of characters that were scanned when the search criteria were met.

RESULT is an integer returned by the procedure. It indicates whether or not an error occurred during the execution of the procedure. An explanation of the error result values and messages can be found at the end of this section. The values returned by this procedure include:

CS_ARRAY_TOO_SMALLV (3001)

CS_DATA_NOT_FOUNDV (4002)

CS_BAD_ARRAY_DESCRIPTIONV (3000)

CS_FAULTV (1001)

CS_BAD_FLAGV (3007)

CS_FILE_ACCESS_ERRORV (1000)

CS_BAD_TYPE_CODEV (3006)

CS_NO_NUM_FOUNDV (3003)

CS_DATAOKV (1)

CS_SOFTERRV (1002)