Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

7.93.1 OPEN Parameters

ALWCPYDTA, OPTIMIZE, SEQONLY, COMMIT and TYPE

ALWCPYDTA, OPTIMIZE, SEQONLY, COMMIT and TYPE

FILE

IO_ERROR

IO_STATUS

KEYFLD

ALWCPYDTA, OPTIMIZE, SEQONLY, COMMIT and TYPE

QRYSLT

ALWCPYDTA, OPTIMIZE, SEQONLY, COMMIT and TYPE

ALWCPYDTA, OPTIMIZE, SEQONLY, COMMIT and TYPE

USE_OPTION


Anchor
FILE
FILE
FILE

Specifies the file(s) to be opened or controlled. Individual files can be specified or the default of *ALL can be nominated. For more information, refer to Specifying File Names in I/O commands.

Note
Note: The combination of parameters FILE(*ALL) and USE_OPTION(*OPNQRYF) is invalid. To open a query file, a specific file must be nominated in the FILE parameter.

Portability Considerations

FILE (library) is not supported in Visual LANSA. A build warning will be generated if used in Visual LANSA code.

Anchor
USE_OPTION
USE_OPTION
USE_OPTION

Specifies the open or control option that LANSA is to use when opening this file. The allowable values for this parameter are:

...

This option is normally used for performance reasons to ensure that a frequently used file is left open at all times.

Portability Considerations

*FIRSTSCREEN ignored with no known effect to the application.

*ONDEMAND ignored with no known effect to the application.

*OPNQRYF is only supported for execution on IBM i. On all other platforms an execution error will occur, but execution of the code can be made conditional.

*KEEPOPEN ignored. Testing of application required. A build warning will be generated when used in Visual LANSA.

Anchor
IO_STATUS
IO_STATUS
IO_STATUS

Specifies the name of a field that is to receive the "return code" that results from the I/O operation.

...

For values refer to I/O Return Codes.

Anchor
IO_ERROR
IO_ERROR
IO_ERROR

Specifies what action is to be taken if an I/O error occurs when the command is executed.

...

If none of the previous values are used you must nominate a valid command label to which control should be passed.

Anchor
QRYSLT
QRYSLT
QRYSLT

Portability Considerations

Not supported in the current release of Visual LANSA unless using LANSA/SuperServer to an IBM i server.

Use of QRYSLT('=EXCHANGE') only supports RDML fields. Note that when fields are put on the exchange list in RDMLX, trailing blanks are stripped from the value put on the exchange list.

...

It may be specified as an alphanumeric literal like this:

   OPEN FILE(STATES) USE_OPTION(*OPNQRYF) QRYSLT('STATE *EQ "NSW"')

or as the name of a field that contains the selection criteria, like this:

   CHANGE FIELD(#SELECTION) TO('STATE *EQ "NSW"')
OPEN FILE(STATES) USE_OPTION(*OPNQRYF) QRYSLT(#SELECTION)

or, making use of the exchange list, like this:

   OPEN FILE(STATES) USE_OPTION(*OPNQRYF) QRYSLT('=EXCHANGE')

The second version indicates that the RDML program can change the selection criteria at execution time. By modifying the content of field #SELECTION the actual data selected by the program can be modified. This is one of the powerful facilities available with the OPNQRYF command. Note that Visual LANSA has similar behavior to this with the SELECT_SQL command, although it is only available with RDMLX objects on IBM i. Following is an example of cross-platform code. Great care must be taken to construct the query in a cross-platform manner, in particular, single quotes must be used around literals and the file must be closed on IBM i:

   EXECUTE SUBROUTINE(QUOTE) WITH_PARMS('NSW' #QUOTED)
USE BUILTIN(BCONCAT) WITH_ARGS('STATE =' #QUOTED) TO_GET(#SELECTION)
IF COND('*CPUTYPE *NE AS400')

...

      SELECT_SQL FIELDS(#STATE) FROM_FILES((#STATES)) WHERE(#SELECTION)

...

         DISPLAY FIELDS(#STATE)

...

      ENDSELECT
ELSE

...

      OPEN FILE(STATES) USE_OPTION(*OPNQRYF) QRYSLT(#SELECTION)

...

      SELECT FIELDS(#STATE) FROM_FILE((#STATES))

...

         DISPLAY FIELDS(#STATE)

   ENDSELECT  

...

      ENDSELECT  
  CLOSE FILE(STATES)
ENDIF
SUBROUTINE NAME(QUOTE) PARMS((#TEXT1 *RECEIVED) (#TEXT2 *RETURNED))
USE BUILTIN(TCONCAT) WITH_ARGS(*QUOTE #TEXT1 *QUOTE) TO_GET(#TEXT2)
ENDROUTINE

The third version allows you to specify up to 256 characters in length per field and as many exchange fields as required to define a query select. '=EXCHANGE' is used in conjunction with the EXCHANGE command. This would be a better option than the second version if the query select is complicated and requires more than 256 characters to define. This third version is only supported when executed locally on an IBM i. If you want to use it from Visual LANSA, an IBM i function MUST be executed via LANSA/SuperServer as shown in this example:

...

Refer to the OPNQRYF command in the appropriate IBM supplied manuals for more details of the QRYSLT parameter and the values, operations and options that it supports.

Anchor
KEYFLD
KEYFLD
KEYFLD

This parameter is only valid when used with the USE_OPTION(*OPNQRYF) parameter. It is ignored in all other cases.

It is used to specify the key fields that should be used by the OPNQRYF command when building an access path to the data in the file. This then allows access to the data in the file in the requested key order. It may be specified as an alphanumeric literal like this:

   OPEN FILE(STATES) USE_OPTION(*OPNQRYF)

...

        KEYFLD('STATE POSTCD')

or as the name of a field that contains the key field names, like this:

   CHANGE FIELD(#ORDER_BY) TO('STATE POSTCD')
OPEN FILE(STATES) USE_OPTION(*OPNQRYF) KEYFLD(#ORDER_BY)

The second version indicates that the key fields (and thus the order of processing data from the file) can be changed by the program at execution time. By modifying the content of field #ORDER_BY the order records are processed from file STATES, can be dynamically modified. This is another of the powerful facilities available with the OPNQRYF command.

...

Refer to the OPNQRYF command in the appropriate IBM supplied manuals for more details of the KEYFLD parameter and the values, operations and options that it supports.

Portability Considerations

Not supported in the current release of Visual LANSA unless using LANSA/SuperServer to an IBM i server.

Anchor
ALWCPYDTA, OPTIMIZE, SEQONLY, COMMIT and TYPE
ALWCPYDTA, OPTIMIZE, SEQONLY, COMMIT and TYPE
ALWCPYDTA, OPTIMIZE, SEQONLY, COMMIT and TYPE

These parameters are only valid when used with the USE_OPTION(*OPNQRYF) parameter. They are ignored in all other cases.

Refer to the OPNQRYF command in the appropriate IBM supplied manuals for more details of these parameters and the values, operations and options that they support.

Portability Considerations

These parameters are not supported in the current release of Visual LANSA unless using LANSA/SuperServer to an IBM i Server.