12.7 Manipulating String Data with Multiple Maps
Mapping a string storage area in more than one way lets you
extract a substring from a string or concatenate strings. In
the following example, the three MAP statements reference
the same 108 bytes of data:
EXAMPLE: Click to display example.
You can move data into a map in different ways. For in-
stance, you can use terminal input, arrays, and files. In the
following example, the READ and DATA statements are used
to move data into a map:
READ EMPLOYEE_RECORD$
DATA "WILLIAM DAVIDSON 2241 MADISON BLVD " &
"SCRANTON PA14225A912/10/78$13,325.77$925.31"
Because all the MAP statements in the previous example ref-
erence the same storage area (emprec) , you can access parts
of this area through the mapped variables as shown in the
following examples:
PRINT full_name$
PRINT wage_class$
PRINT salary_ytd$
Output 1
WILLIAM DAVIDSON
A9
$13,325.77
Example 2
PRINT last_name$
PRINT tax_ytd$
Output 2
DAVIDSON
$925.31
You can assign a new value to any of the mapped variables.
The following example prompts the user for changed infor-
mation by displaying a menu of topics. The user can then
choose which topics need to be changed and then separately
assign new values to each variable.
EXAMPLE: Click to display example.
Output
EXAMPLE: Click to display example.
See Chapter 8 and the DEC BASIC and VAX BASIC for
OpenVMS Systems Reference Manual for more information
about the MAP statement.