Plex 2E

  • 1.  How to tell why Insert statement failed in AD

    Posted Jul 22, 2008 05:00 AM
    All,  According to the Plex online help, if the INSERT action diagram statement fails, the View Status = ERROR.  Is there any way to tell the specific's of the error, ie. duplicate key?  I'm on the system i, so I know I could use source to examine the program status DS.   Is there a non-source way or a existing Plex function to do this?  Thanks!Charles


  • 2.  Re: How to tell why Insert statement failed in AD

    Posted Jul 22, 2008 08:45 AM
    Charles,  I'm a little surprised that the online help says that.   You should be able to tell by looking at the Returning status or the Returned status.   In the "InsertRow" function, it sets the Returning status equal to the View status right after the Insert statement.   Both the Returning status and Returned status fields have a value called *Instance exists.   I'm pretty sure I have seen this value occur at runtime in our code.   We haven't run into any situations yet where the values on the fields haven't been sufficient to tell us what the problem is and we have been using Plex on the System i for about 12 years now.  Dean Eshleman,MMA, Inc.  


  • 3.  Re: How to tell why Insert statement failed in AD

    Posted Jul 22, 2008 08:57 AM
    Dean,  I'm not talking about the InsertRow function, I'm talking about the actual INSERT action diagram statement.  InsertRow returns "Instance Exists" only by checking the results of a call to CheckRow.  There are two possible problems:--the record could be added between the call to CheckRow and the execution of the INSERT.--there could be a unique view over some other field.  Thanks!Charles


  • 4.  Re: How to tell why Insert statement failed in AD

    Posted Jul 22, 2008 09:29 AM
    Charles,  Duh, you are right about that.   It has been so long since I looked at those functions I forgot how they worked.   It looks like your only option is to add some source code.   If you look at the generated code, you will see that the field YYFSTS will contain the actual error code.   You could move this value to a Plex field using source code and then you could write additional Plex code you want to handle the situations you are concerned about.   As always, this can be done in your standards layer so you only have to do it once.  In regards to the 2 situations you mention, the problem with another view causing a duplicate key error should show up in testing.   You can see this error in your job log.   At least that has been our experience.   Your second situation regarding the record being added between the CheckRow and the actual Insert has never occurred here that I know of.   Of course our systems aren't that transaction intensive, so that might explain it as well.  Dean Eshleman,MMA, Inc.  


  • 5.  Re: How to tell why Insert statement failed in AD

    Posted Jul 25, 2008 04:32 PM
    It doesn't help RPG world but other language has (will have) API as a solution. ODBC3, JAVAAPI and CSAPI has APIGetStatementDiagnosticsGetConnectionDiagnostics Both API returns information such as native SQL code etc for the last SQL Statement which executed by API calling function or for the DB Connection which used by API calling function. So you get Insert failure reason SQL code by calling GetStatementDiagnostics after Insert. ODBC3 one is available for a long time.Java and C# is from 6.1 as Pattern API.Java runtime is ready at 5.5 SP1 PTF and 6.0 PTFSee detail here.Cplex prob 1191  Kiyoshi  


  • 6.  Re: How to tell why Insert statement failed in AD

    Posted Dec 15, 2017 06:30 AM

    You rigth Dean. YYFSTS contains the error code and we can get descrition in "OBASE\Exception Status" field or in url: https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_61/rzasd/sc092508164.htm