$MAPPUT
Function:
Writes or updates values in a sorted work area.
Format:
$MAPPUT <ctrlf> <key1> [...<key 8>] [<val1> ...[<valn>]]
Parameters:
<ctrlf> |
Specifies how the individual key values <key1> to <key8> are interpreted. N - the value is interpreted as a numberS - the value is interpreted as a string |
<key1> ... <key8> |
Key values for accessing the work area |
<val1> ... <valn> |
Values that are written in the work area |
Description:
• | The command searches the current work area for a line containing the key value specified in <key1> to <key8 >. |
If a line with the key specified in <key1> to <key8> is not present in the work area, a new line is inserted after the line with the next smallest key. If there is no smaller key value, the line is inserted as the first line in the work area. The values <key1> to <key8 > and <val1> to <valn> specified in the command are written as Rochade words in the line.
If a line with the key specified in <key1> to <key8> exists in the work area, the Rochade words that follow the key are replaced by the values in <val1> to <valn>.
• | The characters N and S used in the string in <ctrlf> define how the key values specified in <key1> to <key8> are interpreted. The string in <ctrlf> can have a maximum of 8 characters. |
N signifies that the corresponding key value <keyn> should be interpreted as a numeric value, either an integer or a floating point number. A plus or minus sign may appear before the numeric value.
S signifies that the corresponding key value <keyn> should be interpreted as a string.
Example 1:
This example shows a sorted list of USER IDs and associated user names, possibly intended for a selection list in an application window.
Consider a work area with this structure:
CS Cornelia Schollbach
EG Ellen Gorlow LT
GG Guenter Gehl LTS
UF Ursula Flohrer
These commands will insert new entries or modify existing entries:
$MAPPUT S AT @Andreas @Troll LTS
$MAPPUT S GG @Günter @Gehl
$MAPPUT S EU @Elke @Uhlig LT
$MAPPUT S EG Ellen Gorlow
After the commands are executed, the work area will have this structure:
AT Andreas Troll LTS
CS Cornelia Schollbach
EG Ellen Gorlow
EU Elke Uhlig LT
GG Günter Gehl
UF Ursula Flohrer
Example 2:
This example shows a list of payment dates and the associated invoice numbers for display and updating in an application:
2002 02 01 9875622 Paper
2002 03 15 50022 Office supplies
2002 05 07 2244555 Computer
These commands will insert new entries or modify existing entries:
$MAPPUT NNN 2002 02 01 9875622 @Paper @paid
$MAPPUT NNN 2002 05 11 47112233 @Books
$MAPPUT NNN 2002 05 07 2244555 Computer @paid
After the commands are executed, the work area will have this structure:
2002 02 01 9875622 Paper paid
2002 03 15 50022 Office supplies
2002 05 07 2244555 COMPUTER paid
2002 05 11 47112233 Books
Return Codes:
1 to 8 |
The value corresponding to <keyn> is missing or does not have the specified format. |
B |
The content of the work area does not match the key specified by <keyn>; not enough words in the work area or the words do not have the data type specified in <ctrlf>. |
S |
One of the characters specified in <ctrlf> is invalid or the string exceeds 8 characters. |
T |
Command executed successfully |