InitializeUDA Method (MODULE)


PLBCMP GUI Only, 10.6

 

The InitializeUda method allows the current UDA (User Data Area) variables for a program or a load module to be re-initialized to the values and states the same as initially loaded. This method only initializes the UDA for the current program or load module that is executing this method. The InitializeUda method requires that the program/load module be compiled using the 'WU' compiler option. Otherwise, an O167 error occurs. This method uses the following format:

 

[label]

{object}.InitializeUDA

[GIVING {return}] USING [*Flags=]{flags}

 

Where:

label

Optional. A Program Execution Label.

object

Required. A MODULE that is accessed.

return

Optional. A Numeric Variable whose value is zero when the method initializes the UDA.

flags

Optional. A Numeric Variable or decimal number that identifies a bit mask where each bit invokes a behavior for this method.

Flags Affected: EOS, OVER, ZERO

Note the following:

  1. The EOS flag is always cleared.

  2. The ZERO flag is set TRUE if the {return} value is zero. Otherwise, the ZERO flag is set to FALSE.

  3. The OVER flag is set TRUE if the {return} variable is too small to receive the value without being truncated.

  4. If the current program/load module cannot be re-initialized, this method causes an O167 error. In this case, the PL/B program/load module logic must reset UDA variables needing initialization.

  5. The {flags} bit values are implemented to invoke behaviors for the method as follows:

  6.  

    Flag Values

    Description

    0x0

    This value defaults to execute the full initialization of the program/load module UDA variables and states.

    0x1

    This bit value causes a pass/fail return value that indicates whether the PLC UDA can be re-initialized. The value of zero indicates that the PLC can be re-initialized. A non-zero value indicates that the method cannot be re-initialized. See Note (7).

     

  7. When the InitializeUda method executes successfully, the UDA is re-initialized in a manner similar to the CHAIN. GLOBAL variables are not re-initialized. However, GLOBAL GUI variables may or may not be destroyed depending on how they are being used.

    Only the UDA variables of the current program or load module executing the InitializeUda method are re-initialized as follows:
     

  8. A. The non-common files are closed. If the main program is being initialized, both common and non-common files are closed.

     

    B. The GUI objects are destroyed. However, GLOBAL GUI variables may or may not be destroyed as follows:

     

    1) If a GLOBAL GUI object is a child object to a WINDOW or PANEL object that exists in the module UDA, then it is destroyed.

     

    2) If a GLOBAL GUI object in the module UDA has been created and it is a child object to a WINDOW or PANEL that exist in the UDA of a different module, then it is not destroyed.

     

    C. The XData, DateTime, Ftp, ComFile, and Collections are re-initialized.

     

    D. All of the current pending program/user events are cleared.

     

    E. All of the variable pointers are re-initialized. This includes auto load DIM pointer are reset as initially loaded.

7. The {return} values are described as follows:

 

Value

Description

0

The method executed successfully. If the {flags} value is set to 0x01, a value of zero indicates that the PLC can be re-initialized. If the {flags} value of 0x01 is not used, the value of zero indicates that the PLC UDA was re-initialized successfully.

1

Error where the MODULE object is not available.

2

Error where the MODULE object does not have a saved copy of the UDA. In this case, compile the module using the 'WU' compiler option.

 

 

See Also: Module Methods, Method Syntax



PL/B Language Reference Unload Method (MODULE)