Checking the parameter list for errors

Z and I Emulator for Web does not check the parameter list for errors until the end user plays the macro. When the end user plays the macro, if Z and I Emulator for Web finds an error in the parameter list, then Z and I Emulator for Web:
  • Terminates the macro playback.
  • Generates an error message, either by displaying an error dialog box for the end user or by writing a message to the Java console.
Z and I Emulator for Web checks for three types of error situations:
  • The specified variable does not exist in the macro.

    In this type of error the parameter list includes a variable name that does not exist in the macro or that is spelled incorrectly (for example, strLocalfile instead of strLocalFile).

    Actions that you can take to avoid this type of problem are as follows:
    • Warn end users that variable names must be spelled correctly; or
    • In the main toolbar, create a customized button that plays the macro with the correct parameter list.

  • A syntax error exists in the parameter list.

    In this type of error the parameter list contains a syntax error (for example, the value is not enclosed in double quotes).

    Actions that you can take to avoid this type of problem are as follows:
    • Warn end users that syntax rules must be observed; or
    • In the main toolbar, create a customized button that plays the macro with the correct parameter list.
    Figure 1 gives examples of syntax errors and describes how Z and I Emulator for Web processes the errors:
    Figure 1. Examples of syntax errors
    strRemoteFile="NewData.123 intLength="14622"Z and I Emulator for Web
    :
    1) Sets the variable strRemoteFile to "NewData.123 intLength=".
    2) Tries to process 14622" but cannot
       (Z and I Emulator for Web is  looking for a variable name
       but instead finds an integer followed by a double quote).
    3) Terminates the macro playback and generates an error message.
    
    strRemoteFile="NewData.123"98 strLocalFile="MyData.123"Z and I Emulator for Web
    :
    1) Sets the variable strRemoteFile to "NewData.123".
    2) Tries to process 98 but cannot
       (Z and I Emulator for Web is looking for a variable name but finds an integer).
    3) Terminates the macro playback and generates an error message.
    
    strRemoteFile=NewData.123 strLocalFile=MyData.123Z and I Emulator for Web
    :
    1) Does not find a double quote after the first equals sign (=).
    2) Terminates the macro playback and generates an error message.

  • A run-time error occurs.
    An example of a problem in a parameter list that causes a run-time error is the following:
    intLength="abc"
    In the example above the variable intLength is of type integer. Z and I Emulator for Web tries to convert the string abc to a decimal integer and fails.
    When a run-time error occurs, Z and I Emulator for Web:
    • Terminates the macro playback.
    • Displays an error dialog box containing the error message.

    In the above example of a run-time error, Z and I Emulator for Web displays an error dialog box containing a message such as the following: A type mismatch occurred while updating variable $intLength$.