skip to main content

Object-oriented Programming : Sample application : Main program

Main program
Most object oriented applications have a conventional program to start the processing. BANKMAIN serves this function in this sample bank application.
PROGRAM-ID. BANKMAIN.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
CLASS Account.
DATA DIVISION.
WORKING-STORAGE SECTION.
01  an-object USAGE OBJECT REFERENCE Account.
PROCEDURE DIVISION.
    INVOKE Account "new" RETURNING an-object.
    INVOKE an-object "displayUI".
    SET an-object to NULL.
    GOBACK.
The same code can also be written as follows:
PROGRAM-ID. BANKMAIN.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
CLASS Account.
DATA DIVISION.
WORKING-STORAGE SECTION.
01  an-object USAGE OBJECT REFERENCE Account.
PROCEDURE DIVISION.
    SET an-object TO Account:>new().
    an-object:>displayUI().
    SET an-object to NULL.
    GOBACK.

Copyright (c) 2017 Veryant
Contact us
Please share your comments on this manual or on any
Veryant product documentation with the email button at the top left