• Basic-Plus Random Access File Recordsize

    From Nootrac90@21:1/5 to All on Wed May 30 16:44:20 2018
    I'm working on a Basic-Plus program under RSTS/E v07 that uses random access files. One of the files uses a record size of 32 and yet a ten record file takes up 10 blocks.

    Am I wrong in thinking that these 10 records (and a few more) should fit into one block?

    10 EXTEND
    1000 OPEN "TSTFIL.DTA" AS FILE 2%, RECORDSIZE 32%
    1010 FIELD #2%, 32% AS RD$
    1020 LSET RD$ = "[123456789012345678901234567890]"
    1030 FOR RN% = 1% TO 10%
    1040 PUT #2%, RECORD RN%
    1050 NEXT RN%
    1060 CLOSE #2%
    32767 END

    It has been nearly 40 years since I worked with these files and I feel like I've forgotten something. Any help would be greatly appreaciated.

    Thanks,
    Dana

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Johnny Billquist@21:1/5 to All on Thu May 31 17:22:21 2018
    On 31.05.18 01:44, Nootrac90 wrote:
    I'm working on a Basic-Plus program under RSTS/E v07 that uses random access files. One of the files uses a record size of 32 and yet a ten record file takes up 10 blocks.

    Am I wrong in thinking that these 10 records (and a few more) should fit into one block?

    10 EXTEND
    1000 OPEN "TSTFIL.DTA" AS FILE 2%, RECORDSIZE 32%
    1010 FIELD #2%, 32% AS RD$
    1020 LSET RD$ = "[123456789012345678901234567890]"
    1030 FOR RN% = 1% TO 10%
    1040 PUT #2%, RECORD RN%
    1050 NEXT RN%
    1060 CLOSE #2%
    32767 END

    It has been nearly 40 years since I worked with these files and I feel like I've forgotten something. Any help would be greatly appreaciated.

    Not sure if this is any help. I don't have RSTS/E, and don't have
    BASIC+. However, I did try this on RSX with BASIC+2, and for that, the
    one thing missing was the adding of "ORGANIZATION RELATIVE" to the open statement. After that, it worked fine, and produced a file as you would
    have expected.

    But I can't remember if you needed that, or if it is even a valid
    keyword to OPEN in BASIC+...

    Johnny

    --
    Johnny Billquist || "I'm on a bus
    || on a psychedelic trip
    email: bqt@softjar.se || Reading murder books
    pdp is alive! || tryin' to stay hip" - B. Idol

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Nootrac90@21:1/5 to Johnny Billquist on Sat Jun 2 09:58:17 2018
    On Thursday, May 31, 2018 at 11:22:22 AM UTC-4, Johnny Billquist wrote:
    On 31.05.18 01:44, Nootrac90 wrote:
    I'm working on a Basic-Plus program under RSTS/E v07 that uses random access files. One of the files uses a record size of 32 and yet a ten record file takes up 10 blocks.

    Am I wrong in thinking that these 10 records (and a few more) should fit into one block?

    10 EXTEND
    1000 OPEN "TSTFIL.DTA" AS FILE 2%, RECORDSIZE 32%
    1010 FIELD #2%, 32% AS RD$
    1020 LSET RD$ = "[123456789012345678901234567890]"
    1030 FOR RN% = 1% TO 10%
    1040 PUT #2%, RECORD RN%
    1050 NEXT RN%
    1060 CLOSE #2%
    32767 END

    It has been nearly 40 years since I worked with these files and I feel like I've forgotten something. Any help would be greatly appreaciated.

    Not sure if this is any help. I don't have RSTS/E, and don't have
    BASIC+. However, I did try this on RSX with BASIC+2, and for that, the
    one thing missing was the adding of "ORGANIZATION RELATIVE" to the open statement. After that, it worked fine, and produced a file as you would
    have expected.

    But I can't remember if you needed that, or if it is even a valid
    keyword to OPEN in BASIC+...

    I have not seen the ORGANIZATION RELATIVE keywords in any of the Basic-Plus manuals or books I have seen. That being said, I still tried it.

    I added ", ORGANIZATION RELATIVE" to the end of line 1000 and got "?Modifier error at line 1000"

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Johnny Billquist@21:1/5 to All on Sat Jun 2 23:57:01 2018
    On 2018-06-02 18:58, Nootrac90 wrote:
    On Thursday, May 31, 2018 at 11:22:22 AM UTC-4, Johnny Billquist wrote:
    On 31.05.18 01:44, Nootrac90 wrote:
    I'm working on a Basic-Plus program under RSTS/E v07 that uses random access files. One of the files uses a record size of 32 and yet a ten record file takes up 10 blocks.

    Am I wrong in thinking that these 10 records (and a few more) should fit into one block?

    10 EXTEND
    1000 OPEN "TSTFIL.DTA" AS FILE 2%, RECORDSIZE 32%
    1010 FIELD #2%, 32% AS RD$
    1020 LSET RD$ = "[123456789012345678901234567890]"
    1030 FOR RN% = 1% TO 10%
    1040 PUT #2%, RECORD RN%
    1050 NEXT RN%
    1060 CLOSE #2%
    32767 END

    It has been nearly 40 years since I worked with these files and I feel like I've forgotten something. Any help would be greatly appreaciated.

    Not sure if this is any help. I don't have RSTS/E, and don't have
    BASIC+. However, I did try this on RSX with BASIC+2, and for that, the
    one thing missing was the adding of "ORGANIZATION RELATIVE" to the open
    statement. After that, it worked fine, and produced a file as you would
    have expected.

    But I can't remember if you needed that, or if it is even a valid
    keyword to OPEN in BASIC+...

    I have not seen the ORGANIZATION RELATIVE keywords in any of the Basic-Plus manuals or books I have seen. That being said, I still tried it.

    I added ", ORGANIZATION RELATIVE" to the end of line 1000 and got "?Modifier error at line 1000"

    Ok, so not valid in BASIC+ then. Oh well. I guess someone should take a
    look in the BASIC+ manual on PUT as well as OPEN, and see if there are
    any hints on this in there.

    Sorry that I couldn't help.

    Johnny


    --
    Johnny Billquist || "I'm on a bus
    || on a psychedelic trip
    email: bqt@softjar.se || Reading murder books
    pdp is alive! || tryin' to stay hip" - B. Idol

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From John Santos@21:1/5 to All on Thu Jun 14 18:23:45 2018
    In article <pev3ra$eqq$1@Iltempo.Update.UU.SE>,
    bqt@softjar.se says...

    On 2018-06-02 18:58, Nootrac90 wrote:
    On Thursday, May 31, 2018 at 11:22:22 AM UTC-4, Johnny Billquist wrote:
    On 31.05.18 01:44, Nootrac90 wrote:
    I'm working on a Basic-Plus program under RSTS/E v07 that uses random access files. One of the files uses a record size of 32 and yet a ten record file takes up 10 blocks.

    Am I wrong in thinking that these 10 records (and a few more) should fit into one block?

    10 EXTEND
    1000 OPEN "TSTFIL.DTA" AS FILE 2%, RECORDSIZE 32%
    1010 FIELD #2%, 32% AS RD$
    1020 LSET RD$ = "[123456789012345678901234567890]"
    1030 FOR RN% = 1% TO 10%
    1040 PUT #2%, RECORD RN%
    1050 NEXT RN%
    1060 CLOSE #2%
    32767 END

    It has been nearly 40 years since I worked with these files and I feel like I've forgotten something. Any help would be greatly appreaciated.

    Not sure if this is any help. I don't have RSTS/E, and don't have
    BASIC+. However, I did try this on RSX with BASIC+2, and for that, the
    one thing missing was the adding of "ORGANIZATION RELATIVE" to the open
    statement. After that, it worked fine, and produced a file as you would
    have expected.

    But I can't remember if you needed that, or if it is even a valid
    keyword to OPEN in BASIC+...

    I have not seen the ORGANIZATION RELATIVE keywords in any of the Basic-Plus manuals or books I have seen. That being said, I still tried it.

    I added ", ORGANIZATION RELATIVE" to the end of line 1000 and got "?Modifier error at line 1000"

    Ok, so not valid in BASIC+ then. Oh well. I guess someone should take a
    look in the BASIC+ manual on PUT as well as OPEN, and see if there are
    any hints on this in there.

    Sorry that I couldn't help.

    Johnny

    ORGANIZATION RELATIVE (and such like) require RMS and are
    supported only in BASIC-PLUS-2 (BP2), not in BASIC-Plus
    (B+).

    I don't know if the B+ documentation is online anywhere.
    Look for RSTS/E documentation. I have a set but you can't
    have it :-) BP2 (and VMS BASIC) are mostly supersets of
    B+, but that doesn't help much when you are trying to
    avoid BP2 and VMS BASIC extensions.

    The RECORD clause on the B+ put statement is the (512-
    byte) block number, nothing to do with the RECORDSIZE
    clause. RECORDSIZE (IIRC, it's been years) determines the
    buffersize for a file opened using record i/o (as you are
    doing.) It is rounded up to the next multiple of 512,
    which is the RSTS/E (and many other systems of that
    vintage) disk block size. (I think on tapes, the
    RECORDSIZE must be a multiple of 2 and on terminals, it
    can have any value (greater than 72, the width of a
    teletype?). On lineprinters, it is always the lineprinter
    width, usually 132, and other values for other devices.
    (The concept of device-independent I/O was pretty new and
    not always honored...)

    To make records of arbitrary sizes, you need to read and
    write blocks and extract (or map) your data records using
    the FIELD statement. You need to RSET strings to fields
    or copy the fields to working strings, and you need to use
    various CVT functions and CHR$ to convert non-string data
    (integers, floating points, bytes, etc.) to and from
    strings. You need to decide, if your records are not
    divisible into 512, whether you want them to span disk
    blocks and handle that yourself.

    What might work better for this application is using a
    virtual string array. Open the file and then say "DIM #
    <channel number>, <string variable name>(<number>)=
    <length>" (Check the syntax, no guarantees) For your
    example, something like "DIM #2%, RD$(10%)=32%" This will
    make an array of 32-byte strings, addressable as RD$(0%)
    through RD$(20%). B+ will handle reading and writing the
    disk file, unblocking the records, etc. You will still
    need to convert the RD$() elements to what ever form you
    need, using mid(), cvt$%(), cvt$f(), etc. to extract data
    elements, and string concatenation, cvt%$(), etc. to
    construct RD$() elements.

    Virtual arrays can be two-dimensional, and they can be
    arrays of integers, floats, or fixed-length strings. I
    think you can create more than one array in a given file,
    but you need to be careful all programs that use that file
    define it exactly the same way, or chaos ensues. Also,
    the maximum size of a virtual array is only either 32767
    or 65535 (15 or 16 bits, forget which)

    To write record 19 in the virtual array, just:
    RD$(19%) = <some string variable or expression>
    and it will write it to disk when you either close the
    file or reference an array element in a different disk
    block.

    To read record 7, just (after opening the file)
    s$ = rd$(7%)

    Virtual arrays are supported in BP2 and VMS BASIC, but due
    to the limitations and the far greater flexibility of RMS
    and record types in both languages, are very rarely used.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)