Define list

Command groupFlag affectedReversibleExecute on clientPlatform(s)
ListsNOYESNOAll

Syntax

Define list
 
list-of-field-or-file-names  
(F1,F2..F3,F4)

Description

This command defines the variables or file class field names to be used as the column definitions for the current list; it should follow Set current list. The variables or fields used in the definition also describe the data type and length for each column of data held. This command clears the definition and data in the current list. When reversed, the contents and definition of the current list are restored to their former values. Duplicate names are ignored in your list of variables or fields.

Example

Set current list
 
iList1

# define columns iCol1Date, iCol2Num & iCol3Char for the current list

Define list
 
iCol1Date
,
iCol2Num
,
iCol3Char

 
# same as befire but ignores the duplicate reference to iCol3Char

Define list
 
iCol1Date
,
iCol2Num
,
iCol3Char
,
iCol3Char

 
# define the list based upon all the columns in the file class fCustomers

Define list
 
fCustomers

 
# Alternatively, you can avoid using Set Current List by using the following notation

Do
 
iList1
.
$define
(
iCol1Date
,
iCol2Num
,
iCol3Char
)

 
# define the list based upon a table,schema or query class

Do
 
iList1
.
$definefromsqlclass
(
'myTableOrSchemaOrQueryClass'
)

 
# FIXED LENGTH COLUMNS

# Normally, the length of a column is set by the type or length of the variable or field defined for

# the column, therefore the column length for a default character variable would be 10 million.

# However, when you define the list you can truncate the data stored in the column using

# VariableName/N. For example to use only the first 10 characters of the variable iCol3Char in column 3

Define list
 
iCol1Date
,
iCol2Num
,
iCol3Char
/10