CHG( ) |
Notify If Variable Has Changed |
CHG(varlist[,ERR=stmtref]) | |
CHG(READ varlist[,ERR=stmtref]) | |
CHG(prglvl[,ERR=stmtref]) |
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. |
String, listing variables that have changed (Formats 1 and 2).
Numeric, 0 or 1, indication that program has changes (Format 3).
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.
Notify and 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:
print chg("A,B,D$,E$")
A=1.234
E$="MIKEY"
print chg("A,B,D$,E$") ! Prints A,E$
print chg("A,B,D$,E$") ! Prints nothing
CHG(READ varlist[,ERR=stmtref])
This format of the CHG( ) function 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:
print chg("A,B,D$,E$")
A=1.234
E$="MIKEY"
print chg(read "A,B,D$,E$") ! Prints A,E$
print chg("A,B,D$,E$") ! Prints A,E$
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 or 1 if it has.