0
votes

I've recently started a COBOL course and, because of my computer configuration (Windows 7 64 Bits and GNU/Linux 64Bits) I have to use Dosbox to compile and execute programs.

Everything is going well but, I'n finding some troubles when I try to open an Indexed file, either I-O or Ouput mode. I can compile and link but at execution time, dosbox get frozen.

My compiler version is MS-COBOL 5.0 and DosBox is 0.74 (last version).

Does anybody have had this issue? Can someone tell how to fix it.

My code is this one.

Thanks in advance.

   IDENTIFICATION DIVISION.

   PROGRAM-ID. AGENDA.
   AUTHOR. JOSE MARIA RAMIREZ MIRA.
   DATE-WRITTEN. 06/05/2014.
   DATE-COMPILED. 06/05/2014.

   ENVIRONMENT DIVISION.

   CONFIGURATION SECTION.

   SOURCE-COMPUTER. IBM-PC.
   OBJECT-COMPUTER. IBM-PC.

   SPECIAL-NAMES.
       DECIMAL-POINT IS COMMA.

   INPUT-OUTPUT SECTION.
   FILE-CONTROL.

       SELECT AGENDA ASSIGN TO DISK "AGENDA.DAT"
              ORGANIZATION IS INDEXED
              ACCESS IS RANDOM
              RECORD KEY IS AG-NICK
              FILE STATUS IS AG-STATUS.

   DATA DIVISION.

   FILE SECTION.
   FD AGENDA
      RECORD CONTAINS 112 CHARACTERS
      LABEL RECORD IS STANDARD
      DATA RECORD IS AG-PERSONA.

   01 AG-PERSONA.
      03 AG-NICK                PIC X(25).
      03 AG-NOMBRE              PIC X(25).
      03 AG-APELLIDOS           PIC X(50).
      03 AG-TELEFONO            PIC X(12).

   WORKING-STORAGE SECTION.

   77 AG-STATUS                 PIC 99.
      88 EXITO                  VALUE 00.
      88 CLAVE-DUPLICADA        VALUE 22.
      88 CLAVE-NO-ENCONTRADA    VALUE 23.
      88 SIN-ESPACIO-EN-DISCO   VALUE 34.
      88 FICHERO-NO-EXISTE      VALUE 35.
      88 EOF                    VALUE 10.

   PROCEDURE DIVISION.
   MAIN-PROCEDURE.

       DISPLAY "PROCEDO A ABRIR EL ARCHIVO".
       OPEN I-O AGENDA.
       IF EXITO THEN
          DISPLAY "EL ARCHIVO SE HA ABIERTO"
       ELSE
          EVALUATE TRUE
             WHEN FICHERO-NO-EXISTE
                DISPLAY "EL ARCHIVO NO EXISTE"
          END-EVALUATE
       END-IF.
       CLOSE AGENDA.
       STOP RUN.

   END PROGRAM AGENDA.
3
You are using extremely old software. Unless the course absolutely demands that COBOL, I'd go for the newer, open-source, GNU COBOL which you can find at Sourceforge. There's support for it. I doubt you'll get any support for MS COBOL V5. See this recent topic, stackoverflow.com/questions/21970061/… - Bill Woodger
Thanks for your comment. Yes, I'm using GNU COBOL (former openCOBOL) plus and IDE build with python, but as you suspect, the course I'm involved asks for programs to be compiled with that version. - Dhouard
If you have paid for the course, then insist that they assist you with getting this working or give you your money back. It is extremely unlikely that anyone visiting here is actively using that COBOL under DOSBOX for any useful purpose and will be able to assist you. Other than what NealB provided in the other topic, I don't think you'll get much from here. If you are paying for a COBOL course, you don't want to spend days trying to get something simple to work just because the software is 20 years old when there is a spanking new COBOL already on your machine. - Bill Woodger
Thanks for your concern. I'm not paying for this course. I thought about using Dosbox in order to get so old stuff working. My teacher says it works well in Windows XP but, as I explain I have Windows 7 and GNU/Linux in my laptop. Anyway, thank you for your response. - Dhouard

3 Answers

0
votes

What is the absolute path to AGENDA.DAT?

Sometimes with legacy DOS programs you can't read/write files inside folders with spaces on its name. Say, if your current folder is C:\ms cobol\ , rename it to C:\mscobol\.

It's worth a try, if this is your case.

0
votes

Have you tried selecting the file using the OPTIONAL phrase. For example,

SELECT OPTIONAL AGENDA ASSIGN TO DISK "AGENDA.DAT"
              ORGANIZATION IS INDEXED
              ACCESS IS RANDOM
              RECORD KEY IS AG-NICK
              FILE STATUS IS AG-STATUS.

The OPTIONAL phrase must be specified for files opened for INPUT, I-O, or EXTEND that need not be present when the program runs.

Against this being the problem is your statement that the problem also occurs with OPEN OUTPUT and the program should in any case be producing some output but as others have remarked the version of COBOL is not well known.

By the way I plugged your program into the online COBOL at http://www.compileonline.com/compile_cobol_online.php and it worked fine triggering the FICHERO-NO-EXISTE condition name.

But this does raise another point. In my Microfocus manual the file status code of 35 is given as being returned when an OPEN INPUT, I-O or EXTEND is attempted on a NON-OPTIONAL file that does not exist. A file status of 05 is returned if you have used the OPTIONAL phrase and the file does not exist at the time the OPEN is executed.

0
votes

DOSBox was designed for gaming. The problem could be DOSBox missing file and record locking. DOSBox has more issues like internal file caching, a time bomb with multi-user enabled programs. You could try vDos: http://sourceforge.net/projects/vdos/. It is Windows only, but integrates better with it.