8 14 2 IMPORT Examples

LANSA Technical

8.14.2 IMPORT Examples

The IMPORT command  is specified immediately after the FUNCTION statement and before the BEGIN_COM. The following command imports the variants function library:

FUNCTION Options(*DIRECT)
* import variant library
IMPORT Libraries(#PRIM_LIBV)
 

Example of how to use the IMPORTED function.  The following method receives variant.  If the variant is a string, it is returned as a string in the #Result Define_map

Mthroutine Name(Get_Variant_value)
Define_Map For(*Input) Class(*Variant) Name(#iVariant)
Define_Map For(*Result) Class(#Prim_alph) Name(#Result)
 
* Call the Varisstring function  
If (VarisString( #iVariant ))
 
#result := VarasString( #iVariant )
 
Endif
 
Endroutine