Let's understand Mainframe
Home Tutorials Interview Q&A Quiz Mainframe Memes Contact us About us

Module 3: COBOL Program structure


COBOL Word

  • A COBOL word can be made using the following characters:-
    1. 0 – 9
    2. A – Z (a – z)
    3. – (Hyphen)
  • Created word must be adhered to the following rules:-
    1. A word cannot begin or end with hyphen
    2. A word can consist of maximum 30 characters
    3. At least one character must be letter. Some compilers also make it mandatory to specify first character as letter
    4. Except hyphen(-) no special characters are allowed
  • Examples:-
    Valid words Invalid words and reason
    EMP-NAME -NAME (Invalid since it starts with Hyphen)
    NEW-TIME EMP LOCATION (Invalid as it contains space between EMP and Location)
    EMP-DATE30 8-9-10 (Invalid as no letter)
  • There are two types of words in COBOL :- User-defined words or Reserved words
  • The reserved words also called as pre-defined words. It used in COBOL statements and entries for specific requirements
  • Some reserved words are: - ADD, SUBTRACT, MULTIPLY, DIVIDE, ACCEPT, IF, EVALUATE, PERFORM etc.
  • A complete list of reserved words can be referred in manual supplied with the compiler you are using



Advertisements






© copyright mainframebug.com
Privacy Policy