Subject: ISEXTRACT - Unload C-ISAM Data Files
From: Jonathan Leffler <[email-masked]>
To: IIUG Software Archive <[email-masked]>
Date: Tue, 30 May 2000 12:27:05 -0700 (PDT)

Hi,

Here's the source code for ISEXTRACT v1.3.

This is a program that unloads the data from a C-ISAM file given a
simple specification of the data fields in the file.

Here is an unload specification for the SE Systables table:

	#File xxx -- see below
	# SysTables
	# tabname|owner|dirpath|tabid|rowsize|ncols|nindexes|nrows|created|version|tabtype|audpath
	# CHAR(18)|CHAR(8)|CHAR(64)|SERIAL|SMALLINT|SMALLINT|SMALLINT|INTEGER|DATE|INTEGER|CHAR(1)|CHAR(64)
	# tabname
	char 0-17
	# owner
	char 18-25
	# dirpath
	char 26-89
	# tabid
	int4 90
	# rowsize
	int2 94
	# ncols
	int2 96
	# nindexes
	int2 98
	# nrows
	int4 100
	# created
	date 104
	# version
	int4 108
	# tabtype
	char 112
	# audpath
	char 113-176

Here is another unload specification used rather extensively in testing ISEXTRACT:

	#File yyy -- see below
	#create table twiddledee
	#(
	#col01 serial not null,
	#col02 float,
	#col03 smallfloat,
	#col04 decimal,
	#col05 decimal(8,4),
	#col06 date,
	#col07 datetime year to fraction(5)
	#);

	#insert into twiddledee values(0, 0,0,0,0,0,current);
	#insert into twiddledee values(0, -23,-23,-23,-23,today,current);
	#insert into twiddledee values(0, null,null,null,null,null,null);

	# Record length is 46
	#				# Name	  Len	From..To
	int4	0		# col01		4	 0 ..  3
	double	4		# col02		8	 4 .. 11
	float	12		# col03		4	12 .. 15
	decimal	16-25	# col04		9	16 .. 25
	decimal	26-30	# col05		5	26 .. 30
	date	31		# col06		4	31 .. 34
	decimal	35-40	# col07		11	35 .. 45

And here's a Korn/Posix/Bash shell script that can run such files as
command line arguments:

	canonicalize()
	{
		sed -e 's/#.*//' -e '/^[ 	]*$/d' -e 's/[ 	][ 	]*/=/' -e 's/^/-t /' $*
	}

	isextract -A mm/dd/yyyy $(canonicalize xxx) -i stores.dbs/systables.dat -l 177
	isextract -A mm/dd/yyyy $(canonicalize yyy) -i stores.dbs/twidd*.dat -l 46

-- 
Yours,
Jonathan Leffler ([email-masked]) #include <disclaimer.h>
Guardian of DBD::Informix v1.00.PC1 -- http://www.perl.com/CPAN
     "I don't suffer from insanity; I enjoy every minute of it!"