Skip to main content
Question

Reading a text file

  • October 22, 2026
  • 4 replies
  • 12 views

wascarcobol1958

Hello friends. I’ve attached a small program designed to read a text file and create an indexed file from it. The problem is that it fails to read the file. I’ve added a `DISPLAY` and an `ACCEPT` statement to track when it reads the file, but it doesn’t seem to happen. I’m quite frustrated because this has worked in the past, but now I can’t figure out what’s going wrong. I’ve included both the file and the program; I would greatly appreciate your thoughts on this.

Hola amigos. Les anexo un pequeño programa cuyo objetivo es leer un archivo de texto para crear uno indexado. El probema que presenta es que no lee el archivo. He colocado un display y un accept para ver el momento en que lea el arvhivo pero no lo hace. Estoy frustrado porque esto ha funcionado en otras ocasiones pero ahora no entiendo que pasa. Les anexo el archivo y el programa para que me den su opinion, la cual será muy apreciada de mi parte.

Thanks.

Wascar Guerrero.

4 replies

Fano R.
Forum|alt.badge.img+2
  • Rocketeer
  • October 22, 2026

Hello Wascar,

What does the error message say?

Please provide us the information on the product and operating system you are using.


Thomas Morrison
Forum|alt.badge.img

Wascar,

I copied the two files to a folder.  Renamed MAESTRO.txt to MAESTRO.

Program ran to completion without error.

I then ran rmmapinx utility on WGMAEST with the following output:

  Data Records are compressed, Keys are compressed.

    Data Block Space Character Value = 32.

    Data Block Zero Character Value = 48.

    Key Block Space Character Value = 32.

  File has 7 Keys and 7 Segments.

  File contains 13 Records and occupies 32 Blocks.

  There are 21 empty Blocks.

  19 empty Blocks may be needed for a Rewrite operation.

  Open For Modify Count = 0.

Key Information:

     Key   Segment  Starting  Segment    Key    Tree   Duplicates

   Number  Number   Position  Length   Length  Height  Permitted?

     ---     ---      -----     ---      ---     --        ---

    Prime      1          1      29       29      1        No

       1       1         30      32       32      1        Yes

       2       1         62      40       40      1        Yes

       3       1        102       3        3      1        Yes

       4       1        118       3        3      1        Yes

       5       1        668      25       25      1        Yes

       6       1        693      31       31      1        Yes


COBOL STOP RUN at line 1569 in program RMMAPINX 

So, not sure what your issue is.  Start in an empty directory and try it, which would duplicate what I did.

Regards,
Tom Morrison


Thomas Morrison
Forum|alt.badge.img

Wascar,

In an empty directory, I copied the files.  Renamed MAESTRO.txt to MAESTRO.  Ran the program and it completed without error.

I ran the rmmapinx utility on the indexed file with the folwoing results:

  Data Records are compressed, Keys are compressed.

    Data Block Space Character Value = 32.

    Data Block Zero Character Value = 48.

    Key Block Space Character Value = 32.

  File has 7 Keys and 7 Segments.

  File contains 13 Records and occupies 32 Blocks.

  There are 21 empty Blocks.

  19 empty Blocks may be needed for a Rewrite operation.

  Open For Modify Count = 0.

Key Information:

     Key   Segment  Starting  Segment    Key    Tree   Duplicates

   Number  Number   Position  Length   Length  Height  Permitted?

     ---     ---      -----     ---      ---     --        ---

    Prime      1          1      29       29      1        No

       1       1         30      32       32      1        Yes

       2       1         62      40       40      1        Yes

       3       1        102       3        3      1        Yes

       4       1        118       3        3      1        Yes

       5       1        668      25       25      1        Yes

       6       1        693      31       31      1        Yes


COBOL STOP RUN at line 1569 in program RMMAPINX 

 

So, not sure what is going wrong.

 

Regards,

Tom Morrison


Thomas Morrison
Forum|alt.badge.img

Wascar,

In an empty directory, I copied the files.  Renamed MAESTRO.txt to MAESTRO.  Ran the program and it completed without error.

I ran the rmmapinx utility on the indexed file with the folwoing results:

  Data Records are compressed, Keys are compressed.
    Data Block Space Character Value = 32.
    Data Block Zero Character Value = 48.
    Key Block Space Character Value = 32.
  File has 7 Keys and 7 Segments.
  File contains 13 Records and occupies 32 Blocks.
  There are 21 empty Blocks.
  19 empty Blocks may be needed for a Rewrite operation.
  Open For Modify Count = 0.

Key Information:
     Key   Segment  Starting  Segment    Key    Tree   Duplicates
   Number  Number   Position  Length   Length  Height  Permitted?
     ---     ---      -----     ---      ---     --        ---
    Prime      1          1      29       29      1        No
       1       1         30      32       32      1        Yes
       2       1         62      40       40      1        Yes
       3       1        102       3        3      1        Yes
       4       1        118       3        3      1        Yes
       5       1        668      25       25      1        Yes
       6       1        693      31       31      1        Yes


COBOL STOP RUN at line 1569 in program RMMAPINX 

 

So, not sure what is going wrong.

 

Regards,

Tom Morrison