Previous Topic: Step 1: Name the TableNext Topic: Step 3: Generating the Table


Step 2: Defining the Columns

The Column Definition Screen

The Column Definition (CDEF) screen is now displayed. Notice that the table name JOB is in the Table Name field.

The cursor is positioned below the Column Name field heading. The first column name to be defined for the JOB table is JOB NUMBER. Type job number in the Column Name response field.

Move the cursor to the Width field. The column width is the number of characters the column will accept. Assign the JOB NUMBER column a width of four by typing 4 in the Width field.

Column Data Type

You can optionally specify the type of entry the column can accept. The entry types can be TEXT, NUMERIC, or CURRENCY. Since TEXT is the default, and the JOB NUMBER column can accept alphanumeric values, you do not need to complete the Type field. Press [Return].

                                            CA   CDEF   CA - Automatic System Facility            ** Column Definition **   DC560306 NO COLUMNS DEFINED FOR TABLE   Table Name: JOB       _ PF1 - Help                         _ PF3 - Extended Selection Definition       _ PF2 - Extended Column Definition   _ PF4 - Extended Key Definition         Page:  1  of  1                                                  Unique  Display   Ext            Column Name             Width   Type    Key     Seq    Screen   job number1                      42  _3

  1. Enter JOB NUMBER to name the column.
  2. Give JOB NUMBER a width of 4.
  3. Position the cursor to define the next column.

Enter the remaining columns, shown below, for the JOB table:

Column name

Width

Type

DEPARTMENT

20

 

TITLE

30

 

SALARY

7

C

CURRENT STATUS (FILLED OR OPEN)

6

 

Define the Columns

To define the columns:

  1. Type department (the first column name listed above) below the JOB NUMBER column you have already entered.
  2. Position the cursor in the Width field.
  3. Type the width shown for the column.
  4. Move the cursor to the next Column Name field position.
  5. Repeat until all the column names and widths have been entered.
  6. For the SALARY column, also tab to the Type field and type c to indicate that the entry type is CURRENCY.

The CURRENCY column type causes ASF to provide two decimal positions for a numeric column, enabling you to enter dollar and cent amounts as column values.

                                            CA   CDEF   CA - Automatic System Facility            ** Column Definition **   DC560306 NO COLUMNS DEFINED FOR TABLE   Table Name: JOB       _ PF1 - Help                         _ PF3 - Extended Selection Definition       _ PF2 - Extended Column Definition   _ PF4 - Extended Key Definition         Page:  1  of  1                                                  Unique  Display   Ext            Column Name             Width   Type    Key     Seq    Screen   job number                       4   department                       20   title                            30   salary                           7     c   current status (filled or open)  6

ASF Updates the Screen

When you have entered all the columns, press [Enter]. ASF rewrites the screen and fills in appropriate default values, as follows:

Your screen should look like the Column Definition screen below.

                                            CA   CDEF   CA - Automatic System Facility            ** Column Definition **   DC560307 COLUMNS UPDATED   Table Name: JOB       _ PF1 - Help                         _ PF3 - Extended Selection Definition       _ PF2 - Extended Column Definition   _ PF4 - Extended Key Definition         Page:  1  of  1                                                  Unique  Display   Ext            Column Name             Width   Type    Key     Seq    Screen   JOB NUMBER                           4 TEXT       _        1      _   DEPARTMENT                          20 TEXT       _        2      _   TITLE                               30 TEXT       _        3      _   SALARY                               7 CURRENCY   _        4      _   CURRENT STATUS (FILLED OR OPEN)      6 TEXT       _        5      _

Modify Column Definitions

Once ASF accepts the column definitions, you can add columns and/or modify columns. For this example, make the following changes to the column definitions you have entered:

                                            CA   CDEF   CA - Automatic System Facility            ** Column Definition **   DC560307 COLUMNS UPDATED   Table Name: JOB       _ PF1 - Help                         _ PF3 - Extended Selection Definition       _ PF2 - Extended Column Definition   _ PF4 - Extended Key Definition         Page:  1  of  1                                                  Unique  Display   Ext            Column Name             Width   Type    Key     Seq    Screen   JOB NUMBER                           4 TEXT       _        1      _   DEPARTMENT                          20 TEXT       _        2      _   TITLE                               30 TEXT       _        3      _   SALARY                               7 CURRENCY   _        4      _   CURRENT STATUS (FILLED OR OPEN)      6 TEXT       _        5      _

  1. Type X to define JOB NUMBER as the unique key.
  2. Renumber the columns' display sequence.

Press [Enter] to record the changes with ASF. When ASF accepts the changes, press [Clear] to return to the Table Definition screen.

The Table Definition Number

Notice on the Table Definition screen (now displayed) that a definition number has been assigned to the table and is displayed in the Defn Number field. The table definition number is a unique number assigned to the table by ASF. The Status field displays the message UNGENERATED. This indicates that you have successfully defined the stored table and must now generate it.