Post
by hein » Fri Dec 25, 2020 5:45 pm
Ha die Willem. De beste wensen voor het nieuw jaar.
Is this still an active query?
With a user action routine you can get to FAB/RAB and call the low level OpenVMS RMS routines such as $GET directly.
But then you walk away from the language making maintenance much harder and from a lot of (error handling) help from the language RTL. Typically NO low level $PUT is needed, just use the language WRITE function providing the record and RMS will sort it out.
What you want to use is FINDK such as John indicated, but maybe you want better keys on you indexed files.
Judging by the comment, SeqNr is only unique within a date. Correct?
Surely Date+SeqNr is defined to be unique, and the primary key for the file. Is it?
Is PostID unique overall, or also just within the date.
I suggest you recreate the file with an FDL file redefining new alternate key as needed
Just make it be Date+PostID and perhaps also PostID+Date.
Please give more clear desired lookup examples if follow up is desired.
You wrote " until I access the right system," - how is that determined? PostID? SeqNr?
Instead of FINDK with Equal on 8 bytes, and sequentially scanning for the right one, can you not just provide a 12 byte structure and find it directly?
Now how about ORDER within a date? Is that important? Does SeqNr ever get larger than 255?
Exactly HOW is SeqNr added as a segment for the PK?
Is the PK perhaps simply 8+4 = 12 bytes starting at byte 0?
Well, that does NOT sort properly! RMS woudl see the above as a simple string of bytes, but the significance is reversed for the integer bytes!
So the PK key should really be defined with 5 segments as (offset,length) : 0,8 - 11,1 - 10,1 - 9,1 - 8,1
That would be just for the file. No need to let Pascal in on this little secret.
Ditto for PostID
Fwiw - as much a INTEGER is a natural programmers choice for a Sequence Number or similar - you may want to reconsider that and simply make is a 4 or 10 byte (zero filled?) numeric string! So much more practical in the long run.
Groetjes,
Hein