Easytrieve Plus SQL files
To process data from an SQL table via Easytrieve SQL file method, you must code the following statements and definitions:
- A file statement specifying one or more table names. If all
columns defined in the file are subject to update, specify the UPDATE
keyword on the FILE statement.
Define one or more fields for the columns within the tables that you want to retrieve. The fields can be defined using the DEFINE statement or the SQL INCLUDE statement. When SQL INCLUDE is used, field definitions are automatically generated from the SQL Catalog. Selective columns can be updated by coding UPDATE on the SQL INCLUDE and omitting the UPDATE on the file statement.
- Code a SELECT statement that defines the result set for the cursor. If the SELECT statement is omitted, a default SELECT is generated automatically for all table columns. The SELECT statement, if coded, must be the first statement following the JOB statement. Coding your own SELECT gives you the choice of customizing the result set for the cursor.
Note: A SELECT statement for an SQL file is similar to
opening the file. SELECT coded for a file that is already open first
closes the file and the re-opens it based on the new SELECT.
Examples
This example shows automatic processing with SELECT:
SQL DCLINCL DCLCTXAB
FILE FILEIN1 SQL
SQL INCLUDE +
(CUST_CO_NBR, +
CUST_ID, +
ACCT_CO_NBR, +
ACCT_PRDCT_CD) +
LOCATION * +
HEADING +
UPDATE +
NULLABLE +
FROM CUST_B_ACCT_TB
JOB INPUT FILEIN1
SELECT FROM FILEIN1 +
WHERE (CUST_ID = 315)
.
Note: SQL DCLINCL is a required Migration Utility statement.
This example shows automatic processing without SELECT:
SQL DCLINCL DCLCTXAB
FILE FILEIN1 SQL
SQL INCLUDE +
(CUST_CO_NBR, +
CUST_ID, +
ACCT_CO_NBR, +
ACCT_PRDCT_CD) +
LOCATION * +
HEADING +
UPDATE +
NULLABLE +
FROM CUST_B_ACCT_TB
JOB INPUT FILEIN1
.
.
Note: SQL DCLINCL is a required Migration Utility statement.