20 pts.
 My CL program is running CPYTOIMPF cmd & causes an SQL error
Message Id: SQ999999
Error occurred in SQL Call Level Interface.
A procedure call encountered an error. The error code is 10.
When I F1 on the line in the job log and then F9 for details, I see this:
From program QSQCLI in QSYS, module SQLSEA, procedure SQLSetEnvAttr at stmt 5793 and To program QCPEXPRT in QSYS, module QCPEXPRT, procedure Copy_The_Records at stmt 81.

Function sequence error? What does this mean?
ASKED: Feb 16, 2009  4:35 PM GMT
UPDATED: February 17, 2009  6:38:16 PM GMT
36,420 pts.

Answer Wiki:
Not sure but we could use some additional info.
Can you run the command CPYTOIMPF on another file?
Are there any unusual column types in the file you're attempting to copy? -- ie: BLOG's
Is there any crupt data in the file you're attempting to copy?
What is the value for the TO STREAM file? Can you use CPYTOIMPF to send another file to this location?
What other parameters have you set in this command?
Thanks Phil

Phil,

I can run these CPYTOIMPF commands on a command line just like like my CL is doing and have no problem:

CPYTOIMPF FROMFILE(&RUNLIB/RPTSFILE *ALL) +
TOSTMF('/REPORTS/RNB/RPTSFILE.TXT') MBROPT(*REPLACE) +
STMFCODPAG(*PCASCII) RCDDLM(*CRLF) +
DTAFMT(*FIXED)

CPYTOIMPF FROMFILE(&RUNLIB/RPTSFRMS *ALL) +
TOSTMF('/REPORTS/RNB/RPTSFRMS.TXT') MBROPT(*REPLACE) +
STMFCODPAG(*PCASCII) RCDDLM(*CRLF) +
DTAFMT(*FIXED)
---------------------------------------
Jasingle

So it fails in your CL in batch but not when you issue the command interactively.
If you call the CL interactively does it fail?
If not, you're looking at authority or library list.
Authorities would include authority to /REPORTS/RNB/
and it might baulk if RPTSFILE.TXT or RPTSFRMS.TXT exist and were placed there with a different user.

Phil
Last Wiki Answer Submitted:  Feb 17, 2009  6:38 PM (GMT)  by  Philpl1jb   36,420 pts.
Latest Answer Wiki Contributors:  Jasingle   20 pts.
To see other answers submitted to the Answer Wiki View Answer History.
Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _