0 pts.
 SQLCOD = -7008 when doing an insert into file using SQLRPGLE-2
Hi, I'm trying to insert selective records from one file into the same file in another library. I have to do this for many file. Am building the query dynamically using SQLRPGLE. Am using a PREPARE statement and an EXECUTE statement to run the query. While the PREPARE statement ends fine, am getting an SQLCOD -7008 while executing the same. The details are as given below. SQLCOD = -7008 SQLSTATE = 55019 The SQL Error message says: FILENAME in LIBRARY not valid for Operation but am not able to get the reason code for the same. The below is the exact command which is being used in EXECUTE statement The same command works fine in STRSQL. Not sure why this is not working in a SQLRPGLE. Can somebody help...please?

Software/Hardware used:
ASKED: July 4, 2006  12:45 PM
UPDATED: December 11, 2009  7:21 AM

Answer Wiki:
here are the possible causes of your error. 1 -- &1 has no members. 2 -- &1 has been saved with storage free. 3 -- &1 not journaled, or no authority to the journal. Files with an RI constraint action of CASCADE, SET NULL, or SET DEFAULT must be journaled to the same journal. 4 and 5 -- &1 is in or being created into production library but the user has debug mode UPDPROD(*NO). 6 -- Schema being created, but user in debug mode with UPDPROD(*NO). 7 -- A based-on table used in creation of a view is not valid. Either the table is program described table or it is in a temporary schema. 8 -- The based-on table resides in an ASP which is different than the ASP of the object being created. 9 -- Index is currently held or is not valid. 10 -- A constraint or trigger is being added to a table that is not valid. The table is in QTEMP, has ASP's that are not the same, or is not an externally described file, or is not write, update, or delete capable. For a constraint, the table is a source file or the parent does not have a member. For a trigger, maximum number of triggers reached. 11 -- Distributed table is being created in schema QTEMP, or a view is being created over more than one distributed table. 12 -- Table could not be created in QTEMP, QSYS, QSYS2, or SYSIBM because it contains a column of type DATALINK having the FILE LINK CONTROL option. 13 -- The table contains a DATALINK column or a LOB column that conflicts with the data dictionary. 14 -- A DATALINK or LOB column cannot be added to a non SQL table. 15 -- Attempted to create or change an object using a commitment definition in a different ASP. 16 -- Sequence &1 in &2 was incorrectly modified with a CL command. Recovery . . . : Do one of the following based on the reason code: 1 -- Add a member to &1 (ADDPFM). 2 -- Restore &1 (RSTOBJ). 3 -- Start journaling on &1 (STRJRNPF), or get access to the journal. 4, 5, or 6 -- Perform a CHGDBG command with UPDPROD(*YES). 7 -- Remove table names which identify files in QTEMP or program described files. 8 -- Use tables in the same ASP. 9 -- Use the EDTRBDAP command to change the sequence of the access path from HELD to 1-99 or *OPN, or rebuild or delete the unique index or constraint. 10 -- Specify tables that are valid for constraints or triggers. 11 -- Specify a schema other than QTEMP, or create the view over only one distributed table. 12 -- Specify a schema other than QTEMP, QSYS, QSYS2, or SYSIBM. 13 -- Specify a schema that does not contain a data dictionary or remove all DATALINK and LOB columns. 14 -- Specify SQL table for adding the DATALINK or LOB column. 15 -- Specify an object in the same ASP as the current commitment definition or end the current commitment definition. 16 -- Specify a different sequence, or delete the data area associated
Last Wiki Answer Submitted:  July 5, 2006  8:26 am  by  RSTEVEC   0 pts.
All Answer Wiki Contributors:  RSTEVEC   0 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

The below is the exact command which is being used in EXECUTE statement

Below that you have:

The same command works fine in STRSQL. Not sure why this is not working in a SQLRPGLE.

Nowhere is the SQL statement shown. How can we comment if you don’t show the statement?

If this is a statement constructed in RPG code, it’s almost guaranteed the it is not the same statement in STRSQL. In RPG, you probably have variables being concatenated into the statement, and you won’t have variables in STRSQL. So, there are differences.

Show the statement so we can comment.

Tom

 108,055 pts.