AMT Help Files

AMT-COBOL Form Code

Automatic generation of the form code

In AMT-COBOL the sharing of data values between the graphical Layout Controls and the Screen Working Storage (generally a Screen Copy) is performed automatically when the Layout Controls of the form and fieldnames in the Screen Copy, excluding the last letter (i.e L, F, A etc), are named the same. The code in the procedure division of the form then only needs to have the empty ws-to-form and form-to-ws sections and copy for the Symbolic Map as shown in the examples below. Both empty sections of code will already be in the template when creating a new Form.

The copy name in the working-storage section can then be used by the Screen Copy Wizard to create the Symbolic Map. See 'Screen Copy Wizard'.

 working-storage section.
 
 copy customer_form_map.

procedure division.

 ws-to-form section.
 init-ws-to-form.
*    this functionality is implemented in the runtime library.
 exit-ws-to-form.
 
 form-to-ws section.
 init-form-to-ws.
*    this functionality is implemented in the runtime library.
 exit-form-to-ws.
     exit.

Manipulation of the form data

To manipulate the data from the Symbolic Map before sending it to the form to be displayed, the Form needs to contain code to perform the task of changing the data values from the Symbolic Map.

Working Storage

The Symbolic Map fields should be copied into the code Working Storage, often this is done with a copy as shown in the example below.
The copy name in the working-storage section can also be used by the Screen Copy Wizard to create the Symbolic Map. See 'Screen Copy Wizard'.

 working-storage section.
 
 copy customer_form_map.

WS-TO-FORM section

In the Procedure Division there should be a section named 'WS-TO-FORM'. This section can contain code to change the Symbolic Map fields output values before it is send to the corresponding Graphical Layout Controls.

Example:

 ws-to-form section.
 ws-to-form-begin.
*    fill form fields with data from workings-storage (forminput)      
     inspect tel_nro replacing all '_' by '-'.
 ws-to-form-end.
     exit.

FORM-TO-WS section

For the values coming from the Graphical Layout Controls there should also be a section named 'FORM-TO-WS'. This section can also be used to change the data of the Symbolic Map input fields, an example of such a section is shown below.

 form-to-ws section.
 form-to-ws-begin.
*    fill working-storage (formoutput) with data from form fields
     inspect tel_nri replacing all '-' by '_'.
 form-to-ws-end.
     exit.

As in CICS Cobol the name of the Controls must match the field names in the Symbolic Map excluding the last letter (i.e L, F, A etc).