Top
PowerCOBOL V11.0 User's Guide
FUJITSU Software

5.3.2 Form Divisions, Sections and Event Procedures

Unlike individual control procedures (scriptlets), which typically contain only local data and execution statements, form procedures also include declaration statements for the entire form and for any common procedures within the project. The kinds of statements that can be included are:

To access form procedures, right-click the mouse on any blank area of a form. The following pop-up menu will appear:

Figure 5.6 Form Procedures Pop-up menu.

From this pop-up menu, you can display individual form divisions, sections, and event procedures by selecting the appropriate option.

5.3.2.1 ENVIROMENT DIVISION

If you move the mouse over Edit ENVIRONMENT DIVISION, a secondary pop-up menu will appear from which you can select SPECIAL-NAMES, REPOSITORY or FILE-CONTROL.

5.3.2.1.1 SPECIAL-NAMES

Describes the SPECIAL-NAMES statement in the CONFIGURATION section of the ENVIRONMENT DIVISION.

Declare the name and value of SPECIAL-NAMES such as symbolic constants in the SPECIAL-NAMES event procedure.

Figure 5.7 SPECIAL-NAMES declaration

5.3.2.2 REPOSITORY

Describes optional Class definitions such as the special *OLE class.

5.3.2.3 FILE-CONTROL

Describes the FILE-CONTROL statement of the INPUT-OUTPUT section in the ENVIRONMENT DIVISION of a COBOL program.

Use the SELECT statement in the FILE-CONTROL event procedure to declare which files the form will use. This function is required only if a file is called from within a form. The following figure shows how the FILE-CONTROL is declared.

Figure 5.8 FILE-CONTROL declaration

5.3.2.4 DATA DIVISION

If you move the mouse over Edit DATA DIVISION, you can select the BASED-STORAGE, FILE, WORKING-STORAGE, or CONSTANT sections.

5.3.2.4.1 BASED-STORAGE

Describes the BASED-STORAGE section in the DATA DIVISION of a COBOL program. BASED-STORAGE is a Fujitsu extension to COBOL85. Refer to the "NetCOBOL Language Reference" for more information.

5.3.2.4.2 FILE

Describes the FILE section in the DATA DIVISION of a COBOL program.

Specify the File Descriptor of data files (FD's) and their associated record definitions, in the FILE section. The following figure shows how the FILE section is declared.

Figure 5.9 FILE declaration

The IS GLOBAL clause in the FD statement allows the file to be accessed from any event procedure (scriptlet) within the form.

5.3.2.4.3 WORKING-STORAGE

Describes the WORKING-STORAGE section in the DATA DIVISION of a COBOL program. This is the area where data items are defined.

The following figure illustrates how to declare data items in WORKING-STORAGE.

Figure 5.10 WORKING-STORAGE declaration

5.3.2.4.4 CONSTANT

Describes the CONSTANT section in the DATA DIVISION of a COBOL program.

The following figure illustrates using the CONSTANT statement to declare the names and values that do not change throughout the execution of a program.

Figure 5.11 CONSTANT declaration

The use of the IS GLOBAL clause allows the constants to be referenced within any of the form's event procedures.

5.3.2.5 PROCEDURE DIVISION

If you move the mouse over Edit PROCEDURE DIVISION, you may select the New or PROCEDURE options.

5.3.2.5.1 NEW (PROCEDURE)

Allows you to create common internal procedures within a form. These are procedures that are not ties to any specific event, but may be called from other procedures in the application. For example, if you needed to write a procedure to read in some records from a data file and populate a control on the form, you might want to place this code in a separate callable procedure.

Any procedures that are called within a program, or called from within other procedures, can be described in the PROCEDURE window.

PowerCOBOL will assign a default name to each procedure you create here. You may change the name in the left windowpane of the Project Manager window by selecting it and typing in a new name.