[an error occurred while processing this directive]

HP OpenVMS Systems

ask the wizard
Content starts here

Obtaining CRC for file contents?

» close window

The Question is:

 
is there a DCL command to get the CRC of a
file?  show/... analyze/... do I need a C
program?  What is the easiest way to get
a 16 or 32 bit CRC of a file?
 
 


The Answer is :

 
  The undocumented and unsupported CHECKSUM command can be used to get a
  basic XOR checksum of the file.  Look in the symbol CHECKSUM$CHECKSUM,
  after invoking the command with the target filename as the parameter:
 
    $ CHECKSUM SYS$LOGIN:LOGIN.COM
    $ SHOW SYMBOL CHECKSUM$CHECKSUM
      CHECKSUM$CHECKSUM = "1701820016"
    $
 
  Additionally, you can use the following for OpenVMS image files:
 
    $ CHECKSUM/IMAGE SYS$LOGIN:Y.EXE
    file SYS$SYSDEVICE:[TEST]Y.EXE;4
    image section %D'1' checksum is %X'7AAB7526'
    image section %D'2' checksum is %X'746B25C3'
    image section %D'3' checksum is %X'114B0615'
    image header checksum is %X'00000831'
    checksum of all image sections is %X'1F8B56F0'
    $
 
  The OpenVMS CHECKSUM utility uses a simple XOR scheme.
 
  CHECKSUM/IMAGE can and will ignore those portions of the image header
  that can change, and checksums only the relevent portions of the image
  section(s) present and of the image header.
 
  The OpenVMS Wizard would assume that various other checksum tools are
  available for OpenVMS, potentially based on RTL calls such as LIB$CRC
  or on other available techniques.
 

answer written or last revised on ( 6-JUL-1999 )

» close window