Troubleshooting
Problem
CPYTOIMPF or CPYFROMIMPF fails with Message SQ99999 f/QSQCLI t/QCPEXPRT RC10 when run in the same job as BRMS commands (such as WRKMEDBRM, WRKMEDIBRM, SAVxxxBRM).
Diagnosing The Problem
A CPYTOIMPF or CPYFROMIMPF command was attempted within an interactive or batch job where a BRMS command like WRKMEDBRM was issued prior to the CPYTOIMPF or CPYFROMIMPF command. Message SQ99999 RC10 f/qsqcli t/QCPEXPRT, Error occurred in SQL Call Level Interface, is logged.
Resolving The Problem
In the joblog, you will find message SQ99999 f/qsqcli t/QCPEXPRT logged as follows:
SQ99999 QSQCLI QSYS *STMT QCPEXPRT QSYS *STMT
From module . . . . . . . . : SQLSEA
From procedure . . . . . . : SQLSetEnvAttr
Statement . . . . . . . . . : 12641
To module . . . . . . . . . : QCPEXPRT
To procedure . . . . . . . : Copy_The_Records
Statement . . . . . . . . . : 174
Message . . . . : Error occurred in SQL Call Level Interface
Cause . . . . . : A procedure call encountered an error. The error code is
10. Error codes are: 3 -- Program type out of range. 4 -- SQL data type out
of range. 9 -- Argument value not valid. 10 -- Function sequence error. 12
-- Transaction operation state not valid. 13 -- Memory management problem.
14 -- Maximum number of handles allocated. 15 -- No cursor name available.
16 -- Handle type for operation not valid. 17 -- Connection no longer
available. 21 -- Descriptor or descriptor information not valid. Recovery .
. . : Refer to the DB2 for i5/OS SQL Call Level Interface (ODBC) topic
collection in the Database category in the IBM i Information Center book for
a complete description of the error. Specifically, look at the procedure
that sent the error.
This problem is easily re-created by running a BRMS command prior to the CPYTOIMPF or CPYFROMIMPF command within the same job. The problem can by re-created by using the following steps:
1. WRKMEDBRM
2. CPYTOIMPF FROMFILE(lib/file) TOFILE(lib/file)
MBROPT(*REPLACE) DTAFMT(*FIXED) STRDLM(*NONE)
Note that this issue can be seen when running any application (not just BRMS) that uses CLI, and that application caches the CLI connection prior to running CPYTOIMPF or CPYFROMIMPF.
The processing of the CPYFRMIMPF and CPYTOIMPF commands utilizes CLI to accomplish the import or export of data. As such, both commands rely on a clean CLI environment within the job in which they are invoked. When such an environment does not exist, CLI messages such as SQ99999 will typically be issued. For example, CLI activity that leaves a connection handle within the job prior to the CPYFRMIMPF or CPYTOIMPF will cause the SQ99999. In this specific case, BRMS is leaving a CLI connection handle.
To prevent this issue, one of the following can be done:
1. | The process can be broken into two jobs (in other words, do not run BRMS commands and CPYTOIMPF within the same job). |
OR | |
2. | a. After the BRMS commands complete, issue the following: QSYS/CALL PGM(QBRM/Q1AOLD) PARM('CLSSQLENV ') This call will clean up the CLI connection handle that BRMS used. b. Issue the CPYTOIMPF command within the same job, and it should be successful. |
Was this topic helpful?
Document Information
Modified date:
18 December 2019
UID
nas8N1020294