E@DBRECREATE

Name

The E@DBRECREATE call has the following format:

DN@<Logical>(E@DBRECREATE)

where <Logical> identifies the database file to use to perform the E@DBCREATE call.

Description

E@DBRECREATE leaves the record area unchanged so that you can make new records based on the values in an existing record.

Using the API in a Program

See the Programming Example in this section.

Input Values

Field Description
<Logical> You must specify the database file name that you want to create a record in.

Programming Example

The following example shows the E@DBRECREATE call used to add a series of new records that are very similar to each other:

  • Use U@AUDITBEGIN to open the transaction state.

  • A series of EVAL statements sets the D@ fields, and then a call to a Modify API (E@DBLOCKGE) retrieves the first record whose key fields are greater than or equal to the values set in the record retrieval variables (D@ fields).

  • If a record is found, it is deleted then recreated (DVDR@IO(E@DBDELETE), then DVDR@IO(E@DBRECREATE)).

  • The current address flag is set to "Y" for this record and the record is stored with DVDR@IO(E@DBSTORE).

  • The code then checks for records where the current address flag should not be "Y". These are deleted and recreated also, the current address flag is set to spaces, and the record is stored with DVDR@IO(E@DBSTORE).

  • The U@AUDITEND call closes the transaction state and commits the transaction.

     CALLP     U@AUDITBEGIN                     Audit Begin
     EVAL      D@VNDGRP       = F9@VDVNGR               
     EVAL      D@VENDOR       = F9@VDRVND                   
     EVAL      D@LCTNCD       = F9@VDLCCD                   
     EVAL      D@EFFCTV       = E@SYSTEMDYMD               
     CALLP     DN@DBAPVDR4(E@DBLOCKGE)          
     IF        DVDR@NOTFOUND = FALSE              
     CALLP     DVDR@IO(E@DBDELETE)                  DBAPVDR
     CALLP     DVDR@IO(E@DBRECREATE)                DBAPVDR
     EVAL      DVDRCRADDR     = 'Y'         
     CALLP     DVDR@IO(E@DBSTORE)                   DBAPVDR
     IF        PAP10WS@RSTCDD = 'N'                        
     EVAL      E@DBBEGRNG     = 3                          
     CALLP     DN@DBAPVDR2(E@DBLOCKBEGRNG)                 
     IF        DVDR@NOTFOUND = FALSE                       
     CALLP     DVDR@IO(E@DBDELETE)                  DBAPVDR
     CALLP     DVDR@IO(E@DBRECREATE)                DBAPVDR
     EVAL      DVDRCRADDR     = *BLANKS                
     CALLP     DVDR@IO(E@DBSTORE)                   DBAPVDR
     ENDIF                                             
     ENDIF                                          
     ENDIF                                        
     CALLP     U@AUDITEND                         Audit End