Previous Topic: Demonstration (1): Creating a Table from a Sequential FileNext Topic: Demonstration (3): Creating a Table from an Existing Table


Demonstration (2): Creating a Table from the Database

Objective

This example creates a table from the employee database. Column headings different from the database field names are created by moving field names to work fields. The work field names are specified on the type 5 lines.

Parameters

DATABASE DICTNAME=TSTDICT

DICTNAME=TSTDICT defines the dictionary containing the subschema definition.

IN DB SS=EMPSS01

IN DB SS=EMPSS01 specifies database input and identifies the subschema.

PATHAA EMPLOYEE

PATHAA EMPLOYEE defines the database path.

01OUTPUT TABLE=EMPLOYEES TYPE=CREATE USER=DOC1 PW=DOC1 *CATALOG=ASFDICT ONLINE=YES

OUTPUT identifies the OUTPUT parameter, which specifies options to define the output table.

TABLE=EMPLOYEES names the table. TABLE= must be the first keyword on the OUTPUT parameter.

TYPE=CREATE specifies that a new table is to be defined. TYPE= must be the second keyword on the OUTPUT parameter.

USER=DOC1 PW=DOC1 identifies the authorized user and password for signing on to the catalog.

CATALOG=ASFDICT identifies the catalog containing the table definition.

ONLINE=YES creates dialogs and maps to view the table online through ASF.

077010 MOVE EMP-ID-0415 TO ID 077    MOVE EMP-NAME-0415 TO NAME

MOVE places the database fields into work fields having different names. (The work-field names match those listed on type 5 parameters.)

Complete Code

 col. 2
 ▼
 DATABASE DICTNAME=TSTDICT
 IN DB SS=EMPSS01,EMPSCHM,100
 PATHAA EMPLOYEE
 07OUTPUT TABLE=EMPLOYEES TYPE=CREATE USER=DOC1 PW=DOC1
*CATALOG=ASFDICT ONLINE=YES
 070 ID
 070 NAME '                         '
 0751*001 ID
 0751*002 NAME
 077010 MOVE EMP-ID-0415 TO ID
 077    MOVE EMP-NAME-0415 TO NAME