Hashed Files - 32-bit or 64-bit?

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
ray.wurlod
Participant
Posts: 54595
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Hashed Files - 32-bit or 64-bit?

Post by ray.wurlod »

Here's a shell script I threw together this morning to report (from a UNIX shell) whether a hashed file uses 32-bit or 64-bit internal pointers. It only handles "Type 0" machines (no byte-swapping, therefore no Intel). Maybe when I find more time...
If you want to do this from a Routine or the TCL environment, search the forum for the STATUS statement; it's a much cleaner solution.

Code: Select all

#!/bin/sh

# History
#    Date     Programmer     Version  Details of Modification
# ----------  -------------  -------  ---------------------------------------
# 07/08/2004  Ray Wurlod       1.0    Initial coding
#
 

# Verify that filename passed as argument
if [ $# -ne 1 ]
then
   echo Usage: $0 hashedfilename
   exit 1
fi

# Verify that filename passed as argument is readable
filename=$1
if [ ! -r $filename ]
then
   echo \"${filename}\" is not accessible.
   exit 1
fi

# Determine whether dynamic or static hashed file
if [ -d $filename ]
then
   if [ -r $filename/.Type30 ]
   then
      testfile=$filename/DATA.30
      filetype='Dynamic hashed file '
   else
      echo $filename is a directory, not a hashed file
      exit 1
   fi
else
   testfile=$filename
   filetype='Static hashed file '
fi

# Grab the relevant part of the file header
# Note that this form of od is specifically for Solaris - you may need
# to adjust for other forms of UNIX, mainly the cut columns.
magic=`od -N4 -x $testfile | cut -c14-15`

# This statement is for testing purposes.
# echo $magic

# Now report our conclusions.
if [ $magic -eq '01' ]
then
   echo $filetype \"${filename}\" uses 32-bit pointers.
elif [ $magic -eq '02' ]
then
   echo $filetype \"${filename}\" uses 64-bit pointers.
else
   echo \"${filename}\" is not a hashed file.
   exit -1
fi

exit 0
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply