Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6081643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:11:56+00:00 2026-05-23T11:11:56+00:00

I wonder, what do is wrong with my code because when I compile it

  • 0

I wonder, what do is wrong with my code because when I compile it the error in the following lines:

hello.cob: In paragraph ‘DADOS’:
hello.cob:25: Error: syntax error, unexpected ‘(‘, expecting WORD
hello.cob: In paragraph ‘FIM’:
hello.cob:31: Error: syntax error, unexpected ‘(‘

Here the source of my program:

   IDENTIFICATION   DIVISION.
   PROGRAM-ID.      TRIANG.
DATA DIVISION.

WORKING-STORAGE SECTION.
77  BASE    PIC 9(04) VALUE ZEROS.
77  ALTURA PIC 9(04) VALUE ZEROS.
77  HAREA   PIC 9(06) VALUE ZEROS.

SCREEN SECTION.
01  TELA.
02  BLANK SCREEN.
02  LINE 04 COLUMN 21 VALUE
"CALCULO DA AREA DE UM TRIANGULO".
02  LINE 06 COLUMN 15 VALUE
"AUTOR: Alexandre".
02  LINE 10 COLUMN 21 VALUE "ENTRE COM O VALOR DA ALTURA...".
02  LINE 12 COLUMN 21 VALUE "ENTRE COM O VALOR DA BASE...".
02  LINE 14 COLUMN 21 VALUE "ENTRE COM O VALOR DA AREA...".

PROCEDURE DIVISION.
INICIO.
    DISPLAY TELA.
DADOS.
    ACCEPT(10, 51) ALTURA.
    ACCEPT(12, 51) BASE.
CALCULO.
    MULTIPLY BASE BY ALTURA GIVING HAREA.
    DIVIDE 2 INTO HAREA.
FIM.    
    DISPLAY(14, 51) HAREA.
    DISPLAY(24, 31) "FIM DE PROGRAMA".
    STOP RUN.

Thanks for the help.


I put this 2 lines in the code:

   IDENTIFICATION   DIVISION.
   PROGRAM-ID.      TRIANG.
   DATA DIVISION.

   WORKING-STORAGE SECTION.
   77  BASE    PIC 9(04) VALUE ZEROS.
   77  ALTURA  PIC 9(04) VALUE ZEROS.
   77  HAREA   PIC 9(06) VALUE ZEROS.
   77  ESPERA  PIC 9(01) VALUE ZEROS.

   SCREEN SECTION.
   01  TELA.
   02  BLANK SCREEN.
   02  LINE 04 COLUMN 21 VALUE
   "CALCULO DA AREA DE UM TRIANGULO".
   02  LINE 06 COLUMN 15 VALUE
   "AUTOR: Alexandre".
   02  LINE 10 COLUMN 21 VALUE "ENTRE COM O VALOR DA ALTURA... ".
   02  LINE 12 COLUMN 21 VALUE "ENTRE COM O VALOR DA BASE...   ".
   02  LINE 14 COLUMN 21 VALUE "ENTRE COM O VALOR DA AREA...   ".

   PROCEDURE DIVISION.
   INICIO.
       DISPLAY TELA.
   DADOS.
       ACCEPT ALTURA AT LINE 10 COLUMN 51.
       ACCEPT BASE AT LINE 12 COLUMN 51.
   CALCULO.
       MULTIPLY BASE BY ALTURA GIVING HAREA.
       DIVIDE 2 INTO HAREA.
   FIM.
       DISPLAY HAREA LINE 14 COLUMN 51.
       ACCEPT ESPERA AT LINE 0 COLUMN 0.
       DISPLAY "FIM DE PROGRAMA" LINE 24 COLUMN 31.
       STOP RUN.

Added

77  ESPERA  PIC 9(01) VALUE ZEROS.

and

ACCEPT ESPERA AT LINE 0 COLUMN 0.

but the result is 000000

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T11:11:57+00:00Added an answer on May 23, 2026 at 11:11 am

    I got the program to work. Almost. I don’t know how to keep the screen up when the program terminates, so the result is never visible, but at least it is possible to run the program and put in the first two numbers:

           IDENTIFICATION   DIVISION.
           PROGRAM-ID.      TRIANG.
           DATA DIVISION.
    
           WORKING-STORAGE SECTION.
           77  BASE    PIC 9(04) VALUE ZEROS.
           77  ALTURA PIC 9(04) VALUE ZEROS.
           77  HAREA   PIC 9(06) VALUE ZEROS.
           77  DUMMY  PIC 9(01) VALUE ZEROS.
    
           SCREEN SECTION.
           01  TELA.
           02  BLANK SCREEN.
           02  LINE 04 COLUMN 21 VALUE
           "CALCULO DA AREA DE UM TRIANGULO".
           02  LINE 06 COLUMN 15 VALUE
           "AUTOR: Alexandre".
           02  LINE 10 COLUMN 21 VALUE "ENTRE COM O VALOR DA ALTURA...".
           02  LINE 12 COLUMN 21 VALUE "ENTRE COM O VALOR DA BASE...".
           02  LINE 14 COLUMN 21 VALUE "ENTRE COM O VALOR DA AREA...".
    
           PROCEDURE DIVISION.
           INICIO.
               DISPLAY TELA.
           DADOS.
               ACCEPT ALTURA AT LINE 10 COLUMN 51.
               ACCEPT BASE AT LINE 12 COLUMN 51.
           CALCULO.
               MULTIPLY BASE BY ALTURA GIVING HAREA.
               DIVIDE 2 INTO HAREA.
           FIM.
               DISPLAY HAREA LINE 14 COLUMN 51.
               DISPLAY "FIM DE PROGRAMA" LINE 24 COLUMN 31.
               ACCEPT DUMMY AT LINE 1 COLUMN 1.
               STOP RUN.
    

    A much cleaner better version:

           IDENTIFICATION   DIVISION.
       PROGRAM-ID.      TRIANG.
       DATA DIVISION.
    
       WORKING-STORAGE SECTION.
       77  BASE    PIC 9(04) VALUE ZEROS.
       77  ALTURA PIC 9(04) VALUE ZEROS.
       77  HAREA   PIC 9(07) VALUE ZEROS.
       77  AGAIN   PIC X VALUE 'N'.
    
       SCREEN SECTION.
       01  TELA.
       02  BLANK SCREEN.
       02  LINE 04 COLUMN 21 VALUE
       "CALCULO DA AREA DE UM TRIANGULO".
       02  LINE 06 COLUMN 15 VALUE
       "AUTOR: Alexandre".
       02  LINE 10 COLUMN 21 VALUE "ENTRE COM O VALOR DA ALTURA [____]".
       02  LINE 10 COLUMN 50 PIC ZZZ9 Using ALTURA.
       02  LINE 12 COLUMN 21 VALUE "ENTRE COM O VALOR DA BASE...[____]".
       02  LINE 12 COLUMN 50 PIC ZZZ9 Using BASE.
       02  LINE 14 COLUMN 21 VALUE "            VALOR DA AREA..".
       02  LINE 14 COLUMN 48 PIC ZZZZZZ9 From HAREA.
       02  LINE 16 COLUMN 21 VALUE "                    FINIS...[N]".
       02  LINE 16 COLUMN 50 PIC X Using AGAIN.
    
       PROCEDURE DIVISION.
       INICIO.
           DISPLAY TELA.
           PERFORM SCREENS UNTIL AGAIN  = 'Y'
           STOP RUN.
       SCREENS.
           ACCEPT TELA.
           MULTIPLY BASE BY ALTURA GIVING HAREA.
           DIVIDE 2 INTO HAREA.
           DISPLAY TELA.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been struggling in fixing this code, wonder what is wrong at all...
I know there's something wrong with my code because the page never loads so
I'm trying to digitally sign a MultiMIME message using the following code. I wonder
I am trying to write a string concatenation code. I wonder what is wrong
I read from a book saying that the following c++ code should not compile:
wonder what's wrong <table id=tblDomainVersion> <tr> <td>Version</td> <td>No of sites</td> </tr> <tr> <td class=clsversion>1.25</td>
I wonder if there is something wrong with the copy constructor function below? class
wonder whether someone can help me with the following one... I have a struct
i wonder what i'm doing wrong? <video id=movie width=320 height=240 preload controls> <source src=pr6.mp4
i wonder what i'm doing wrong? I'm working on a ftp-upload with php. if

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.