Presentation is loading. Please wait.

Presentation is loading. Please wait.

Module 4 Constants Copy Statement Perform Verb Part 1.

Similar presentations


Presentation on theme: "Module 4 Constants Copy Statement Perform Verb Part 1."— Presentation transcript:

1 Module 4 Constants Copy Statement Perform Verb Part 1

2 Two types of Constants Literals Figurative Constants

3 Cobol Literals String / Alphanumeric literals are enclosed in quotes and may consists of alphanumeric characters e.g. “Alan Cheah”, “-123”, “123.45” Numeric Literals may consist of numerals, the decimal point and the plus & minus sign. Numeric literals are not enclosed in quotes. e.g. 123, 123.45, -640, E.g. : 01WeekAmt 03WeekAmt1pic 9(6) value 123456 03WeekAmt2pic x(6) value “123456”

4 Figurative Constants HIGH-VALUE or HIGH-VALUES LOW-VALUE or LOW-VALUES SPACE or SPACES ZERO or ZEROS or ZEROES QUOTE or QUOTES

5 Fig. Constants Examples 01PaycheckPIC 9(5)V99 VALUE 13.5. MOVE ZEROES TO Paycheck. 01StudentNamePIC X(10) VALUE “ALAN” MOVE ALL “-” TO StudentName

6 Copy Statement There are many files used in many programs Defining all the fields in the records is tedious and fussy. So, we can keep these record definitions in a directory/file accessible to all. These files are known as copy books/ copy text The copy book does not include a 01 level

7 Copy Statement Sample of copy book (emp-rec.cpy) 03emp-idpic x(5). 03emp-salary pic 9(5). Sample usage fdemp-file 01emp-rec. copy emp-rec.

8 Copy Statement After compilation fdemp-file 01emp-rec. 03emp-idpic x(5). 03emp-salary pic 9(5).

9 Perform Verb PROCEDURE DIVISION. TopLevel. Display “Top Level.Start Program” Perform Level_One Display “Back in Top Level.”. STOP RUN. Level_Two Display “Now in Level 2” Level_One Display “Now in Level 1” Perform Level_Two Display “Return to Level 1”

10 Compulsory Lab Exercise Using PERFORM paragraph PERFORM X TIMES, create a program that accepts user to enter X times for a paragraph to display “I love COBOL and UNITEN.” Please try before I show you the answer at the end of the lab.


Download ppt "Module 4 Constants Copy Statement Perform Verb Part 1."

Similar presentations


Ads by Google