Skip to main content

Variable records

  • November 8, 2011
  • 2 replies
  • 0 views

[Migrated content. Thread originally posted on 08 November 2011]

I have a problem with variable records. I never used them before.

I write for our Intranet a blog (the complete intranet is written in acu-cobol).

File description:

       fd  db-bstory external
           record is varying in size from 16 to 50016 characters
                  depending on dbbs-size
           data record dbbs-satz.
       01  dbbs-satz.
           03  dbbs-key.
               05  dbbs-id        pic x(16).
           03  dbbs-text          pic x(50000).



When i write the record, i calculate the record size and fill the dbbs-size.
Have i also to fill the dbbs-size when i read the record?

The Problem at the moment is:
when i show the blog entries some of the text of the next record is in the previous record shown.

2 replies

  • Author
  • Rocketeer
  • 19312 replies
  • November 8, 2011

[Migrated content. Thread originally posted on 08 November 2011]

I have a problem with variable records. I never used them before.

I write for our Intranet a blog (the complete intranet is written in acu-cobol).

File description:

       fd  db-bstory external
           record is varying in size from 16 to 50016 characters
                  depending on dbbs-size
           data record dbbs-satz.
       01  dbbs-satz.
           03  dbbs-key.
               05  dbbs-id        pic x(16).
           03  dbbs-text          pic x(50000).



When i write the record, i calculate the record size and fill the dbbs-size.
Have i also to fill the dbbs-size when i read the record?

The Problem at the moment is:
when i show the blog entries some of the text of the next record is in the previous record shown.

i found the error.

When i read several records from db-bstory.
I have to initialize the dbbs-text before i read the next record.
When the next text is shorter then the previous the rest of the prevois text is in the current record.


  • Author
  • Rocketeer
  • 19312 replies
  • November 8, 2011

[Migrated content. Thread originally posted on 08 November 2011]

I have a problem with variable records. I never used them before.

I write for our Intranet a blog (the complete intranet is written in acu-cobol).

File description:

       fd  db-bstory external
           record is varying in size from 16 to 50016 characters
                  depending on dbbs-size
           data record dbbs-satz.
       01  dbbs-satz.
           03  dbbs-key.
               05  dbbs-id        pic x(16).
           03  dbbs-text          pic x(50000).



When i write the record, i calculate the record size and fill the dbbs-size.
Have i also to fill the dbbs-size when i read the record?

The Problem at the moment is:
when i show the blog entries some of the text of the next record is in the previous record shown.

This scenario also happens when you read a sequential file

SELECT FILE1
ASSIGN TO "C:\\ABC.txt"
ORGANIZATION IS LINE SEQUENTIAL
ACCESS MODE IS SEQUENTIAL
FILE STATUS IS FILE1-STATUS.

FD FILE1
LABEL RECORDS ARE STANDARD.
01 FILE1-RECORD PIC X(500).


I always initialize the FILE1-RECORD before read FILE1.