|
Sample Cobol Program on Mainframe Screen
Sample Cobol Program on Mainframe Screen
This program sum up the values of WS-B & WS-C data-items and store the result
in WS-A data-item and display the all data item values to the spool.
COBOL compiler accepts the source code in a standard format. There are 80
character positions on each line of source code.
Sequence Number -> (Optional) use these positions to give sequence number
to the lines of source code.
Indicator -> Use * for commenting the line. Other values can be used in
this position are slash(/) and hyphen(-).
Area A & Area B -> Contains COBOL source code. ( Position 8 to 72 )
Identification -> COBOL compiler will ignore the data in these positions.
There are four Divisions in every COBOL programs.
IDENTIFICATION DIVISION
This division contains the information to identify the program. There are
seven paragraph headers in this division. PROGRAM-ID is mandatory, rest
all headers are optional.
ENVIRONMENT DIVISION
Environment Division describe the physical characteristics of input-ouput
data sources used by the program. The Environment Division consists of two
sections of which both are optional. (Configuration Section & Input-Output
Section )
DATA DIVISION
All data items used in the program must be defined in Data Division. There
are 3 important sections in this divisions. FILE SECTION, WORKING-STORAGE
SECTION & LINKAGE SECTION.
PROCEDURE DIVISION
This is the place where , programmer needs to implement the program logic.
|
|