Page History
Portability | The features described in this section are ONLY supported on IBM i. |
...
Report programs can be made more flexible by using the LANSA OPEN command in conjunction with the USE_OPTION(*OPNQRYF) parameter.
...
Consider the following example: REQUEST FIELDS
REQUEST FIELDS(#REP_TYPE)
CASE OF_FIELD(#REP_TYPE)
...
WHEN VALUE_IS('= A')
...
CHANGE FIELD(#ORDER_BY) TO('PRODNO CUSTNO PARTNO')
...
WHEN VALUE_IS('= B')
...
CHANGE FIELD(#ORDER_BY) TO('CUSTNO PARTNO')
...
WHEN VALUE_IS('= C')
...
CHANGE FIELD(#ORDER_BY) TO('PARTNO DEPTNO CUSTNO')
...
ENDCASE
OPEN FILE(PARTHIST)
...
USE_OPTION(*OPNQRYF)
...
KEYFLD(#ORDER_BY)
...
EXECUTE SUBROUTINE(PRINT)
...
Here the user is asked to nominate what type of report is required (field #REP_TYPE). This value is then used to set up a KEYFLD parameter value in a variable called #ORDER_BY. This value is then passed to the OPNQRYF command via the LANSA OPEN command and the report is produced.
...
The same type of processing can be used to assemble the QRYSLT parameter of the OPEN command to alter the actual data selected by the program from the file for inclusion on the report.
Refer to the LANSA Technical Reference Guide for more details and examples before attempting to use the OPEN command in this way.