Product Documentation

FairCom ISQL

Previous Topic

Next Topic

Examples

This section gives different types of examples for dbdump, both for variable length records as well as fixed length records. The data files can either be ASCII or binary files. If they are binary files they must be in the fixed length record format.

The following shows the commands file to write records from the DEPT table. The output data file name is deptrecs_out which is an ASCII file in the variable length record format.


DEFINE RECORD dept_rec AS

( no, name, loc ) FIELD DELIMITER ' ' ;


FOR RECORD dept_rec DUMP INTO deptrecs_out

USING SELECT dept_no , dept_name , location

FROM ADMIN.dept ;


The following shows the commands file to write records from the CUSTOMER table. The output data file is cust_out which is a binary file in the fixed length record format.


DEFINE RECORD cust_rec OF FIXED LENGTH 37

AS (

no POSITION (1:4) LONG,

name POSITION (5:15) CHAR,

street POSITION (16:28) CHAR,

city POSITION (29:34) CHAR,

state POSITION (35:36) CHAR

) ;


FOR RECORD cust_rec DUMP INTO cust_out

USING SELECT cust_no, cust_name, cust_city, cust_street, cust_state

FROM ADMIN.customer ;


The following shows the commands file to dump records from the ORDERS table. The output data file is orders_out which is a binary file in the fixed length record format.


DEFINE RECORD orders_rec OF FIXED LENGTH 31

AS (

no POSITION (1:4) LONG,

date POSITION (6:16) CHAR,

prod POSITION (18:25) CHAR,

units POSITION (27:30) LONG

) ;


FOR RECORD orders_rec DUMP INTO orders_out

USING SELECT order_no, order_date, product, quantity

FROM ADMIN.orders ;


TOCIndex