[Info-vax] fixing a saveset's attributes: attachment, not ftp

Hein RMS van den Heuvel heinvandenheuvel at gmail.com
Mon Jun 22 12:51:42 EDT 2015


On Monday, June 22, 2015 at 9:03:25 AM UTC-7, David Froble wrote:
> Michael Moroney wrote:
> 
> Ok, we all know I don't get out much.  I also don't delve into the depts 
> of DCL as much as some do.  I'm also aware that the saveset block size 
> is in a word integer in bytes 41-42 of the saveset.
> 
> But, can someone, speaking slowly and using small words so I can 
> understand just what the following is doing?
> 
> > $! try to find the blocksize from within the saveset...
> > $ BlockSize = 0
> > $ BBH_L_BLOCKSIZE = %x28*8
> > $ BlockSize = F$Cvui(BBH_L_BLOCKSIZE, 32, Record)
> 
> Just curious ....
> 
> And yes, I can at least understand initializing BlockSize to zero.

Actually, that's the part I don't understand. :-). 
How does that help anything :-)

BACKUP/REPAIR is of course the solution.

But before that, back in '95, I wrote much the same solution
I did this both in DCL, and in pure, but funky, RMS calls from C. 
Check out that C code as a puzzle / learning?


/* FIX_SAVESET.C, Hein van den Heuvel, Digital, April 1995
** fix RMS file attributes for (FTP transferred :^) BACKUP savesets */
/* #define RME$C_SETRFM 0x00000001 */
#include <rmedef>
#include <stdio>
#include <file>
#include <rms>
#define block_size_offset 10
main(int argc, char *argv[])
{
int buf[512/4], status;
struct FAB fab = cc$rms_fab;
struct RAB rab = cc$rms_rab;

    if (argc < 2) return 16;
    fab.fab$b_fac = FAB$M_GET | FAB$M_PUT | FAB$M_BIO;
    fab.fab$l_fna = argv[1];
    fab.fab$b_fns = strlen(fab.fab$l_fna);
    rab.rab$l_fab = &fab;
    rab.rab$l_ubf = buf;
    rab.rab$w_usz = sizeof buf;
    status = SYS$OPEN(&fab);
    if (status & 1) status = SYS$CONNECT(&rab);
    if (status & 1) status = SYS$READ(&rab);
    if (!(status & 1)) return status;
    printf("Setting blocksize to: %d",buf[block_size_offset]);
    fab.fab$l_fop = FAB$M_ESC;
    fab.fab$l_ctx = RME$C_SETRFM;
    fab.fab$b_org = FAB$C_SEQ;
    fab.fab$b_rfm = FAB$C_FIX;
    fab.fab$w_mrs = buf[block_size_offset];
    status = SYS$MODIFY(&fab);
    if (status & 1) SYS$CLOSE(&fab);
    return status;
}


- - - - FIXSAVESET.COM - - - - - - 

$IF p1.EQS."" THEN INQUIRE p1 "Save set file name ?"
$IF f$search(p1).EQS."" THEN EXIT
$WRITE SYS$OUTPUT " RFM was ", F$FILE(p1,"RFM"), ", MRS = ", -
F$FILE(p1,"MRS"), ", LRL = ", F$FILE(p1,"LRL"), "."
$SET FILE /ATTR=(RFM=FIX, MRS=44, LRL=44) 'p1 ! Easier for DCL
$OPEN/READ file 'p1
$READ file record
$CLOSE file
$mrs = F$CVSI(40*8,32,record)
$WRITE SYS$OUTPUT "Setting blocksize to: ",MRS
$SET FILE /ATTR=(RFM=FIX, MRS='mrs', LRL='mrs') 'p1






More information about the Info-vax mailing list