INPUT programming steps
Follow this procedure to use the INPUT dialog instruction.
To implement the INPUT statement:
- Create a form specification file, with an optional
screen record.The screen record identifies the presentation elements to be used by the runtime system to display the records. If you omit the declaration of the screen record in the form file, the runtime system will use the default screen records created by the form compiler for each table listed in theTABLESsection and for theFORMONLYpseudo-table. - Make sure that the program controls interruption handling with
DEFER INTERRUPT, to manage the validation/cancellation of the interactive dialog. -
Define a program
RECORDwith theDEFINEinstruction.The members of the program record must correspond to the elements of the screen record, by number and data types. -
Open and display the form, using
OPEN WINDOW WITH FORMor theOPEN FORM/DISPLAY FORMinstructions. - If needed, fill the program record with data, for example, with a result set cursor.
- Set the
int_flagvariable toFALSE. -
Implement the
INPUT dialog blockto handle data input. Set theWITHOUT DEFAULTSoption appropriately. - Inside the
INPUTstatement, control the behavior of the instruction withBEFORE INPUT,BEFORE FIELD,AFTER FIELD,AFTER INPUTandON ACTIONblocks. - After the interaction statement block, test the
int_flagpredefined variable to check if the dialog was canceled (int_flag=TRUE) or validated (int_flag=FALSE).If theint_flagvariable isTRUE, you should reset it toFALSEso as not to disturb code that relies on this variable to detect interruption events from the GUI front-end or TUI console.