section4 - Business Oriented Programming Course 92-252-01...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Business Oriented Programming Course 92-252-01 – Spring 2005 SECTION 4 – Procedure Division The PROCEDURE DIVISION contains the code used to manipulate the data described in the DATA DIVISION In COBOL, the ACCEPT and DISPLAY verbs are used to read from the keyboard and write to the screen. Input and output using these commands is somewhat primitive because they were originally designed for use in a batch-programming environment to communicate with the computer operator. In recent years, many vendors have augmented the ACCEPT and DISPLAY syntax to facilitate the creation of on-line systems by allowing such things as: cursor positioning, character attribute control and auto-validation of input. DISPLAY VERB The DISPLAY verb sends output to the computer screen or to a peripheral device. As you can see from the ellipses (. ..) in the metalanguage, a single DISPLAY may be used to display several data-items or literals or any combination of these NOTE: In the COBOL syntax diagrams ( COBOL metalanguage) upper case words are keywords. If underlined, they are mandatory. { } brackets mean that one of the options must be selected [ ] brackets mean that the item is optional ellipses (. ..) mean that the item may be repeated at the programmer’s discretion. The symbols used in the syntax diagram identifiers have the following significance:- $ signifies a string item, # is numeric item, i indicates that the item can be a variable identifier l indicates that the item can be a literal. DISPLAY OutputItem1$#il [OutputItem2$#il]… [UPON Menmonic – Name] [WITH NO ADVANCING ] After the items in the display list are seny to the screen, the DISPLAY automatically moves the screen cursor to the next line unless a WITH NO ADVANCING clause is present.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Mnemonic-Names make programs more readable. A Mnemonic-Name is a name devised by the programmer to represent some peripheral device (such as a serial port) or control code. The name is connected to the actual device or code by entries in the ENVIRONMENT DIVISION. When a Mnemonic-Name is used with the DISPLAY it represents an output device (serial port, parallel port etc). If a Mnemonic-Name is used output is sent to the device specified; otherwise, output is sent to the computer screen. DISPLAY examples DISPLAY "My name is " ProgrammerName. DISPLAY "The vat rate is " VatRate. DISPLAY PrinterSetupCodes UPON PrinterPort1 The ACCEPT verb is used to get data from the keyboard, a peripheral device, or certain system variables. Format1. ACCEPT Identifier [FROM Mnemonic – Name] Format2. ACCEPT Identifier FROM { DATE DAY DAY – OF – WEEK TIME } ACCEPT notes When the first format is used, the ACCEPT inserts the data typed at the keyboard (or coming from the peripheral device), into the receiving data-item. When the second format is used, the ACCEPT inserts the data obtained from one of the
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/10/2009 for the course CIS 252 taught by Professor Unknown during the Spring '05 term at Bloomsburg.

Page1 / 13

section4 - Business Oriented Programming Course 92-252-01...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online