This section provides some examples of dictionary statements and their usage.
Example 1
This example uses leading blanks before some color dictionary_names to create indentation for clarity.
A blank statement is used before and after the "color" section. Such blank statements are ignored but can be printed.
Dictionary_names are case-sensitive. Thus, Red and red are separate dictionary_names.
Example 2
In this example, note how position (p) is replaced with an asterisk (*) to indicate that the value of p should be the next position after the previous field. This is a powerful feature. Using an asterisk (*) for position allows you to define adjoining fields automatically. Thus, if a field specification changes, it is not necessary to calculate and specify the changed positions of subsequent fields.
Example 3
In this example, the SKIP operator advances the next position by n bytes. Since the position of the next field is specified with an asterisk (*), the position will be calculated automatically.
Example 4
In this example, an equal sign (=) is used instead of p, l or f. The equal sign assigns the previous position, length or format to the equal sign, mapping one field onto another.
Although field_names and constant_names can usually be specified in any order, using the asterisk (*) or equal sign (=) forces a dependency on field order.
Note the use of comments in the above examples. As for MFX control statements, a blank after the value indicates the beginning of a comment. You can also use comment statements, which begin with an asterisk (*) in column 1.
Example 5
Example 6
This example demonstrates some circumstances where format specifications are used and are not used in control statements.
In your symbols dictionary you can specify a field_name with p, l, and f, then use the field_name in a control statement that only requires p and l. MFX will substitute p and l during processing and ignore the f specification under certain circumstances. For example, consider the following dictionary statements:
Suppose you use these field_names in the following control statements:
Based on the field_names defined in the dictionary statements, MFX will make the following substitutions:
-
In the SORT statement, 'Account#' is replaced with '1,12,CH' and 'CheckDate' is replaced with '17,6,Y2T'.
-
In the DUPKEYS statement, 'CheckAmount' is replaced with '23,6'.
-
In the OUTFIL statement, 'Account#' is replaced with '1,12', 'CheckDate' is replaced with '17,6,Y2T' because of the special nature of the Y2T format, and 'CheckAmount' is replaced with '23,6,PD' because it is followed by an EDIT mask.