ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

SQL7008 Error in SQL program

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • SQL7008 Error in SQL program

    I am trying to insert records into a file in my SQLRPGLE program and am getting the following error

    Code:
    Message . . . . :   RFT_R00002 in QTEMP not valid for operation.               
    Cause . . . . . :   The reason code is 3.  Reason codes are:                   
        1 -- RFT_R00002 has no members.                                            
        2 -- RFT_R00002 has been saved with storage free.                          
        3 -- RFT_R00002 not journaled, no authority to the journal, or the journal 
      state is *STANDBY.  Files with an RI constraint action of CASCADE, SET NULL, 
      or SET DEFAULT must be journaled to the same journal.                        
        4 and 5 -- RFT_R00002 is in or being created into production library but   
      the user has debug mode UPDPROD(*NO).
    The file is not journaled and my SQL works fine using interactive SQL so it must be a compile option I am missing. I have compiled it COMMIT(*NONE). I have also specified USROPN in my program

  • #2
    Re: SQL7008 Error in SQL program

    Try putting this as the first sql statement in your program. Or add 'with NC' without the quotes to the end of the INSERT.

    exec sql set option commit=*NONE;

    Comment


    • #3
      Re: SQL7008 Error in SQL program

      Update: I originally had compiled this as a SQL RPGLE module using CRTSQLRPGI and then created a program from the module and was getting the above errror. I then compiled it as a program instead of the module. Now I don't get this error. I would still like to know why I get this error using CRTSQLRPGI OBJTYPE(*MODULE) but not as using CRTSQLRPGI OBJTYPE(*PGM) because I may need to change it back due to programming standards once I find out why

      Comment


      • #4
        Re: SQL7008 Error in SQL program

        I put COMMIT(*NONE) on the compile, wouldn't that be the same

        Comment


        • #5
          Re: SQL7008 Error in SQL program

          Originally posted by Scott M View Post
          Try putting this as the first sql statement in your program. Or add 'with NC' without the quotes to the end of the INSERT.

          exec sql set option commit=*NONE;
          That worked......thx

          Comment


          • #6
            Re: SQL7008 Error in SQL program

            I can't answer the question about *module vs. *pgm. I always put it in the source code so it doesn't matter on the compile options.

            Comment


            • #7
              Re: SQL7008 Error in SQL program

              Compiling as a module or a program would not make any difference. There must be something else that changed, here.

              You memtion "USROPN", which confuses me. SQL does not have that keyword to my knowledge, so you must be using an F-spec? That's odd, because you're asking a question about an SQL error. You don't have it defined BOTH as an F-spec and as SQL, do you? Why on earth would you do that??

              Comment

              Working...
              X