Monday, May 25, 2020

Syntax

Character Set :-  same as other programming language 
                                        A,b,7,&,* etc

Coding Sheet :-  80 character position-format accepted by compiler

 Position     Field Description
1-6    Column Numbers   Reserved for Line Numbers    
 7 Indicator Have *, comment, slash /
 8-11 Area A All COBOL divisions, sections, paragraphs and some special entries begin here
 12-72 Area B All COBOL statements must begin in area B.
73-80  Identification Area as needed by Programmer


000100 IDENTIFICATION DIVISION.                                          000100
000200 PROGRAM-ID. HELLO.                                                   000101
000250* THIS IS A COMMENT LINE                                          000102
000300 PROCEDURE DIVISION.                                                000103
000350 A000-FIRST-PARA.                                                           000104
000400     DISPLAY “Coding Sheet”.                                           000105
000500 STOP RUN.                                                                       000106


Character String 

Comment :- does not effect execution of program

000360/ First Para Begins - Documentation Purpose                       000106
        
Literal :- Constant that is hard coded in program

DISPLAY 'Hello World'.   //Hello World is Literal  

Types:-

Alphanumeric Literals :- This is valid
Numeric Literals :-  100,+10.9, -1.9 etc

COBOL word :- character string that can be reserved or user-defined

Reserved :- file , data, paragraph names etc
Used-Defined :-  ADD,MOVE,+,-, ZEROES,SPACES etc

Figurative Constants :-
HIGH-VALUES , LOW-VALUES , ZERO/ZEROES , SPACES, QUOTES, ALL literal


No comments:

Post a Comment