From: bill@bill.ab.umd.edu (Bill Bame)
Newsgroups: comp.os.vms
Subject: Re: UCX 2.0
Keywords: VMS, UCX
Date: 5 Oct 92 21:22:56 GMT
Reply-To: bill@office.ab.umd.edu
Organization: M.I.E.M.S.S.

>(2) UCX supports ASCII and IMAGE (binary) files only.  VMS backup savesets are 
>    not directly supported and if you wish to ftp these savesets you
>    need to create a FDL file for the save set, transfer it in IMAGE mode and
>    then convert the ftp'd file back to it's original backup saveset format 
>    using the FDL file.  This means that you will also need extra disk space
>    during the conversion process, too.
>

First of all, this isn't a but, but a deficiency in the definition of the FTP
protocol (which was written for U*X after all).  Secondly, there is a much
easier way to "fix" a saveset once it has been transferred in binary mode...

You can get one of the public domain programs (like FILE or MODATT) which
can solve the problem (without making a copy), or you can use this little
piece of code which was specifically written to reblock savesets.

/*
 * Author : William P. Bame (September 1990)
 * Purpose: Change the file attributes of a saveset so that VMS BACKUP can
 *          read it again.  Especially useful when transferring save sets via
 *          some non-DEC protocol (ftp, uucp, kermit, etc.).
 * Notes  : - Tested with VMS 5.1-1 through 5.4-3
 *
 * Installation Instructions:
 * $ cc fix_saveset
 * $ link fix_saveset,sys$input/opt
 * sys$share:vaxcrtl/share^Z
 * $ fix:== $dev:[dir]fix_saveset.exe
 *
 * To use:
 * $ fix $dev:[dir]file.ext
 *
 * Disclaimer:  As usual, use at your own risk.
 */
#include <unixio.h>
#include <file.h>
#include <fab.h>
#include <rmedef.h>

main(argc,argv)
int argc;
char **argv;
{
  int fd,buffer[11],status;
  struct FAB myfab = cc$rms_fab;

  if (argc >= 2) {
    if ((fd = open(*++argv,O_RDONLY,0)) <= 0) {
      perror("open");
      exit();
    }
    else {
      if ((read(fd,buffer,44)) < 0) {
        perror("read");
        exit();
      }
    }
    close(fd);
    printf("size = %d\n",buffer[10]);
    myfab.fab$b_fac = FAB$M_PUT;
    myfab.fab$l_fop = FAB$M_ESC;
    myfab.fab$l_ctx = RME$C_SETRFM;
    myfab.fab$l_fna = *argv;
    myfab.fab$b_fns = strlen(*argv);
    if (((status = SYS$OPEN(&myfab, 0, 0)) & 1) != 1)
        exit((printf("Couldn't open %s\n", *argv), status));
    myfab.fab$b_org = FAB$C_SEQ;
    myfab.fab$b_rfm = FAB$C_FIX;
    myfab.fab$w_mrs = buffer[10] & 0x0000FFFF;
    if (((status = SYS$MODIFY(&myfab, 0, 0)) & 1) != 1)
        exit((printf("Couldn't modify %s\n", *argv), status));
    if (((status = SYS$CLOSE(&myfab, 0 , 0)) & 1) != 1)
        exit((printf("Couldn't close %s\n", *argv), status));
  }
  else {
    printf("usage: fix_saveset <filename>\n");
    exit(1);
  }
}


--
--------------------------------------------------------------------------------
William P. Bame                    | sneakernet: William P. Bame
internet: bill@bill.ab.umd.edu     |             M.I.E.M.S.S.
          bbame@achi1.ab.umd.edu   |             22 South Greene Street
AT&T    : [Work] (410) 328-3062    |             Baltimore, MD 21201
CIS     : 71620,425                |             Room: T1R55
--------------------------------------------------------------------------------