MFG/FMP Compatibility

Restriction: This topic applies only when the AppMaster Builder AddPack has been installed, and applies only to Windows platforms.

The Micro Focus Generator provides greater processing speed and a 98% level of compatibility with its predecessor, the FMP generator. The 98% compatibility level, while difficult to quantify, is intended to indicate that nearly all statements continue to execute exactly as before. There are some exceptions:

This topic describes such changes to the language, while the built-in structures are documented in the Help topic MFG Structures.

Language Enhancements

Enhancements to the language include the following:

  • The MFG generator is more forgiving of minor user indentation errors than the FMP generator, and provides more predictable control over output formatting. If you had coded the following and generated using the FMP generator:
               % IF &A = 1
                   % &B = 2
                   % &C = 3
                  % &D = 4
               % END
    

    Then an "indentation decreased" error would have occurred on the line, % &D = 4.

    With the MFG generator, as long as the indentation does not terminate the scope of the % IF by starting in a column equal to or less than the starting column of the % IF statement, then the code above is accepted and executed. The following variation will process with the effect shown:

               % IF &A = 1
                   ABD
                   % &C = 3
                  % &D = 4
                  DEF
               % END
    

    The output is:

                   ABD
                  DEF
    
  • The subcripts of a DECLARE table can be passed as actual arguments to a rule.
  • There is no restriction on the length of symbol names.
  • There is no limit on the number of subscripts a DECLARE table can have.
  • % LOOKUP can increment up to 20 subscripts (previous limit was 3) in performing its search.
  • % LOOKUP can accomodate expressions in the FROM clause. Previously only constants or a single variable were allowed.
  • In DECLARE tables a REDEFINED table can now be REDEFINED, as COBOL programmers would expect.
  • The LANG=TEXT parameter now enables the generator to read columns 1-32K instead of 1-80.
  • There are new % SET statements, built-in functions, and variables.

Compatibility Issues

