System Functions
CHG( ) Notify if Variable Has Changed
   
Formats
1. Notify & Change Status: CHG(varlist [ , ERR=stmtref ] )
2. Non-Destructive Read: CHG(READ varlist [ , ERR=stmtref ] )
3. Non-Destructive Read: CHG( prglvl [ , ERR=stmtref ] )

Where:  

stmtref Program line number or statement label to which to transfer control.
varlist Comma-separated list of variable names to be tested as a string.
prglvl Program execution level whose program's 'changed' state is going to be returned. Negative values indicate value relative current program level.
   
Returns String, listing variables that have changed. (format 1 & 2)
Numeric, 0 or 1 Indication program has changes (format 3)
   
Description Use the CHG( ) function to determine whether or not the value of a variable has changed. 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 changed when the data in the variable changes or when the CHG( ) function is applied. This format of the CHG( ) function 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$

   
Format 3 Get program changed state

CHG ( prglvl [,ERR=stmtref])

This format of the CHG function allows you to determine if the program running at the level specified has been changed. The function will return 0 if the program has not been changed, 1 if it has.