User Tools

Site Tools


unbind_free_runtime_expression_string_variable_.htm
Navigation:  Language Reference > 10 - Expressions > Runtime Expression Evaluation >====== UNBIND (free runtime expression string variable) ====== Previous pageReturn to chapter overviewNext page

 

UNBIND( [name] )

blk2blue.jpg

UNBIND Frees variables from use in runtime expression strings.
Name A string constant that specifies the identifier used by the dynamic expression evaluator. If omitted, all bound variables are unbound.

The UNBIND statement frees logical names previously bound by the BIND statement. The more variables that are bound at one time, the slower the EVALUATE procedure works. Therefore, UNBIND should be used to free all variables and user-defined procedures not currently available for use in runtime expression strings.

Example:

PROGRAM
MAP
 AllCapsFunc(STRING),STRING               !Clarion procedure
END
Header     FILE,DRIVER('Clarion'),PRE(Hea) !Declare header file layout
AcctKey     KEY(Hea:AcctNumber)
OrderKey    KEY(Hea:OrderNumber)
Record      RECORD
AcctNumber   LONG
OrderNumber  LONG
ShipToName   STRING(20)
ShipToAddr   STRING(20)
ShipToCity   STRING(20)
ShipToState  STRING(20)
ShipToZip    STRING(20)
           END
          END
Hea:CityStateZip  STRING(60)  !Make easy to use combined
Hea:ZipPlus4      STRING(20)  !fix to not have -0000
Detail     FILE,DRIVER('Clarion'),PRE(Dtl),BINDABLE  !Bindable RECORD structure
OrderKey    KEY(Dtl:OrderNumber)
Record      RECORD
OrderNumber  LONG
Item         LONG
Quantity     SHORT
           END
          END
CODE
BIND('ShipName',Hea:ShipToName)
BIND(Dtl:Record)
!Make easy to use combined City State Zip with local variable:
BIND('Hea:CityStateZip',Hea:CityStateZip)
!Do not use the Zip from Header record for normal things:
UNBIND('Hea:ShipToZip')
BIND('Hea:ShipToZip',Hea:ZipPlus4)         !Use Zip fixed for Zip Plus 4
BIND('Hea:ShipToZipRaw',Hea:ShipToZip)     !Allow using Raw zip by this name
BIND('SomeFunc',AllCapsFunc)
!Each time record is loaded:
Hea:CityStateZip = CLIP(Hea:ShipToCity)& CHOOSE(~Hea:ShipToState,'',', '&Hea:ZipToState) &' '& Hea:ShipToZip)
Hea:ZipPlus4 = Hea:ShipToZip
IF Hea:ZipPlus4[6:10]='-0000' THEN CLEAR(Hea:ZipPlus4[6:10]).  !Remove -0000
UNBIND('ShipName')          !UNBIND the variable
UNBIND('SomeFunc')          !UNBIND the Clarion language procedure
UNBIND                      !UNBIND all bound variables
AllCapsFunc PROCEDURE(PassedString)
CODE
RETURN(UPPER(PassedString))

See Also:

BIND

EVALUATE

PUSHBIND

POPBIND

unbind_free_runtime_expression_string_variable_.htm.txt · Last modified: 2021/04/15 15:57 (external edit)