ProvideX V8.20 > Language Reference > 3. System Functions
400
CHG( ) Function
               Notify if Variable Has Changed
Formats
1. Notify & Change Status: CHG(varlist[,ERR=stmtref])
2. Non-Destructive Read: CHG(READ varlist[,ERR=stmtref])
Where:
stmtref
Program line number or label to transfer control to.
varlist
Comma-separated list of variable names to be tested.
Returns
String, listing variables that have changed.
Description
Use the CHG( ) function to determine if the contents of a variable has changed.
Re-assignment of the same data is still considered a change. Given a
comma-separated list of variable names, the CHG( ) function will return a
comma-separated list of those variables that have changed. Use += (add to), -=
(subtract from), and other operators with the CHG( ) function.
Note: You should not use the CHG( ) function with NOMADS applications (except for
variables not referenced by the panel), because when you set the REFRESH_FLG,
NOMADS itself uses the CHG( ) function to determine which variables are to be refreshed.
Format 1: Notify & Change Status
CHG(varlist[,ERR=stmtref])
The "changed" status of a variable is affected when the data in the variable changes
or when the CHG( ) function is applied. When this format of the CHG( ) function is
used, it will reset the "changed" status of the variables listed; e.g.,
0010
PRINT CHG("A,B,D$,E$")
0020
LET A=1.234
0030
LET E$="MIKEY"
0040
PRINT CHG("A,B,D$,E$")
! Prints A,E$
0050
PRINT CHG("A,B,D$,E$")
! Prints nothing
Format 2: Non-Destructive Read
CHG(READ varlist[,ERR=stmtref])
The CHG(READ ) format allows you to do a non-destructive read of the value
returned by the CHG( ) function. The "changed" status will not be reset when the
function is applied; e.g.,
0010
PRINT CHG("A,B,D$,E$")
0020
LET A=1.234
0030
LET E$="MIKEY"
0040
PRINT CHG(READ "A,B,D$,E$")  ! Prints A,E$
0050
PRINT CHG("A,B,D$,E$")  ! Prints A,E$