gtpa3m0lApplication Requester User's Guide

Creating the Telephone Directory

You can create the telephone directory by using an SQL CREATE TABLE command. You can do this in DB2 using interactive SQL. On MVS, you access this through the SQL Processor Using File Input (SPUFI) application or from a TPF application. SPUFI is a way to execute SQL commands from a TSO terminal. See the IBM DATABASE 2 Application Programming and SQL Guide for more information about SPUFI. On AIX and OS/2 systems, you access interactive SQL by typing db2 on the command line. You can also prepare data definition language (DDL) files containing SQL statements.

Use the SQL CREATE TABLE command through the DB2 system because:

Figure 13 shows the SQL CREATE TABLE command that creates the PHONE_DIRECTORY table.

Figure 13. SQL CREATE TABLE Command to Create the PHONE_DIRECTORY Table

     CREATE TABLE TPFNET.PHONE_DIRECTORY
        (LAST_NAME        CHAR(17)  NOT NULL,
         FIRST_NAME       CHAR(8)   NOT NULL,
         MIDDLE_INITIAL   CHAR(1),
         COUNTRY_CODE     CHAR(4),
         CITY_CODE        CHAR(5),
         PHONE_NUMBER     CHAR(12),
         EMPLOYEE_NUMBER  SMALLINT  NOT NULL,
         TIME_STAMP       TIMESTAMP NOT NULL);