cobol complete reference

Download Cobol Complete Reference

Post on 15-Nov-2014

107 views

Category:

Documents

0 download

Embed Size (px)

TRANSCRIPT

COBOL

Table of Contents1. OBJECTIVE...............................................................................................................................................................5 2. INTRODUCTION......................................................................................................................................................6 HISTORY OF COBOL.................................................................................................................................................6 ABOUT COBOL..........................................................................................................................................................6 3. PROGRAM STRUCTURE........................................................................................................................................8 REFERENCE FORMAT: -...........................................................................................................................................8 SEQUENCE NUMBER AREA..................................................................................................................................................8 INDICATOR AREA...............................................................................................................................................................8 AREA A...........................................................................................................................................................................9 AREA B...........................................................................................................................................................................9 4. IDENTIFICATION DIVISION...............................................................................................................................10 PROGRAM-ID...........................................................................................................................................................10 5. ENVIRONMENT DIVISION..................................................................................................................................12 CONFIGURATION SECTION: -...............................................................................................................................12 INPUT-OUTPUT SECTION: -...................................................................................................................................13 I-O CONTROL...........................................................................................................................................................14 FILE-CONTROL........................................................................................................................................................14 RECORD FORMAT...................................................................................................................................................14 EFFICIENT FILE ORGANIZATION AND MANAGEMENT.................................................................................16 SEQUENTIAL FILE .................................................................................................................................................16 INDEXED FILE ........................................................................................................................................................17 RELATIVE FILE .......................................................................................................................................................18 EXERCISES..................................................................................................................................................................21 6. DATA DIVISION......................................................................................................................................................22 LEVELS......................................................................................................................................................................22 CONDITION NAMES (88-LEVEL)..........................................................................................................................23 DATA TYPES.............................................................................................................................................................23 PICTURE CLAUSE...................................................................................................................................................24 PICTURE STRING - RULES............................................................................................................................................24 FILE SECTION: -.......................................................................................................................................................25 WORKING-STORAGE SECTION: -........................................................................................................................26 REDEFINES...........................................................................................................................................................27 RESTRICTIONS ON REDEFINES.....................................................................................................................................27 EXTERNAL...............................................................................................................................................................28 GLOBAL....................................................................................................................................................................29 JUSTIFIED.............................................................................................................................................................29 SIGN.......................................................................................................................................................................30 SIGN CLAUSE EXAMPLES...............................................................................................................................................31 VALUE CLAUSE: -...................................................................................................................................................31 EDITING: -.............................................................................................................................................................31 LINKAGE SECTION: -.............................................................................................................................................34 USAGE CLAUSE ......................................................................................................................................................35 DISPLAY: -.................................................................................................................................................................37 INDEX: -.....................................................................................................................................................................37 POINTER: -................................................................................................................................................................38 SYNCHRONIZED.....................................................................................................................................................39

EXERCISES..................................................................................................................................................................40 7. PROCEDURE DIVISION.......................................................................................................................................41 SECTIONS AND PARAS: -.......................................................................................................................................41 RULES FOR SECTION/PARA NAMES: -.........................................................................................................................41 INPUT - OUTPUT VERBS........................................................................................................................................42 ACCEPT.....................................................................................................................................................................42 DISPLAY....................................................................................................................................................................43 DISPLAY - RULES.......................................................................................................................................................43 ARITHMETIC OPERATIONS..................................................................................................................................44 ADD: -........................................................................................................................................................................44 CORRESPONDING: -...............................................................................................................................................45 ADD CORRESPONDING:-.................................................................................................................................................46 ON SIZE ERROR OCCURS..........................................................................................................................................47 ROUNDED PHRASE.....................................................................................................................................................47 SUBTRACT...................