7.93 OPEN

Note: Usage options

The OPEN command is used to open (or control the opening of) the database file(s) specified by the FILE parameter. Individual files or all files can be opened or controlled.

There are two forms of the OPEN command.

The first is the executable form. It is called executable because the file is opened at the time the OPEN command is executed. This form supports access to the IBM i operating system command OPNQRYF (Open Query File).

The second is the declarative form. It is called declarative because the OPEN command does not actually execute. The presence of the command in the RDML program declares how and when the file is to be automatically opened by LANSA.

These 2 forms of the command are described in more detail later.

There is normally no need to code OPEN or CLOSE commands into RDML programs. LANSA will automatically open and close files as required. OPEN and CLOSE commands are only used to specifically open or close a file, or to modify how and when LANSA automatically opens and closes them.

Portability Considerations

FILE (library) is not supported in Visual LANSA. A build warning will be generated if used in Visual LANSA code. Refer to parameters: ALWCPYDTA, OPTIMIZE, SEQONLY, COMMIT and TYPE , ALWCPYDTA, OPTIMIZE, SEQONLY, COMMIT and TYPE , FILE , KEYFLD, ALWCPYDTA, OPTIMIZE, SEQONLY, COMMIT and TYPE , QRYSLT, ALWCPYDTA, OPTIMIZE, SEQONLY, COMMIT and TYPE , ALWCPYDTA, OPTIMIZE, SEQONLY, COMMIT and TYPE and USE_OPTION .

 

Also See

7.93.1 OPEN Parameters

7.93.2 OPEN Comments / Warnings

7.93.3 OPEN Examples

                                                         Optional

 

  OPEN --------- FILE---------- *ALL. *FIRST ------------------->

                                file name.library name

 

             >-- USE_OPTION --- *FIRSTSCREEN ------------------->

                                *IMMEDIATE

                                *ONDEMAND

                                *OPNQRYF

                                *KEEPOPEN

 

             >-- IO_STATUS ---- *STATUS ------------------------>

                                field name

 

             >-- IO_ERROR ----- *ABORT ------------------------->

                                *NEXT

                                *RETURN

                                label

 

             >-- QRYSLT ------- *ALL --------------------------->

                                'selection criteria'

                                #field name

                                '=EXCHANGE'

 

             >-- KEYFLD ------- *NONE -------------------------->

                                *FILE

                                'key / sort order required'

                                #field name

 

             >-- ALWCPYDTA ---- *YES --------------------------->

                                *NO

 

             >-- OPTIMIZE ----- *ALLIO ------------------------->

                                *FIRSTIO

                                *MINWAIT

 

             >-- SEQONLY ------ *YES --- number of records ----->

                                *NO

 

             >-- COMMIT ------- *NO ---------------------------->

                                *YES

 

             >-- TYPE --------- *NORMAL ------------------------|

                                *PERM