ANY

A variable of type ANY receives the type of the value that is assigned to that variable. The value can be of a primitive type such as INT or can be a variable that is based on a data part used as a type. The value cannot be a form or dataTable.

Consider this example:
  myInt INT = 1;
  myString STRING = "EGL";

  myAny01, myAny02 any;
  
  // myAny01 receives the value 1 and the type INT
  myAny01 = myInt;
  
  // myAny02 receives the value "EGL" and the type STRING
  myAny02 = myString;

  // The next statement is 
  // NOT VALID because a variable of type INT
  // is being assigned to a variable of type STRING
  myAny02 = myAny01;

Actions that combine types in an invalid way are detected only at run time and cause program termination. Those actions include assigning a value to a field of an incompatible type, passing an argument value to a parameter of an incompatible type, or combining incompatible values inside an expression.

The type of a literal is implied by the value of that literal:

When you reference a variable of type ANY, access is always dynamic. You cannot include a field of type ANY in a fixed structure (a dataTable, print form, text form, or fixed record).

Related reference
Primitive types

Feedback
(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.