The first step in creating a runnable ILE COBOL program object is to design your ILE COBOL source program.
An ILE COBOL source program consists of four divisions. The skeleton program in Figure 2 shows the structure of an ILE COBOL source program. It can be used as a sample for designing ILE COBOL source programs.
ILE COBOL programs can be contained in other ILE COBOL programs. This concept is known as nesting and the contained program is known as a nested program. Figure 2 shows how a nested ILE COBOL program is included in an outermost ILE COBOL program. Not all the entries provided in the skeleton program are required; most are provided for informational purposes only.
Figure 2. Example of ILE COBOL Program Structure
IDENTIFICATION DIVISION. (1) PROGRAM-ID. outermost-program-name. AUTHOR. comment-entry. INSTALLATION. comment-entry. DATE-WRITTEN. comment-entry. DATE-COMPILED. comment-entry. SECURITY. * The SECURITY paragraph can be used to specify * copyright information pertaining to the * generated module object. The first 8 lines * of the SECURITY paragraph generate the * copyright information that is displayed on * the Copyright Information panel when the * Display Module (DSPMOD) CL command is issued. ENVIRONMENT DIVISION. (2) CONFIGURATION SECTION. (3) SOURCE-COMPUTER. IBM-ISERIES. OBJECT-COMPUTER. IBM-ISERIES. SPECIAL-NAMES. REQUESTOR IS CONSOLE. INPUT-OUTPUT SECTION. (4) FILE-CONTROL. SELECT file-name ASSIGN TO DISK-file-name ORGANIZATION IS SEQUENTIAL ACCESS MODE IS SEQUENTIAL FILE STATUS IS data-name. DATA DIVISION. (5) FILE SECTION. FD file-name. 01 record-name PIC X(132). WORKING-STORAGE SECTION. 77 data-name PIC XX. LINKAGE SECTION. PROCEDURE DIVISION. (6) DECLARATIVES END DECLARATIVES. main-processing SECTION. mainline-paragraph. ILE COBOL statements. STOP RUN. IDENTIFICATION DIVISION. (7) PROGRAM-ID. nested-program-name. ENVIRONMENT DIVISION. (8) INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT file-name ASSIGN TO DISK-file-name ORGANIZATION IS SEQUENTIAL ACCESS MODE IS SEQUENTIAL FILE STATUS IS data-name. DATA DIVISION. FILE SECTION. FD file-name. 01 record-name PIC X(132). WORKING-STORAGE SECTION. 77 data-name PIC XX. LINKAGE SECTION. PROCEDURE DIVISION. DECLARATIVES END DECLARATIVES. main-processing SECTION. mainline-paragraph. ILE COBOL statements. EXIT PROGRAM. END PROGRAM nested-program-name. (9) END PROGRAM outermost-program-name. |
An ILE COBOL program is identified by the PROGRAM-ID in the IDENTIFICATION DIVISION. It contains a set of self-contained statements that perform a particular task.
In ILE, an ILE COBOL source program is considered to be an ILE procedure. If an ILE COBOL program contains nested ILE COBOL programs, each nested ILE COBOL program is an ILE procedure. The name of the nested program is only known within its containing program. If the nested program has the COMMON attribute, the name of the nested program is also known to other programs in the same compilation unit. ILE procedures are not to be confused with COBOL procedures, which are found in the Procedure Division of a COBOL program and contain sections, paragraphs, sentences, and statements.
For more information on writing your ILE COBOL program, refer to the WebSphere Development Studio: ILE COBOL Reference.
(C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.