Kbase 12902: SAMPLE CODE for creating and updating data load use workfile
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  10/05/1998 |
|
SAMPLE CODE for creating and updating data load use workfile
Loading data is one of the more common application features.
The Dictionary load programs presume the records being loaded
are new, that is, there are no existing records with the same
key values. Below is a sample procedure illustrating how
you can conditionally load information.
DEFINE file-name AS CHAR.
DEFINE WORKFILE wf LIKE real-table.
UPDATE file-name.
INPUT FROM VALUE(file-name).
REPEAT:
CREATE wf.
IMPORT wf.
FIND real-table WHERE real-table.key-field = wf.key-field
EXCLUSIVE-LOCK NO-ERROR.
IF NOT AVAILABLE real-table THEN
DO:
CREATE real-table.
ASSIGN key-field.
END.
ASSIGN real-table.field1 = wf.field1
.
.
.
real-table.fieldx = wf.fieldx.
/* { can use V6 Dictionary/
Utility/
Include file/
Assignment Include } */
DELETE wf.
END.
Progress Software Technical Support Note # 12902