The following are FMP/MFG compatibility issues. With the MFG:

  • The general nature of a statement must be easily recognized by the processor before any evaluation expressions are evaluated. That is, the basic structure of a statement cannot change, depending on the result of an evaluation expression.

    The most common use of evaluation expressions is to construct variable names; this use is usually not affected.

    Evaluation expressions that are affected and do not work with the MFG generator include those that introduce self-modifying logic, which is generally considered a bad practice anyway. In practically all cases, there is a more natural way to recode an expression that is much more readable and often will execute faster.

    Another type of evaluation expression that is not supported under MFG are those that have unmatched quotes. You can replace these expressions with equivalents that do not use unmatched quotes. For example:

    Replace this evaluation statement... With...
    % <&SQ&A&B>" % <&SQ&A&B&SQ>
    % <%&CQ AT &HH+:&MN> PM" % <%&CQ AT &HH+:&MN PM&CQ>
  • All statements are examined whether they are executed or not. Source code that did not execute under FMP, and thus did not generate errors, might generate errors when executed under MFG. For example, in the following code, a parsing error occurs due to an unnecessary quote after SSMCLASS:
            $ISPEXEC( "VGET (SSMBPLAN",
            % ...           "SSMJOB",
            % ...           "SSMCLASS") PROFILE" )
    

    Taking the extra quote out fixes the problem.

  • Arguments of a rule call or built-in function must be enclosed in parentheses and separated by commas, as follows:
            $ruleName [ ( argument1 [, argument2...] ) ]
            &functionName [ ( argument1 [, argument2...] ) ]
    
  • The following % SET statements, although recognized, do nothing except issue a warning message:
    % SET CONTROL
    % SET DELIMITERS-OPTIONAL
    % SET DELIMITERS-REQUIRED
    % SET CONVERT-LOWER-CASE
    % SET PRESERVE-LOWER-CASE
    % SET AUXILIARY-INPUT
    % SET COUNT
    % SET NOCOUNT
    % SET STRICT-STRING-LIMIT
    % SET NO-STRICT-STRING-LIMIT
    % SET CONTROL-CARDS
    
  • The following % SET statements are recognized but do nothing:
    % SET EVAL-BRACKETS
    % SET EVAL-BRACKETS-AUX
    % SET LEFT-MARGIN
    % SET RIGHT-MARGIN
    % SET WRITE-CONTROL-LIMIT
    
  • The following built in functions are not supported:
    &APS-TARGET
    &APS-CICS-DISPATCH
    &APS-INPUT.
    

    To define values you need, code assignment statements

  • Do not continue non-MFG source code using the MFG syntax for continuation (% ...). For example, the following statement is invalid:
            MOVE &FLD1 
            % ...  TO &FLD2
    

    Instead, code S-COBOL continuation as follows:

            MOVE &FLD1 
            ...  TO &FLD2
    
  • Statements containing a verb that is evaluated at execution time are not supported. Some of them will compile cleanly to generate UNDET (undetermined) op codes which will cause warning messages to be output at execution time; others will generate syntax errors. For example:
            % <&VARIABLE>
            % <&VARIABLE>
                 statementblock
            % <&VARIABLE>
                 statementblock
            % ELSE
                 statementblock
            % <$RULE>"QUOTED EXPRESSION"
    
  • Any statement that does not begin with a % or $ is treated as a text line. In the following examples, the second statement does not invoke the rule.

    Example:

            % &A = "$MY-MAC"
            <&A>(&ABC)
    

    To fix this, code:

            % &A = "MY-MAC"
            $<&A>(&ABC)
    
    

    Example:

            % WHILE &DEFINED (&APS-EPILOGUE)
                % SET EPILOGUE
                <&DEFVAL>
    

    To fix this, code:

            % WHILE &DEFINED (&APS-EPILOGUE)
                % SET EPILOGUE
                $<&SUBSTR(&DEFVAL,2)>
    

    In this example, the second statement is not recognized as the value of &REMARKS, but is treated as a text line. All statements indented under it are parsed successively, possibly resulting in compile errors.

            % &REMARKS = "% IF 0"
            <&REMARKS>
                THIS IS A COMMENT LINE.
    

    To fix this, code the following, which causes the parser to generate an undetermined type 2 node and handle the "IF 0" evaluation correctly at run-time:

            % &REMARKS = "IF 0"
            % <&REMARKS>
                THIS IS A COMMENT LINE.
    
  • The following syntax results in a compiler syntax error. The problem is that the nature of the statement as an assignment is hidden within the evaluation expression, and cannot be identified until execution time.
    % &<%&ARG = &QT&ARG3&DOS-SYS+-&ARG2+-&DEV+-S-&ARG1&QT>

    To fix this, code:

    % &<%&ARG> = <%&QT&ARG3&DOS-SYS+-&ARG2+-&DEV+-S-&ARG1&QT>
  • Grouping all the textual comments under a % SUBMEMBER statement (which never gets included by any rule) is not supported. To get around this, change the % SUBMEMBER statement to % IF 0, and indent all the textual comments under it to the right.
  • Floating point assignments and arithmetic is not supported in any version of the generator. FMP issued an error message; MFG does not. The net result is the same in any version - only the integer part of the value is accepted. For example, the following assignment statement produces the value 12:
            % &A  =  12.34
  • Expressions that are concatenations of evaluations and text do not support embedded non-alphanumeric characters, such as the colon ( : ) in the following example:
            % &A =  <&SQ>:<%&ST-NAME><%&COBOL-LINE><&SQ>

    To fix this, code:

            % &A =  <&SQ><%:&ST-NAME><%&COBOL-LINE><&SQ>

    Or:

            % &A =  <%&SQ:&ST-NAME&COBOL-LINE&SQ>

    Or:

            % &COLON = ":"
            % &A =  <&SQ><%&COLON><%&ST-NAME><%&COBOL-LINE><&SQ>
    
  • If an ELSE statement is followed by an IF statement (as opposed to an ELSE-IF statement), then there should be a line break and indentation after the ELSE and before the IF. For example:
            % ELSE IF &A = "ABC" OR &B = "DEF"

    To fix this, code:

            % ELSE
            % IF &A = "ABC" OR &B = "DEF"
    
  • The following statement will not compile due to the embedded less than character ( < ) which is assumed to be the start of an evaluation:
            &16+88  PF24 VALUE &SQ+<&SQ.

    To fix this, code:

            % &LEVAL = "<"
            &16+88  PF24 VALUE &SQ+&LEVAL+&SQ.
    
    

    Or:

            &16+88  PF24 VALUE "<".
  • There are approximately 30 additional built-in functions with natural-sounding names, such as &STRING. However, there is a possibility that the names of these additional functions conflict with variable names in existing code used previously with the FMP. If you encounter different behavior when running a rule, scan the code for names which conflict with the names of the MFG built-ins.

Unsupported Syntax

The following are samples of syntax encountered in actual production rules which were presumably never executed because they are not compilable with the FMP generator, and are not supported in MFG.

Example:

$DBDC-GEN-MSG( "9080", "NOGEN", &EDIT-NAME) "01-99")

To fix this, change the right parenthesis following &EDIT-NAME to a comma. This appears to be a typographical error.

Example:

$GASCR+-SELECT = XXXXA-CONFIRM                      01

This is an invalid syntax for a rule call and appears to be a typographical error.

Example:

% IF &T-CODE NOT DEFINED

To fix this, code:

% IF NOT &DEFINED(&T-CODE)