Procedure Division & Basic Verbs
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Procedure Division & Basic Verbs

on

  • 4,646 views

A text on procedure division of COBOL and introduction to Basic and Arithmetic verbs.

A text on procedure division of COBOL and introduction to Basic and Arithmetic verbs.

Statistics

Views

Total Views
4,646
Views on SlideShare
4,639
Embed Views
7

Actions

Likes
0
Downloads
57
Comments
0

2 Embeds 7

http://www.slideshare.net 6
http://www.slashdocs.com 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

CC Attribution-NonCommercial LicenseCC Attribution-NonCommercial License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Procedure Division & Basic Verbs Presentation Transcript

  • 1. Introduction to COBOL Programming
  • 2.
    • Overview and Examples
  • 3.
    • PROCEDURE DIVISION consists of uniquely named SECTIONS
        • section-name SECTION.
    • A SECTION can have zero or more PARAGRAPHS
    • A PARAGRAPH has zero or more SENTENCES
    • SENTENCES are a set of STATEMENTS terminated by a period
    • STATEMENTS are operations to be performed by the computer
  • 4.
    • PROCEDURE DIVISION.
    • { section-name SECTION.
    • [paragraph-name. [sentence 1] …
    • … [sentence n] ] … }
    • PROCEDURE DIVISION.
    • [paragraph-name. [sentence 1] … [sentence n] ] …
  • 5.
    • Structure Of Procedure Division
  • 6.
    • A STATEMENT always starts with a VERB and consists of words and literals
    • A SENTENCE is a set of one or more STATEMENTS terminated by a period ‘.’
        • ADD A TO B.
        • IF X GREATER THAN 1000 GO TO PARA-BIG.
    • There can be more than one STATEMENT or SENTENCE in a line. Alternatively, a STATEMENT can be broken and can be continued in the next line
  • 7.
    • Structure Of Procedure Division
  • 8.
    • SECTIONS in PROCEDURE DIVISION are user-defined and not fixed as in DATA and ENVIRONMENT DIVISIONS
    • SECTIONS are terminated either by the appearance of another SECTION HEADER or at the end of PROCEDURE DIVISION
    • SECTIONS must start with a name followed by SECTION keyword with at least one space in between
        • Section-name SECTION.
  • 9.
    • A PARAGRAPH consists of zero or more statements
    • The PARAGRAPH is terminated by the appearance of another PARAGRAPH HEADER or SECTION HEADER or at the end of PROCEDURE DIVISION
        • Para-one.
          • MOVE d-rate TO rate
          • MULTIPLY amt BY rate GIVING dividend.
        • Para-two.
        • Para-three.
  • 10.
    • SENTENCES and STATEMENTS must be written in AREA B
    • To avoid ambiguity, all section names must be unique and different from paragraph names, data names
    • All paragraphs within a section must have unique name, but need not be unique in the entire program
  • 11.
    • Paragraph-name OF section-name
    • sect1 SECTION.
      • this-para . [statements]
      • second-para. [statements]
    • sect2 SECTION.
      • this-para . [sentences]
  • 12.
    • Paragraph-name OF section-name
    • sect1 SECTION.
      • this-para . [statements] this-para OF sect1
      • second-para. [statements]
    • sect2 Section.
      • this-para . [sentences] this-para OF sect2
  • 13.
    • Basic Verbs
  • 14.
    • MOVE verb is necessary to transfer a data from one place to another.
    • MOVE {identifier1 / literal 1} TO identifer2, [,id3]…
        • MOVE A TO B.
        • MOVE 3 TO C.
        • MOVE X TO Y, Z.
  • 15. Before Execution After Execution Before Execution After Execution
  • 16. Before Execution After Execution Before Execution After Execution
  • 17. Before Execution After Execution Before Execution After Execution
  • 18. Before Execution After Execution
    • MOVE 15 TO A
    • MOVE “THERE IS AN ERROR” TO B
    • MOVE A TO B, C, D
  • 19.
    • Arithmetic Verbs
  • 20.
    • To compute sum of two or more numbers.
    • ADD {identifier1 / literal1} [id2, lit2] .. TO identifier3 [, id4] …
    • ADD {identifier1 / literal1} {id2, lit2} .. GIVING identifr3 [, id4] …
    • ADD A To B B = A + B
    • ADD A B C TO D D = A + B + C + D
    • ADD 15 A TO B B = 15 + A + B
    • ADD A B GIVING C C = A + B
    • ADD A B GIVING C D E C = D = E = A + B
  • 21.
    • Arithmetic Verbs
  • 22.
    • To subtract one, or the sum of two or more numbers from one or more numbers.
    • SUBTRACT {identifier1 / literal1} [id2, lit2] .. FROM identifier3 [, id4] … [, GIVING identifier5 [, identifier6] … ]
    • SUBTRACT A FROM B B = B – A
    • SUBTRACT A B FROM C C = C – A – B [ =C – (A+B) ]
    • SUBTRACT A B FROM C GIVING D D = C – (A + B)
    • SUBTRACT A B From 50 GIVING C C = 50 – (A + B)
    • SUBTRACT 15 FROM A B A = A – 15 & B = B – 15