Progress
Language Reference


CREATE Statement

Interfaces
OS
SpeedScript
All
All
Yes

Creates a record in a file, sets all the fields in the record to their default initial values, and moves a copy of the record to the record buffer.

DATA MOVEMENT

SYNTAX

CREATE record
  [ USING { ROWID ( nrow ) | RECID ( nrec ) } ] [ NO-ERROR ] 

record

The name of the record or record buffer you are creating.

To create a record in a file defined for multiple databases, you might have to qualify the record’s filename with the database name. See the Record Phrase reference entry for more information.

USING { ROWID ( nrow ) | RECID ( nrec ) }

For backward compatibility only.

NO-ERROR

Specifies that any errors that occur in the attempt to create the record are suppressed. After the CREATE statement completes, you can check the ERROR-STATUS system handle for information on any errors that might have occurred.

EXAMPLE

The following example creates a record in the order file for each pass through the loop and then updates the record. It also creates an order-line record.

r-create.p
REPEAT:
    CREATE order.
    UPDATE order.order-num
           order.cust-num VALIDATE(CAN-FIND(customer OF order),
                                   "Customer does not exist")
           cust-num order-date.
    REPEAT:
       CREATE order-line.
       order-line.order-num = order.order-num.
       UPDATE line-num
       order-line.item-num VALIDATE(CAN-FIND(item OF order-line),
                                    "Item does not exist")
       qty
       price.
    END.
END. 

This procedure adds orders and order-lines to the database. Because the user supplies an order number when updating the order record, that order number is assigned (=) to the order-num field of the order-line record when the order-line record is created.

NOTES

SEE ALSO

INSERT Statement, NEW Function


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095