HP OpenVMS Systems

ask the wizard
Content starts here

Largest File Size? (zip)

» close window

The Question is:

 
largest file size that can be zipped under vms.
 


The Answer is :

 
  The largest file size available for OpenVMS applications is
  listed in the OpenVMS FAQ.
 
  The largest file size that most C tools can reference on many
  systems is circa two gigabytes, see topic (6884) for what are
  likely related details.
 
  Related topics include (1023), (5424), (6744), and (6884).
 
  For details on the particular version of zip, please contact the
  maintainer (if available) and/or please check the zip source code.
 
  If this is the off_t limit encountered by stat and lseek and
  similar -- source for zip is available -- there are simple
  workarounds.  Here is an example for OpenVMS Alpha:
 
#include <descrip.h>
#include <lib$routines.h>
#include <rms.h>
#include <starlet.h>
#include <stdio.h>
#include <string.h>
 
struct XABFHC xabfhc;     /* declare file header XAB structure */
struct FAB fab;           /* declare user FAB structure */
 
main()
 {
  int status;
  unsigned __int64 num_bytes;
  char filename[100], outbuf[100];
  unsigned short outsize;
  $DESCRIPTOR ( ctrlstring, "The file size in bytes is !ZQ" );
  $DESCRIPTOR ( outbufdesc, outbuf );
 
  fab = cc$rms_fab;            /* Initialize fab and xab */
  xabfhc = cc$rms_xabfhc;
  printf("Enter filename: ");
  gets(filename);
  fab.fab$l_xab = &xabfhc;     /* point fab to xab */
  fab.fab$l_fna = filename;
  fab.fab$b_fns = strlen(filename);
 
/* Open file, fill fab and xabhfc fields with proper data */
  if ((status = sys$open(&fab)) != RMS$_NORMAL)
   lib$stop(status);
 
/* The xabhfc field xab$l_ebk contains the last virtual block number of the */
/* file. This corresponds to the "dir/size" file size except when the file  */
/* size is zero or when the file size is an exact multiple of 512. In these */
/* cases the w_ffb field will contain zero and the l_ebk field will contain */
/* last_block_vbn + 1. That is the reason for the 'if' statement below.  We */
/* must also typecast one of the operands in the following computation to be*/
/* unsigned __int64 type or we will get integer overflow for files > 4gb.   */
 
  if (xabfhc.xab$w_ffb != 0)
    num_bytes = ((( (unsigned __int64) xabfhc.xab$l_ebk - 1) * 512) +
        (xabfhc.xab$w_ffb));
  else
    num_bytes = (( (unsigned __int64) xabfhc.xab$l_ebk - 1) * 512);
 
  status = sys$fao ( &ctrlstring, &outsize, &outbufdesc,
                        num_bytes );
  if ( status & 1 )
  {
    outbuf[outsize] = 0;
    printf ( outbuf );
  }
  else
    lib$stop  ( status );
 
  if ((status = sys$close(&fab)) != RMS$_NORMAL)
   lib$stop(status);
  }
 
 

answer written or last revised on ( 17-AUG-2001 )

» close window