1 / 10

Micro Focus COBOL Programming

Micro Focus COBOL Programming. Module 4 Constants Copy Statement Perform Verb Part 1. Two types of Constants. Literals Figurative Constants. Cobol Literals. String / Alphanumeric literals are enclosed in quotes and may consists of alphanumeric characters

chick
Download Presentation

Micro Focus COBOL Programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Micro Focus COBOL Programming 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. : 01 WeekAmt 03 WeekAmt1 pic 9(6) value 123456 03 WeekAmt2 pic 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 01 Paycheck PIC 9(5)V99 VALUE 13.5. MOVE ZEROES TO Paycheck. 01 StudentName PIC 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) 03 emp-id pic x(5). 03 emp-salary pic 9(5). • Sample usage fd emp-file 01 emp-rec. copy emp-rec.

  8. Copy Statement • After compilation fd emp-file 01 emp-rec. 03 emp-id pic x(5). 03 emp-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.

More Related