Dynamic mapping string item – DV
This is an advanced technique, somewhat related to the SV commands. Because you could run into problems if this command is used incorrectly, you should be sure you fully understand the mapping string facility before attempting to use this command. It is highly recommended that you test this technique first, using the Mapping Test Program, before attempting to use it with your production data.
The purpose of the DV command is to create a dynamic mapping command.
Syntax of a dynamic mapping string item:
DV [ delete-option ] column-reference
Introduces the dynamic mapping string item. DV stands for Dynamic Value, as compared to Set Value (SV).
An optional quoted string operand. If present, it contains a single letter specifying what is done with the result string prior to the DV command finishing. The letter is case-insensitive.
- 'K' means to keep the result string as-is without change.
- 'D' means to delete the portion of the result string that was referenced by the column-reference operand. This is the default if the delete-option is omitted.
- 'E' means to erase the entire result string so that it contains a null (empty) string as it does when mapping string is first processed.
A standard column reference. Only the result string is referenced.
A dynamic command value is formed by creating, in the result string, any suitable mappings commands as text values. You do this using any desired mapping commands to help you build up one or more new mapping commands as data, by whatever means is needed. Such commands to build up and create these strings appear in your main mapping string before the DV is specified.
You then use the column-reference operand of the DV command to select one or more columns from the result string as your “dynamic value”, taking care that the text you built up and selected is in fact valid as one or more mapping commands. This text is “inserted” into the original mapping string at the point where the DV command appeared.
Because any problems with your inserted commands, such as unmatched quotes or other syntax errors, could cause the mapping string as a whole to malfunction, you should exercise great care using DV commands.
Prior to executing the commands you inserted with the DV command, some or all of the current contents of the result string can be deleted, depending on the delete-option
operand you specify. As noted, if you omit the delete-option operand, the default is to remove the portion of the result string text that was submitted for execution.
Once the mapping commands you have provided are processed, the original mapping commands after your DV command resume where they left off. In that sense, the DV mapping command is like an #INCLUDE statement in a programming language.
If the text you select from the result string is blank or empty, it is not an error. The blank text that is submitted by DV for execution will simply do nothing.
Unlike the SV command, you cannot “nest” a DV command. That is, the dynamic value you submit to the mapping system to be executed cannot itself have a DV command. If this detected, execution of the mapping string as a whole is halted and an error message produced.
Why would you want to use a DV command?
The most likely reason is that you need to perform some action that is dependent on the data you have found. You may have data files that contain mapping string command codes, and you want to directly execute them. You might also wish to construct an elaborate calculation operand that sets one or more calculation variables. There are doubtless many uses for this facility, limited only by your imagination.
Created with the Personal Edition of HelpNDoc: Write EPub books for the iPad