[Info-vax] RMS - Wish list

Hein RMS van den Heuvel heinvandenheuvel at gmail.com
Fri Oct 15 11:20:14 EDT 2021


On Friday, October 15, 2021 at 2:19:16 AM UTC-4, tink... at gmail.com wrote:
> As a follow on from my previous post 
> 
> UDF 
> files you can sequentially get/put, but you cannot access using RFA. 

You can certainly $GET by RFA on a UDF file. I just tried.
$UPDATE should be fine also, but $PUT could be trickier.

RMS only locks the RFA (the first byte so to speak) and will NOT do byte-range locking which would be desirable for full shared UDF support.

Hacked up test program to test this below.... 
Posting though Google groups which will likely massacre the code - send Email for clear copy.

Cheers,
 Hein.
/*
** UDF_RFA.C   Hein van den Heuvel, October 2021  - Geen Stijl!
**
** This is a TEST program for RMS RFA access in UDF (User Defined) Record Mode.
** The input file does not have to have the UDF attribute.
** The little known RMS service SYS$MODIFY is used to tell RMS to treat 
** the input file as an UDF file.
** To Check the working use ANALYZE/SYSTEM
** SDA> SET PROC/ID = xxxx
** SDA> SHOW PROC/CHAN   ! Verify the right process/datafile
** SDA> SHOW PROC/LOCK   ! Third lock.  EX, 8 bytes, VBN/BYTE.
*/

#define BUF_SIZE 9999
#define INPUT_NAME "INFILE"
#define DEFAULT_NAME ".DAT"
#define check( txt, status ) stat = status; \
    if (!(stat & 1))                        \
        {                                   \
        printf ("Error %08X on %s", status, txt);  \
        return stat;                        \
        }

#include <rms>
#include <rmedef>
#include <stdio>
#include <ctype>

TEST ()
{
struct FAB      fab;
struct RAB      rab;
int             i, stat, size, done=0, rfa_vbn, rfa_byte;
int             sys$open(), sys$connect(), sys$modify(), sys$get();
char            rec_buff[BUF_SIZE];     /* maximum record size                */

fab = cc$rms_fab;                       /* Make this a real FAB (bid and bln) */
fab.fab$l_dna = (char *) &DEFAULT_NAME; /* Default name: here file type..     */
fab.fab$b_dns = sizeof DEFAULT_NAME;    /* .. and its size                    */
fab.fab$b_shr = FAB$M_SHRUPD;
fab.fab$b_fac = FAB$M_UPD;

rab = cc$rms_rab;                       /* Make this a real RAB (bid and bln) */
rab.rab$l_fab = &fab;                   /* Point to FAB for $CONNECT          */
rab.rab$l_ubf = rec_buff;               /* Point to buffer area..             */
rab.rab$b_rac = RAB$C_RFA;              /* Test RFA access                    */

printf ("Input File Name: ");
scanf  ("%s", rec_buff);
fab.fab$l_fna = (char *) rec_buff;      /* File Name address                  */
fab.fab$b_fns = strlen(rec_buff);       /* .. and its size                    */

check ("OPEN IN ", sys$open ( &fab ))
check ("CONN IN ", sys$connect ( &rab ))

fab.fab$l_ctx = RME$C_SETRFM;
fab.fab$v_esc = 1;
fab.fab$b_rfm = FAB$C_UDF;
check ("MODI IN", sys$modify ( &fab ))

while (! done) {
        printf ("Input RFA and SIZE as VBN,BYTE,SIZE: ");
        if (scanf("%d,%d,%d", &rfa_vbn, &rfa_byte, &size) != 3) {
                done = 1;
        } else {
/*              if (rfa_vbn  > fab.fab$l_alq) continue;    */
/*              if (rfa_byte > 511)           continue;    */
                if (size > BUF_SIZE)          continue;
                rab.rab$l_rfa0 = rfa_vbn;
                rab.rab$w_rfa4 = rfa_byte;
                rab.rab$w_usz  = size;
                check ("GET", sys$get ( &rab ))
                if (size > 40) size = 40;        /* whack */
                for (i=0; i<size; i++){
                        if (!isprint ( rec_buff[i] )) rec_buff[i] = '.';
                }
                rec_buff[size] = 0;              /* whack */
                printf ("Record: <%s>\n", rec_buff);
        }
    }
}




More information about the Info-vax mailing list