10.6 Saving and Restoring Field Values

Sometimes programmers have a need to "save" the current values of fields and then restore then at some later time.

For instance a user may need to save the values of fields #A -> #C, and to do this you often code fields like this:

      define #sava reffld(#a)

      define #savb reffld(#b)

      define #savc reffld(#c)

and later .... (to save the values)

      change #sava #a

      change #savb #b

      change #savc #c

and still later .... (to restore the values)

 

      change #a #sava

      change #b #savb

      change #c #savc

 

An easier way to do this is to use a "working" list as a "stack" like this:

               def_list #stack (#a #b #c) type(*working) entrys(1)

to save the current values, "stack" them like this:

               inz_list #stack

to restore the values, "unstack" them like this:

               get_entry 1 #stack

Some other points about this technique are: