3

I'm running a program to help document what is contained in our 30+year old database. During the course of this process, I am getting the following error message:

Attempted READ of record ID larger than file/table maximum record ID size of 255 characters.

My program is working like this:

LOOP WHILE I <= NUM.FILES
    RECORD          = ""
    FILENAME        = FILE.LIST<I>
    ERROR           = ""
    DEBUG.RECORD    = ""
    HAVE.LOOKED     = 0
    OPEN 'DICT ':FILENAME TO D.FILE THEN
        OPEN FILENAME TO T.FILE THEN
            STATEMENT   = "SSELECT ONLY DICT ":FILENAME:' BY FIELD.NO WITH FIELD.NO >= 0 AND WITH FIELD.NO <= 900 AND WITH FIELD # ".]"'
            DEBUG       = ""
            PRINT FILENAME
            EXECUTE STATEMENT RETURNING DEBUG
            LOOP WHILE READNEXT FIELDNAME DO
                READ FIELD.RECORD FROM D.FILE, FIELDNAME THEN
                    IF LEN(FIELDNAME) > BIGGEST.KEY.LEN THEN
                        BIGGEST.KEY         = FIELDNAME
                        BIGGEST.KEY.LEN     = LEN(FIELDNAME)
                        BIGGEST.KEY.FILE    = "DICT ": FILENAME
                        PRINT FILENAME:" ":LEN(FIELDNAME):" ":FIELDNAME
                    END
                    USE.COUNT           = ""
                    USE.LIST            = ""
                    USE.COUNT.STATEMENT = "SELECT ":FILENAME:" WITH ":FIELDNAME:' # ""'
                    DEBUGS              = ""
                    EXECUTE USE.COUNT.STATEMENT RTNLIST USE.LIST RETURNING DEBUGS
                    ROW         = ""
                    ROW<1,1>    = FIELD.RECORD<2>   ;   *Attribute Number
                    ROW<1,2>    = FIELDNAME         ;   *Field Name
                    ROW<1,3>    = FIELD.RECORD<1>   ;   *Field Type
                    ROW<1,4>    = FIELD.RECORD<10>  ;   *Field Size
                    ROW<1,5>    = FIELD.RECORD<12>  ;   *Is Multivalued: "" = no, "Y" = Multivalued, "###" = specific multivalue
                    ROW<1,6>    = FIELD.RECORD<13>  ;   *Is Subvalued: "" = no, "Y" = Subvalued, "###" = specific subvalue
                    ROW<1,7>    = FIELD.RECORD<7>   ;   *Automatic data output conversion
                    ROW<1,8>    = FIELD.RECORD<8>   ;   *Correlative field definition
                    ROW<1,9>    = FIELD.RECORD<11>  ;   *Field description
                    ROW<1,10>   = @SELECTED         ;   *Number of records that don't have this field blank
                    RECORD<-1>  = ROW
                    IF ROW<1,10> < 1 THEN
                        READ UNUSED.FIELDS FROM CHUCK.WORK, "FILE.DEBUG.UNUSED.FIELDS" ELSE
                            UNUSED.FIELDS = ""
                        END
                        UNUSED.FIELDS<-1> = FILENAME:VM:ROW
                        WRITE UNUSED.FIELDS ON CHUCK.WORK, "FILE.DEBUG.UNUSED.FIELDS"
                    END
                    IF FIELD.RECORD<2> = 0 AND @SELECTED > 0 AND HAVE.LOOKED = 0 THEN
                        LOOP WHILE READNEXT KEY FROM USE.LIST DO
                            IF LEN(KEY) > BIGGEST.KEY.LEN THEN
                                BIGGEST.KEY         = KEY
                                BIGGEST.KEY.LEN     = LEN(KEY)
                                BIGGEST.KEY.FILE    = FILENAME
                                PRINT FILENAME:" ":LEN(KEY):" ":KEY
                            END
                        REPEAT
                        HAVE.LOOKED = 1
                    END
                END
            REPEAT
        END ELSE
            ERROR<-1> = "Failed to open file '":FILENAME:"'"
        END
    END ELSE
        ERROR<-1> = "Failed to open file DICT '":FILENAME:"'"
    END
    WRITE RECORD ON CHUCK.WORK, "FILE.":FILENAME
    WRITE DEBUG.RECORD ON CHUCK.WORK, "FILE.DEBUG.":FILENAME
    READ CHUCK.LOG FROM CHUCK.WORK, "CHUCK.LOG" ELSE
        CHUCK.LOG = ""
    END
    CHUCK.LOG<-1> = "FILE '":FILENAME:"' had ":DCOUNT(RECORD,AM):" fields"
    IF ERROR THEN
        CHUCK.LOG<-1>   = ERROR
        ERRORS<-1>      = ERROR
    END
    WRITE CHUCK.LOG ON CHUCK.WORK,"CHUCK.LOG"
    CLEARSELECT
    I = I + 1
REPEAT

When I look at the database directly, I can't find any record IDs or keys with more than 35 characters in the file which is causing problems, and nothing longer than 70 characters in the entire database. Can anyone help identify why these records are getting flagged in this process but aren't discoverable directly?

Below is a program I wrote to specifically find the problematic records, but it can't find the culprit

OPEN "CHUCK.WORK" TO CHUCK.WORK ELSE
        PRINT "UNABLE TO OPEN CHUCK.WORK"
        RETURN
    END
    READ FILENAME FROM CHUCK.WORK, "LISTME" ELSE
        PRINT "UNABLE TO READ LISTME"
        RETURN
    END
    NUM.FILES = DCOUNT(FILENAME,AM)
    FOR I = 1 TO NUM.FILES
        OPEN FILENAME<I> TO T.FILE ELSE
            PRINT "UNABLE TO OPEN ":FILENAME<I>
            RETURN
        END
        EXECUTE 'SELECT ':FILENAME<I>
        LOOP WHILE READNEXT KEY DO
            IF LEN(KEY) > 20 THEN
                PRINT FILENAME<I>:" ":LEN(KEY):" ":KEY
            END
        REPEAT
    NEXT I

UPDATE

One of my coworkers identified the source of the problem, even though we haven't identified how to fix the problem: one of our files has a multivalued field which is a key used in a correlative. For some reason, Universe is trying to read the entire attribute instead of the individual multivalue as the key, which causes the long record IDs. Anyone able to see whether I am doing something wrong in my code or if there is some setting in the database that we need to look at?

Charles
  • 355
  • 1
  • 2
  • 12

1 Answers1

0

When you see this error it has nothing to do with the size of keys in file, it is simply that the @ID you are trying to READ is longer than 255 chars. When I have seen it usually show me what line in the source code it happened on. If you put this right before you that line you should be able to track it down.

IF LEN(THIS.ID) GT 255 THEN
   DEBUG
END

Edit. Apparently the error in this case is does not reference a line number. I was not sure if this was omitted for clarity or was some difference in the UniVerse flavor, but I now believe its absence is a hint that the error message is coming from the shell and not that the interpreter.

OPEN '','VOC' TO FILE.VOC ELSE STOP "CANNOT OPEN FILE VOC"
STMT = "SELECT VAL WITH ":STR("A",256):" EQ 0"
EXECUTE STMT RTNLIST USE.LIST RETURNING DEBUGS
CRT "**************************************"
READ TEST FROM FILE.VOC,STR("A",256) ELSE NULL
END

Which on my system outputs this.

>RUN TEST.SC TEST.LONG.ID
Attempted READ of record ID larger than file/table maximum
record ID size of 255 characters.
RetrieVe: syntax error.  Unexpected sentence without filename.  Token was "".
          Scanned command was SELECT 'VAL' WITH 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' EQ '0'
**************************************
Program "TEST.LONG.ID": Line 5, Attempted READ of record ID larger than file/t
able maximum
record ID size of 255 characters.
>

The first looks like your error message and would point to one of the dynamic SELECT statements you are building. @ID is synonymous with with record key and to carry the analogy a little further, it appears that you are trying to unlock your bike with one of those comically large "Keys to the City".

Van Amburg
  • 1,207
  • 9
  • 15
  • I thought that the @ID field and the record key were synonymous concepts. Also, I am not getting a line number in the error output. – Charles Jun 21 '21 at 12:55
  • Thank you for the time you're taking to help with this. To keep with the analogy though, it is not that I am trying to unlock my bike with a key to the city, but rather that I am trying to jam my entire keychain into the lock at once. – Charles Jun 21 '21 at 14:46