Direct Open Query Example (Magic xpa 3.x)
If you want to display all records from the CUSTPF table by using the Direct Open Query command, where FLD1 > "A", follow the steps below:
-
Run the overwrite file command for the CUSTPF file by using the UDF function:
CallDLL ('MGEAC32.ISERIES','AAAV','RMTCMD', '10.1.4.201',’OVRDBF FILE (CUSTPF) TOFILE(LIBRARY/CUSTPF) OVRSCOPE(*JOB) SHARE(*YES) OPNSCOPE(*JOB) ‘)
-
Run the Open Query command, which you can enter in the AS/400 Open Query window:
OPNQRYF FILE(LIBRARY/CUSTPF) QRYSLT (‘FLD1>”A”’) OPNSCOPE(*JOB)
-
To display the result, run the Magic xpa task that reads the CUSTPF table.
-
Run the CLOF command by using Magic xpa’s CallDLL function:
CallDLL ('MGEAC32.ISERIES','AAAV','RMTCMD', '10.1.4.201',’CLOF CUSTPF’)
-
Run the Delete Overwrite command by using the CallDLL function:
CallDLL ('MGEAC32.ISERIES','AAAV','RMTCMD', '10.1.4.201',’DLTOVR FILE(*ALL) LVL(*JOB)‘)
Note: 10.1.4.201 is the IBM i system name or IP address.