Article 173114 of comp.os.vms:
In article <33B91E80.4317@smarts.com>, Jerry Leichter wrote:
>Segmented files are normal RMS files with additional FORTRAN control
>information at the front of each record.

  And length information.  We currently have some problems with newer versions
of VAX FTP which strip this info if we try to transfer our unformatted files
by binary ftp.

	Here's a tool I made to convert our files to pure binary -- i.e.
no record information at all.  This was for a DOS PC, but the principle
should probably work on VMS too.

/* PSICVT -- Programme to convert PSI fSR data files transferred as binary
files with ftp into pure binary files.  idr  11-Dec-1991 */
/* Compiled with Turbo C++ V1.0 */

#include        <stdio.h>
#include        <fcntl.h>
#include        <dos.h>

main(argc,argv)
int argc;
char *argv[];
{       char *buff,fn[32];
        unsigned char b[2];
        int f,g,j;
        unsigned n,i;

        if (argc > 1)
           f = _open(argv[1],O_RDONLY);
        else
           { getname(fn,"input");
             f = _open(fn,O_RDONLY);
           }
        if (f<=0)
           { printf("Error opening input file.\n");
             exit(1);
           }

        if (argc > 2)
           g = _creat(argv[2],0);
        else
           { getname(fn,"output");
             g = _creat(fn,0);
           }
        if (g<=0)
           { printf("Error opening output file.\n");
             exit(1);
           }


        j=1;
        while ((i=_read(f,b,2))==2)
              { n=b[0]+256*b[1];
                buff=malloc((size_t)n);
                _read(f,buff,n);        /* no error checking :-( */
                _write(g,buff+2,n-2);   /* strip VAX FORTRAN record-type bytes */
                free(buff);
              }

        _close(f);
        _close(g);
        exit(0);
}

getname(p,q)
char *p,*q;
{       do
           printf("Enter name of %s file: ",q);
        while (gets(p)==NULL);
}

-- 
Ivan Reid, Paul Scherrer Institute, CH.     			reid@psi.ch
	KotPT -- "for stupidity above and beyond the call of duty".
 Support Jayne Hitchcock: http://www.geocities.com/~hitchcockc/story.html#fund




