Logo 
Search:

Cobol Articles

Submit Article
Home » Articles » Cobol » Homework HelpRSS Feeds

Program that Displays one or more data on the DOS standard output device

Posted By: Logan Bouchard     Category: Cobol     Views: 1701

Program that Displays one or more data on the DOS standard output device.

Code for Program that Displays one or more data on the DOS standard output device in Cobol

IDENTIFICATION DIVISION.
PROGRAM-ID. TEST_DISPLAY.

DATA DIVISION.
WORKING-STORAGE SECTION.
77 DATA1   PIC X(10)          VALUE "Hello".
77 DATA2   PIC X(10)          VALUE ", world".
77 NUM-01  PIC 9(5)V9(2)      VALUE 123.45.
77 NUM-02  PIC 9(5)V9(2) COMP VALUE 123.45.
77 NUM-03  PIC S9(5)V9(2)     VALUE -123.45.
77 NUM-04  PIC S9(5)V9(2)     VALUE 123.45.
01 GR.
   02 GROUP-01.
      05 NUM-DISPLAY           PIC 9(4) VALUE 123.
*     (97 is the ascii code for'a')
      05 NUM-COMP              PIC 9(2) COMP VALUE 97.
      05 GROUP-011.
         10 STR                PIC X(2) VALUE "FG".
         10 STR-2              PIC X(4) VALUE "HIJK".
      05 STR                   PIC X(5) VALUE "ABCDE".

PROCEDURE DIVISION.
MAIN.
    DISPLAY DATA1 WITH NO ADVANCING
    DISPLAY DATA2

    DISPLAY "NUM-01=" NUM-01
    DISPLAY "NUM-02=" NUM-02
    DISPLAY "NUM-03=" NUM-03
    DISPLAY "NUM-04=" NUM-04

    DISPLAY "GR=" GR
    DISPLAY "GROUP-011=" GROUP-011
    DISPLAY "NUM-COMP=" NUM-COMP

    STOP RUN
    .
* =================================================================

* The result is:

* Hello     , world
* NUM-01=0012345
* NUM-02=0012345
* NUM-03=-0012345
* NUM-04=+0012345
* GR=0123a FGHIJKABCDE
* GROUP-011=FGHIJK
* NUM-COMP=97
  
Share: 



Logan Bouchard
Logan Bouchard author of Program that Displays one or more data on the DOS standard output device is from Montreal, Canada.
 
View All Articles

Related Articles and Code:


 

Other Interesting Articles in Cobol:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!