Previous Topic: What You Can DoNext Topic: Demonstration (2): Creating a Table from the Database


Demonstration (1): Creating a Table from a Sequential File

Objective

This example creates a table from a sequential file containing customer information. The rows in the table are placed in ascending order based on the customer number (CUST-NUM). Generated data table reports that appear in the Input Parameter and Run Time Message Listing are shown.

Parameters

IN 80 F 4000 PS(TAPE)

IN 80 F 4000 PS(TAPE) defines a sequential input file with fixed length 80- byte records, a block size of 4000 bytes, which is stored on tape.

REC CUST-NUM   1  5
REC CUST-NAME 19 20

REC parameters define the fields of the sequential file.

01OUTPUT TABLE=CUSTOMER- FILE TYPE=CREATE USER=DOC1 PW=DOC1 *CATALOG=ASFDICT ONLINE=YES

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

TABLE=CUSTOMER-FILE names the table. TABLE= must be the first keyword on the OUTPUT parameter.

TYPE=CREATE defines a new table. TYPE= must be the second keyword on the OUTPUT parameter.

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

CATALOG=ASFDICT identifies the catalog (dictionary) containing the table definition.

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

0151*001 CUST-NUM  IX=A 
0151*002 CUST-NAME

*001 and *002, specify the sequence of column placement.

CUST-NUM and CUST-NAME are the column names. The fields named on the type 5 parameters determine the data type and column size.

IX=A indexes the rows in ascending order on customer number.

Complete Code

 col. 2
 ▼
 REC CUST-NAME 19 20
 01OUTPUT TABLE=CUSTOMER-FILE TYPE=CREATE USER=DOC1 PW=DOC1
*CATALOG=ASFDICT ONLINE=YES
 0151*001 CUST-NUM  IX=A
 0151*002 CUST-NAME

Results

mm/dd/yy              INPUT PARAMETER LISTING  volser Vnn.n  PAGE     2 ******** OUTPUT   DATA TABLE ********   01 OUT  TABLE-NAME:      CUSTOMER-FILE           FUNCTION TYPE:   CREATE    DETAILS ONLY           COMMIT:        100           LR-NAME:         CUSTOMER-FILE                    SUBSCHEMA:  RU000276           USER:            QAC                              OWNER:      QAC           CATALOG:         QASFDICT                         SYSCTL:     SYSCTL          LOCATION:           AREA:            IDMSR-AREA2                      COMMENT:           SIZE- PRIMARY:             SECONDARY:             MAXIMUM:           ONLINE: Y        DISPLAY: Y       LOAD: Y         CHANGE: Y         ERASE: Y ******** EDIT     LINE CC COLUMN  VALUE OR FIELD-NAME AND EDIT OPTIONS... ********   01  5     1       *001   CUST-NUM   01  5     1       *002   CUST-NAME  I TABLE SUCCESSFULLY GENERATED: CUSTOMER-FILE   EXTRACT WILL BE PERFORMED   PROFILE OPTION IN EFFECT: RELEASE =  6 mm/dd/yy              RUN TIME MESSAGES        volser Vnn.n  PAGE     1 ***********  END OF FILE  ******************************************************           17 INPUT RECORDS READ       DATA TABLE UPDATE STATISTICS                                                                TABLE            ROWS        REPORT     FUNCTION         LR-NAME                  DEFINITION         STORED        ──────     ────────         ───────                  ──────────         ──────         01        CRE        CUSTOMER-FILE              GENERATED                17