DefineCQSchema

$s = DefineCQSchema(NAME=>name, ENTITY_LIST=>entityList,
             RESTRICTIONS=>queryName);
NAME
Used only to provide a unique reference. Change the NAME for the new schema.
ENTITY_LIST
Provides one or more record types. For example, "defect,feature,patch".
RESTRICTIONS
Optional; refers to a query within the schema that defines conditions that new associations must meet. For example, the change request must be in a specific state. If you do not provide any restrictions, any existing change requests can be used.

For example:

$s = &DefineCQSchema(NAME=>"MainSchema",
                         ENTITY_LIST => "defect",
                         RESTRICTIONS => "STANDARD");