From: arne@vajhoej.dk   
      
   On 9/3/2025 12:20 AM, Lawrence D’Oliveiro wrote:   
   > On Tue, 2 Sep 2025 20:35:54 -0400, Arne Vajhøj wrote:   
   >> If you create a RFM VAR file on VMS with:   
   >>   
   >> A   
   >> BB   
   >> CCC   
   >>   
   >> then it is stored as:   
   >>   
   >> 01 00 41 00   
   >> 02 00 42 42   
   >> 03 00 43 43 43 00   
   >>   
   >> When you do a binary FTP to Linux you end up with just 6 bytes:   
   >>   
   >> 41 42 42 43 43 43   
   >   
   > That’s stupid.   
      
   Maybe not.   
      
   > I would describe that as a bug in the VMS FTP program.   
      
   I think it happens deep down in the C RTL.   
      
   $ type dump.c   
   #include    
      
   int main(int argc, char *argv[])   
   {   
    FILE *fp = fopen(argv[1], argv[2]);   
    int c;   
    while((c = fgetc(fp)) >= 0)   
    {   
    printf("%02X\n", c);   
    }   
    fclose(fp);   
    return 0;   
   }   
   $ cc dump   
   $ link dump   
   $ mcr []dump z.txt r   
   41   
   0A   
   42   
   42   
   0A   
   43   
   43   
   43   
   0A   
   $ mcr []dump z.txt rb   
   41   
   42   
   42   
   43   
   43   
   43   
      
   >> With a binary FTP from VMS of a VAR file you get just the data bytes   
   >> with no structure defining bytes at all.   
   >   
   > And here I thought “binary” meant “transfer all the bytes in the file   
   as   
   > is” ...   
      
   That is the Win/*nix way of thinking.   
      
   VMS could do it. Basically just use something that end   
   up calling SYS$READ instead of something that end up calling   
   SYS$GET.   
      
   But it would not make much sense to do so.   
      
   ORG IDX and ORG REL would end up as a huge pile of useless   
   bytes.   
      
   ORG SEQ & RFM FIX could be problematic too.   
      
   Let us say that you on VMS have a program create a FIX 1   
   file with 3 records of 01, 02 and 03.   
      
   If you did a binary FTP to Linux of that would you   
   expect 3 bytes (01, 02, 03) or 6 bytes (01, 00, 02, 00, 03, 00)?   
      
   ORG SEQ & RFM VAR would be pretty useless in most cases (except   
   when moving OBJ files between VMS and Linux!!).   
      
   But since VAR usually is a text file, then the FIX 1 example   
   may be more relevant.   
      
   Arne   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|