NCL procedures need a simple mechanism for finding out which input fields have been modified on a display panel with multiple fields. This lets you validate only those fields which were changed.
When an NCL procedure executes with the &CONTROL FLDCTL option set, Panel Services processing automatically creates a stack of all modified input fields returned from the terminal. This stack is built by scanning the input panel line by line from top to bottom, and from left to right. The system variable &ZMODFLD is primed with the name of the input field variable that is logically at the top of the stack. Each time the &ZMODFLD variable is referenced, its value changes to the name of the variable associated with the next modified input field on the panel. When the procedure processes the last panel input field variable name, &ZMODFLD is reset to a null value.
Example: Find Out Changed Input Fields
&CONTROL NOLABEL
.
.
.
&PANEL GETABC -* Display panel containing input fields
-* &A, &B, and &C.
.
. -* User enters fields A and C.
.
. -* Procedure resumes processing
. -* &ZMODFLD = A
.
.INPUTLOOP
&GOTO .&ZMODFLD -* Process next modified field -* variable
&GOTO .NEXTPANEL -* No more fields...issue next panel.
.A... -* Process input variable A. This is
-* the first reference to &ZMODFLD,
-* whose value now changes to the next
-* variable name on the stack, that is, C.
&GOTO .INPUTLOOP
.C... -* Process input variable C. This is
-* the second reference to &ZMODFLD,
-* whose value now becomes null, since C
-* is the last modified field variable.
&GOTO .INPUTLOOP
An NCL process can have one active &ZMODFLD stack at a time. If another panel is displayed while the &CONTROL FLDCTL option is still in force, then the current &ZMODFLD stack is rebuilt. &ZMODFLD variables that are not accessed remain in the stack if they are in the panel just displayed.
Alternatively, if &CONTROL NOFLDCTL is issued to suspend the &ZMODFLD stack generation, any number of other panels can be presented without destroying the &ZMODFLD stack. The &ZMODFLD stack is available for use unchanged as soon as &CONTROL FLDCTL is reissued. Certain options of the &ASSIGN verb help manipulate the &ZMODFLD stack. For more information about the &ASSIGN verb, see the Network Control Language Reference Guide.
| Copyright © 2011 CA. All rights reserved. | Tell Technical Publications how we can improve this information |