memscan -- Scan a Block of Memory Using a Translate Table

SYNOPSIS

 #include <lcstring.h>

 char *memscan(const char *area, const char *table,
               size_t len);
 

DESCRIPTION

memscan scans a block of memory using a translate table. A translate table is an array of 256 bytes, one for each EBCDIC character. The scan terminates at the first character in the block whose table entry is not 0.

area is a pointer to the block of memory to be scanned, and table addresses the first byte (corresponding to the character '\0') of the translate table. len specifies the maximum number of bytes to be scanned. If any character in the memory block has a nonzero table entry, then the scan terminates at the first such character, and the address of that character is returned. If no character in the block has a nonzero table entry, then memscan returns NULL.

RETURN VALUE

memscan returns a pointer to the first character in the memory block whose table entry is nonzero, or NULL if all characters have 0 entries in the table.

IMPLEMENTATION

memscan is implemented as a built-in function and uses the TRT instruction to search for a character with a nonzero entry in the table.

EXAMPLE

See the example for memscntb.

RELATED FUNCTIONS

memchr, memscntb, strscan

SEE ALSO

String Utility Functions

Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.