![]() |
|
![]() |
--*
-- DBLoad - Loading and unloading data in various formats.
--
-- type LoadDef
-- is record
-- Relation : string (1..8); -- name of relation
-- Field : string (1..8); -- name of field
-- Repeat : ModSys.S_Natural; -- field repeat number 1..n
-- StartIndex : ModSys.S_Natural; -- field start position (1..n)
-- end record;
--
-- type LoadDef_u_array is array (ModSys.S_Natural range <>) of LoadDef;
--
-- * Note two important things about the LoadDef record.
--
-- 1) The StartIndex field is only used by the SDF Format routine.
-- For all other formats this can be initially set to 0. -- any values in this field.
--
-- 2) There is a special case for the relation and field name.
-- Setting BOTH of these names to the value "NULL" will cause this
-- field to be skipped. This is to be used during the load routines.
-- The reason for this is that sometimes you will not want to load
-- every field that occurs in the input data files. Specifying the
-- special "NULL" value will allow you to skip over this field
-- during the loading process to the next field.
--
-- As an example we will assume that in input file in dBaseIII format
-- contains four fields. Field1 is the SSN, Field2 is the LastName,
-- Field3 is the FirstName and Field4 is the MiddleInitial. In order
-- to load only the name fields you must be able to skip loading the
-- SSN field. To do this you would define the following array of
-- LoadDef information:
--
-- .
-- .
-- .
--
-- Field_List : MyLoad.Loaddef_U_Array(1 .. 4);
-- .
-- .
-- .
--
--
-- begin
-- Field_List(1).Relation := "NULL ";
-- Field_List(1).Field := "NULL ";
-- Field_List(1).Repeat := 1;
-- Field_List(1).StartIndex := 0;
--
-- Field_List(2).Relation := "R1 ";
-- Field_List(2).Field := "LastName";
-- Field_List(2).Repeat := 1;
-- Field_List(2).StartIndex := 0;
--
-- Field_List(3).Relation := "R1 ";
-- Field_List(3).Field := "FirstNam";
-- Field_List(3).Repeat := 1;
-- Field_List(3).StartIndex := 0;
--
-- Field_List(4).Relation := "R1 ";
-- Field_List(4).Field := "MiddleIn";
-- Field_List(4).Repeat := 1;
-- Field_List(4).StartIndex := 0;
--
--*
-- DBFormatProc - Allows check of memory records and halting process.
--
--
-- DBFormatProc allows the user to do any operations necessary on the
-- data in the memory records after they have been loaded with data
-- from the relations during an unload and with data from the
-- file during the load routines. During load routines this procedure
-- should do a WriteRecord. During the unload routines this procedure
-- should do a ReadRecord.
--
-- CALLING SEQUENCE -
--
-- EXIT -
--
-- Continue : BOOLEAN
-- Set to FALSE if no further processing is desired.
-- Set to TRUE if more data is to be read from the file.
type LoadDef is record
Relation : string (1 .. 8) := (others => ASCIIX.nul); -- name of relation
Field : string (1 .. 8) := (others => ASCIIX.nul); -- name of field
FldRepeat : ModSys.S_Natural := 0; -- field repeat number 1..n
startIndex : ModSys.S_Natural := 0; -- field start position (1..n)
end record;
for LoadDef use record
Relation at 0 range 0 .. 63;
Field at 8 range 0 .. 63;
FldRepeat at 16 range 0 .. ModSys.S_Natural_Size - 1;
startIndex at 20 range 0 .. ModSys.S_Natural_Size - 1;
end record;
type LoadDef_U_Array is array (ModSys.S_Natural range <>) of LoadDef;
type Format_Proc_Type is access
procedure (ContinueOn : in out boolean);
pragma Convention
(WIN32,
Format_Proc_Type);
procedure LoadDBaseIIIFormat
(FileName : in string;
FieldTable : in out LoadDef_U_Array;
NumFields : in ModSys.S_Natural;
Format_Proc : in Format_Proc_Type);
--*
-- LoadDBaseIIIFormat - Load from a file in DBase III Format.
--
--
-- LoadDBaseIIIFormat loads the data from a DBaseIII file into the relations
-- and fields that were defined in the FieldTable. The fields will be
-- expected to be in the same order that they were defined.
--
-- CALLING SEQUENCE -
--
-- LoadDBaseIIIFormat (FileName, FieldTable, NumFields, FormatProc'access)
--
-- ENTRY -
--
-- FileName : STRING
-- Name of the DBaseIII file to load from.
--
-- FieldTable : DBLoad.LoadDef_U_Array
-- Array of Relation-Field names to load.
--
-- NumFields : Modsys.S_Natural
-- Number of Relation-Field names in the FieldTable array.
--
-- EXAMPLE -
--
-- See bottom of .ADS file
--
procedure LoadDelimitedFormat
(FileName : in string;
FieldTable : in out LoadDef_U_Array;
NumFields : in ModSys.S_Natural;
FieldDelimiter : in character;
AlphaDelimiter : in character;
HasHeaderRow : in boolean;
Format_Proc : in Format_Proc_Type);
--*
-- LoadDelimitedFormat - Load from a file in Delimited format.
--
--
-- LoadDelimitedFormat loads the data from a Delimited file into the relations and
-- fields that were defined in the FieldTable. The fields will be
-- expected to be in the same order that they were defined.
--
-- CALLING SEQUENCE -
--
-- LoadDelimitedFormat (FileName, FieldTable, NumFields,
-- FieldDelimiter, AlphaDelimiter, FormatProc'access)
--
-- ENTRY -
--
-- FileName : STRING
-- Name of the Delimited file to load from.
--
-- FieldTable : DBLoad.LoadDef_U_Array
-- Array of Relation-Field names to load.
--
-- NumFields : Modsys.S_Natural
-- Number of Relation-Field names in the FieldTable array.
--
-- FieldDelimiter : character
-- The character to use between the field values
--
-- AlphaDelimiter : character
-- The character to use around an alpha field value
--
-- HasHeaderRow : boolean
-- The first line of the data file is a header row of the field names.
--
-- EXAMPLE -
--
-- See bottom of .ADS file
--
procedure LoadDIFFormat
(FileName : in string;
FieldTable : in out LoadDef_U_Array;
NumFields : in ModSys.S_Natural;
Format_Proc : in Format_Proc_Type);
--*
-- LoadDIFFormat - Load from a file in DIF format.
--
--
-- LoadDIFFormat loads the data from a DIF file into the relations and
-- fields that were defined in the FieldTable. The fields will be
-- expected to be in the same order that they were defined.
--
-- CALLING SEQUENCE -
--
-- LoadDIFFormat (FileName, FieldTable, NumFields, FormatProc'access)
--
-- ENTRY -
--
-- FileName : STRING
-- Name of the DIF file to load from.
--
-- FieldTable : DBLoad.LoadDef_U_Array
-- Array of Relation-Field names to load.
--
-- NumFields : Modsys.S_Natural
-- Number of Relation-Field names in the FieldTable array.
--
-- EXAMPLE -
--
-- See bottom of .ADS file
--
procedure LoadSDFFormat
(FileName : in string;
FieldTable : in out LoadDef_U_Array;
NumFields : in ModSys.S_Natural;
Format_Proc : in Format_Proc_Type);
--*
-- LoadSDFFormat - Load from a file in Standard Data Format.
--
--
-- LoadSDFFormat loads the data from a SDF file into the relations and
-- fields that were defined in the FieldTable. The fields will be
-- expected to be in the same order that they were defined.
--
-- CALLING SEQUENCE -
--
-- LoadSDFFormat (FileName, FieldTable, NumFields, FormatProc'access)
--
-- ENTRY -
--
-- FileName : STRING
-- Name of the SDF file to load from.
--
-- FieldTable : DBLoad.LoadDef_U_Array
-- Array of Relation-Field names to load.
--
-- NumFields : Modsys.S_Natural
-- Number of Relation-Field names in the FieldTable array.
--
-- EXAMPLE -
--
-- See bottom of .ADS file
--
procedure LoadSDIFormat
(FileName : in string;
FieldTable : in out LoadDef_U_Array;
NumFields : in ModSys.S_Natural;
Format_Proc : in Format_Proc_Type);
--*
-- LoadSDIFormat - Load from a file which is in SDI format.
--
--
-- LoadSDIFormat loads the data from a SDI file into the relations and
-- fields that were defined in the FieldTable. The fields will be
-- expected to be in the same order that they were defined.
--
-- CALLING SEQUENCE -
--
-- LoadSDIFormat (FileName, FieldTable, NumFields, FormatProc'access)
--
-- ENTRY -
--
-- FileName : STRING
-- Name of the SDI file to load from.
--
-- FieldTable : DBLoad.LoadDef_U_Array
-- Array of Relation-Field names to load.
--
-- NumFields : Modsys.S_Natural
-- Number of Relation-Field names in the FieldTable array.
--
-- EXAMPLE -
--
-- See bottom of .ADS file
--
procedure UnloadDBaseIIIFormat
(FileName : in string;
FieldTable : in out LoadDef_U_Array;
NumFields : in ModSys.S_Natural;
Format_Proc : in Format_Proc_Type);
--*
-- UnloadDBaseIIIFormat - Unload to a file into DBase III Format.
--
--
-- UnloadDBaseIIIFormat unloads the data from the relations into a file
-- in DBaseIII format using the relations and fields that were defined
-- in the FieldTable. The fields will be dumped in the same order that
-- they were defined.
--
-- CALLING SEQUENCE -
--
-- UnloadDBaseIIIFormat (FileName, FieldTable, NumFields, FormatProc'access)
--
-- ENTRY -
--
-- FileName : STRING
-- Name of the DBaseIII file to unload to.
--
-- FieldTable : DBLoad.LoadDef_U_Array
-- Array of Relation-Field names to load.
--
-- NumFields : Modsys.S_Natural
-- Number of Relation-Field names in the FieldTable array.
--
-- EXAMPLE -
--
-- See bottom of .ADS file
--
procedure UnloadDelimitedFormat
(FileName : in string;
FieldTable : in out LoadDef_U_Array;
NumFields : in ModSys.S_Natural;
FieldDelimiter : in character;
AlphaDelimiter : in character;
IncludeHeaderRow : in boolean;
Format_Proc : in Format_Proc_Type);
--*
-- UnLoadDelimitedFormat - UnLoad to a file in Delimited format.
--
--
-- UnLoadDelimitedFormat unloads the data from the database to a file
-- which is in a Delimited format using the relations and fields
-- that were defined in the FieldTable. The fields will be unloaded
-- in the same order as they were defined.
--
-- CALLING SEQUENCE -
--
-- UnLoadDelimitedFormat (FileName, FieldTable, NumFields,
-- FieldDelimiter, AlphaDelimiter, FormatProc'access)
--
-- ENTRY -
--
-- FileName : STRING
-- Name of the DIF file to unload to.
--
-- FieldTable : DBLoad.LoadDef_U_Array
-- Array of Relation-Field names to unload.
--
-- NumFields : Modsys.S_Natural
-- Number of Relation-Field names in the FieldTable array.
--
-- FieldDelimiter : character
-- The character to use between the field values
--
-- AlphaDelimiter : character
-- The character to use around an alpha field value
--
-- IncludeHeaderRow : boolean
-- The first line of the data file will be a header row of the field names.
--
-- EXAMPLE -
--
-- See bottom of .ADS file
--
procedure UnloadDIFFormat
(FileName : in string;
Title : in string;
FieldTable : in out LoadDef_U_Array;
NumFields : in ModSys.S_Natural;
Format_Proc : in Format_Proc_Type);
--*
-- UnLoadDIFFormat - UnLoad to a file in DIF format.
--
--
-- UnLoadDIFFormat unloads the data from the database to a file
-- which is in a DIF format using the relations and fields
-- that were defined in the FieldTable. The fields will be unloaded
-- in the same order as they were defined.
--
-- CALLING SEQUENCE -
--
-- UnLoadDIFFormat (FileName, Title, FieldTable, NumFields, FormatProc'access)
--
-- ENTRY -
--
-- FileName : STRING
-- Name of the DIF file to unload to.
--
-- Title : String
-- The title to be put in the DIF file.
--
-- FieldTable : DBLoad.LoadDef_U_Array
-- Array of Relation-Field names to unload.
--
-- NumFields : Modsys.S_Natural
-- Number of Relation-Field names in the FieldTable array.
--
-- EXAMPLE -
--
-- See bottom of .ADS file
--
procedure UnloadSDFFormat
(FileName : in string;
FieldTable : in out LoadDef_U_Array;
NumFields : in ModSys.S_Natural;
Format_Proc : in Format_Proc_Type);
--*
-- UnLoadSDFFormat - UnLoad to a file in SDF format.
--
--
-- UnLoadSDFFormat unloads the data from the database to a file
-- which is in a SDF format using the relations and fields
-- that were defined in the FieldTable. The fields will be unloaded
-- in the same order as they were defined.
--
-- CALLING SEQUENCE -
--
-- UnLoadSDFFormat (FileName, FieldTable, NumFields, FormatProc'access)
--
-- ENTRY -
--
-- FileName : STRING
-- Name of the DIF file to unload to.
--
-- FieldTable : DBLoad.LoadDef_U_Array
-- Array of Relation-Field names to unload.
--
-- NumFields : Modsys.S_Natural
-- Number of Relation-Field names in the FieldTable array.
--
-- EXAMPLE -
--
-- See bottom of .ADS file
--
procedure UnloadSDIFormat
(FileName : in string;
FieldTable : in out LoadDef_U_Array;
NumFields : in ModSys.S_Natural;
Format_Proc : in Format_Proc_Type);
--*
-- UnLoadSDIFormat - UnLoad to a file in SDI format.
--
--
-- UnLoadSDIFormat unloads the data from the database to a file
-- which is in a SDI format using the relations and fields
-- that were defined in the FieldTable. The fields will be unloaded
-- in the same order as they were defined.
--
-- CALLING SEQUENCE -
--
-- UnLoadSDIFormat (FileName, FieldTable, NumFields, FormatProc'access)
--
-- ENTRY -
--
-- FileName : STRING
-- Name of the SDI file to unload to.
--
-- FieldTable : DBLoad.LoadDef_U_Array
-- Array of Relation-Field names to unload.
--
-- NumFields : Modsys.S_Natural
-- Number of Relation-Field names in the FieldTable array.
--
-- EXAMPLE -
--
-- See bottom of .ADS file
--
--
procedure UnloadDumpFormat
(DataDumpFile : in string;
BlockDumpFile : in string;
Path : in string;
Relation : in string;
KeyField : in string);
--*
-- UnloadDumpFormat - Dump data to two files in an internal ASCII format.
--
--
-- This procedure dumps the data to ascii files. The block data fields
-- are dumped to a seperate file.
--
-- CALLING SEQUENCE -
--
-- UnloadDumpFormat (DataDumpFile, BlockDumpFile, Path,
-- Relation, KeyField);
--
-- ENTRY -
--
-- DataDumpFile : string
-- Name of the file to get the relation field data.
--
-- BlockDumpFile : string
-- Name of the file to get the block data.
--
-- Path : string
-- Path to the files being dumped.
--
-- Relation : string
-- Name of the relation to read through.
--
-- KeyField : string
-- Name of the key field to use when dumping.
--
procedure LoadDumpFormat
(DataDumpFile : in string;
BlockDumpFile : in string;
Path : in string;
Relation : in string;
KeyField : in string);
--*
-- LoadDumpFormat - Load data from two files in an internal ASCII format.
--
--
-- This procedure loads the data from ascii files. The block data fields
-- were dumped to a seperate file.
--
-- CALLING SEQUENCE -
--
-- LoadDumpFormat (DataDumpFile, BlockDumpFile, Path,
-- Relation, KeyField);
--
-- ENTRY -
--
-- DataDumpFile : string
-- Name of the file containing the relation field data.
--
-- BlockDumpFile : string
-- Name of the file containing the block data.
--
-- Path : string
-- Path to the files being loaded.
--
-- Relation : string
-- Name of the relation to add data to.
--
-- KeyField : string
-- Name of the key field to use loading.
--
Send mail to
warren.merrill@inl.gov
with questions or comments about this web site.
Copyright © 1989-2006 Battelle Energy Alliance