MAP( ) function

Returns a logical value indicating if a string matches a specified format.

Syntax

MAP(string, format)

Parameters

string

Character. The value to match against.

format

Character. The data pattern to identify in the string parameter. The format parameter must be in double quotes. It can contain literal characters, which only match if the same character exists in the same position in the string parameter. You can also specify any of the format types listed in Table 1, or you can use a combination of literal characters and format types.

Table 1. Format types
Format type Description

X or x

Match any alphabetic character (a-z, A-Z, European characters)

This format type is not case-sensitive. You can use X or x.

9

Match any number (0-9)

!

Match any non-blank character

?

Match any character

\

An escape character that specifies that the following character is a literal. The escape character is useful if you want to literally match any of the format type characters (X, x, 9, !, ?).

Output

Logical. Returns T (true) if the specified text string matches the specified format string, and F (false) otherwise.

Remarks

If the format parameter is shorter than the string parameter, the MAP( ) function compares characters up to the length of the format parameter, and returns true if they match up to that point. However, if the string parameter is shorter than the format parameter, the result is always false.

In the format parameter, use a backslash (“\”) as an escape character before any of the format type characters (X, x, 9, !, ?) that you want to literally match in the string parameter. For example, if the input value must contain the letter ‘X’, specify \X in the format parameter. To specify a backslash, enter \\. Enter blanks as blanks, without a backslash in front.

Examples

Example Return value

MAP("ABC Plumbing", "xxx")

T

MAP("045", "9999")

F

The input value has only 3 numbers where 4 are required.

Extract records based on a recurring pattern

The following example identifies credit card records based on the leading 7 digits, and extracts them to a new table.

OPEN CreditCards
EXTRACT RECORD TO "HighLimitCards.fil" IF MAP(CardNum, "8590122999999999")


(C) 2013 ACL Services Ltd. All Rights Reserved. | Send feedback