Chain of Records is Broken

Hi.
I have a problem with a file with the index destroyed. I tried to recover it with the rebuild option but my message is "broken chain of records". If the file generated replacement lose a lot of records.
Is there another option that i can use to retrieve the index of this file?
Thank you.

  • Verified Answer

    Hello CIAC,

    First of all it would be helpfull if you could tell us the Vision version, are you still using the older Vision 3 format with index blocks stored in between the datablocks?  so just 1 file instead of the later Vision versions using a seperate data and index file?

    Have you tried rebuilding using alternate keys?

    If nothing works you could write a small program that reads through the Vision file and saves the records until it hits the "broken chain of records part,  then  start reading through the file from the end backward  saving the records to another file   until you hit the broken chain of records again,  than at least you hopefully have been able to save most of the records.

    So:

    1. create config file  with in it:

    ERRORS_OK ON

    2.  write small Cobol program that opens the problem file for input,  open a second file with same FD (just add other suffix)  for I-O.

    The program should do something like:

    move high-values to llbe2-pkey

               start llbe key not > llbe2-pkey

               perform Acu-llbe-Read-previous

               perform until llbe-status = "10"

                   compute was-teller = ws-teller 1

                   move llbe2-rec to ph2-rec

                   perform Acu-piet-Rec-Write

                   perform Acu-llbe-Read-previous

               end-perform

    Off course this needs to be adjusted to your data file!

    This will read through the corrupted file backwards wrting the readable records into the second file.

    When it hits the problem, you should close the problem file   open it again  then:

    move low-values to llbe2-pkey

               start llbe key not < llbe2-pkey

               perform Acu-llbe-Read-next

               perform until llbe-status = "10"

                   compute was-teller = ws-teller 1

                   move llbe2-rec to ph2-rec

                   perform Acu-piet-Rec-Write

                   perform Acu-llbe-Read-next

               end-perform

    Until you hit the error and than close the files and program,  the new file should have a lot of the records saved,  compare the records saved to how many were in the corrupted file.

    Anyhow, the above are cut and pastes out of a small program I wrote to save  a corrupted file from a customer, it was generated in Acubench  but you should see from it how to write your own "save-what-can-be-saved"  Cobol program  without using Acubench.

    Best regards and good luck,

    Piet