RAMESH KRISHNA REDDY mainframe discussion forum - cobol, db2,cics,jcl,file-aid,changeman,interview questions
Online Tutorials   | PREV  | TOP  | NEXT


COBOL Sample Program


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.



Previous chapter in COBOL tutorial Starting of COBOL tutorial Next chapter in COBOL tutorial

Visit COBOL books section in this site for good books

Home | Donations | Online Tutorials | Books | Entertainment | Contactme | privacy |  sql tutorial | jcl interview questions | JCL Tutorial | JCL Tutorial - chapter1 | JCL Tutorial - chapter2 | JCL Tutorial - chapter3 | JCL Tutorial - chapter4 | JCL Tutorial - chapter5 | JCL Tutorial - chapter6 | JCL Tutorial - chapter7 | JCL Tutorial - chapter8 | JCL Tutorial - chapter9 | JCL Tutorial - chapter10 | JCL Tutorial - chapter11