This structure is used to pass variable column information to sqluexpr - Export, sqluimpr - Import, and sqluload - Load.
Table 25. Fields in the SQLDCOL Structure
Field Name | Data Type | Description |
---|---|---|
DCOLMETH | SMALLINT | A character indicating the method to be used to select columns within the data file. |
DCOLNUM | SMALLINT | The number of columns specified in the array DCOLNAME. |
DCOLNAME | Array | An array of DCOLNUM sqldcoln structures. |
Table 26. Fields in the SQLDCOLN Structure
Field Name | Data Type | Description | ||
---|---|---|---|---|
DCOLNLEN | SMALLINT | Length of the data pointed to by DCOLNPTR. | ||
DCOLNPTR | Pointer | Pointer to a data element determined by DCOLMETH. | ||
|
Table 27. Fields in the SQLLOCTAB Structure
Field Name | Data Type | Description |
---|---|---|
LOCPAIR | Array | An array of sqllocpair structures. |
Table 28. Fields in the SQLLOCPAIR Structure
Field Name | Data Type | Description |
---|---|---|
BEGIN_LOC | SMALLINT | Starting position of the column data in the external file. |
END_LOC | SMALLINT | Ending position of the column data in the external file. |
The valid values for DCOLMETH (defined in sqlutil) are:
The dcolnptr pointer of each element of the dcolname array points to an array of characters, of length dcolnlen bytes, that make up the name of a column to be imported or loaded. The dcolnum field, which must be positive, indicates the number of elements in the dcolname array.
This method is invalid if the external file does not contain column names (DEL or ASC format files, for example).
The dcolnptr pointer of each element of the dcolname array is ignored, while the dcolnlen field contains a column position in the external file. The dcolnum field, which must be positive, indicates the number of elements in the dcolname array.
The lowest valid column position value is 1 (indicating the first column), and the highest valid value depends on the external file type. Positional selection is not valid for import of ASC files.
The dcolnptr field of the first element of the dcolname array points to an sqlloctab structure, which consists of an array of sqllocpair structures. The number of elements in this array is determined by the dcolnum field of the sqldcol structure, which must be positive. Each element in the array is a pair of 2-byte integers that indicate where the column begins and ends. The first element of each location pair is the byte within the file where the column begins, and the second element is the byte where the column ends. The first byte position within a row in the file is considered byte position 1. The columns can overlap.
This method is the only valid method for importing or loading ASC files.
The dcolnum and dcolname fields of the sqldcol structure are both ignored, and the columns from the external file are taken in their natural order.
A column from the external file can be used in the array more than once. It is not necessary to use every column from the external file.
Language Syntax
C Structure
/* File: sqlutil.h */ /* Structure: SQLDCOL */ /* ... */ SQL_STRUCTURE sqldcol { short dcolmeth; short dcolnum; struct sqldcoln dcolname[1]; }; /* ... */ |
/* File: sqlutil.h */ /* Structure: SQLDCOLN */ /* ... */ SQL_STRUCTURE sqldcoln { short dcolnlen; char *dcolnptr; }; /* ... */ |
/* File: sqlutil.h */ /* Structure: SQLLOCTAB */ /* ... */ SQL_STRUCTURE sqlloctab { struct sqllocpair locpair[1]; }; /* ... */ |
/* File: sqlutil.h */ /* Structure: SQLLOCPAIR */ /* ... */ SQL_STRUCTURE sqllocpair { short begin_loc; short end_loc; }; /* ... */ |
COBOL Structure
* File: sqlutil.cbl 01 SQL-DCOLDATA. 05 SQL-DCOLMETH PIC S9(4) COMP-5. 05 SQL-DCOLNUM PIC S9(4) COMP-5. 05 SQLDCOLN OCCURS 0 TO 255 TIMES DEPENDING ON SQL-DCOLNUM. 10 SQL-DCOLNLEN PIC S9(4) COMP-5. 10 FILLER PIC X(2). 10 SQL-DCOLN-PTR USAGE IS POINTER. * |
* File: sqlutil.cbl 01 SQL-LOCTAB. 05 SQL-LOC-PAIR OCCURS 1 TIMES. 10 SQL-BEGIN-LOC PIC S9(4) COMP-5. 10 SQL-END-LOC PIC S9(4) COMP-5. * |