EGL Development User Group

  • 1.  Values of sqlLib.sqlData.sqlcode

    Posted Mon January 24, 2022 06:31 PM
    Dear Export,
    sqlLib.sqlData.sqlcode has values: 0, 1,...
    What is the meaning of the values?
    Please help, thanks you, 

    Eric

    ------------------------------
    Eric Zuo
    ------------------------------


  • 2.  RE: Values of sqlLib.sqlData.sqlcode

    Posted Tue January 25, 2022 04:28 AM
    Hi Eric,

    It's depending which database are connected. which database are you used ?

    Hsieh 


    ------------------------------
    Hsieh YUAN
    ------------------------------



  • 3.  RE: Values of sqlLib.sqlData.sqlcode

    Posted Tue January 25, 2022 12:00 PM
    Hi Hsieh ,
    It is Oracle. 
    Actually my case is more complicated. Our application is developed by third party company, using their unique customized environment/lib without left any document.  In the program, it is called sysvar.sqlData.sqlcode, I guess it probably corresponds to EGL  sqlLib.sqlData.sqlcode, I wonder the value might be customized away either.

    Thanks,

    Eric


    ------------------------------
    Eric Zuo
    ------------------------------



  • 4.  RE: Values of sqlLib.sqlData.sqlcode

    Posted Tue January 25, 2022 12:30 PM
    Eric,

    When you use DB2 data base there are the specific return sqlcode and message to this one.
    And if is another data base then you got a return sqlcode and message to this one.
    Then if you are third party to anyone data base is better to use sqllib.sqlData.sqlstate.

    Anyway you will need to build your own exceptions for each type return code from the vendor database.

    Regards,

    Hsieh

    ------------------------------
    Hsieh YUAN
    ------------------------------



  • 5.  RE: Values of sqlLib.sqlData.sqlcode

    Posted Wed January 26, 2022 01:21 PM

    Hi Hsieh,
    I write out the values with sysVar.sqlData and sqlLib.sqlData:
    sysLib.writeStdout (" sysVar.sqlData.sqlcode :" + sysVar.sqlData.sqlcode  );      --->    100
    sysLib.writeStdout (" sysVar.sqlData.sqlerrmc: " + sysVar.sqlData.sqlerrmc);    --->   No output: 
    sysLib.writeStdout (" sqlLib.sqlData.sqlcode: " + sqlLib.sqlData.sqlcode );        --->   100
    sysLib.writeStdout (" sqlLib.sqlData.sqlerrmc : " + sqlLib.sqlData.sqlerrmc );   --->   No output
    therefore I cannot get meaningful information on it.
    Hope experts could forward instruction.

    Thanks,

    Eric

    ------------------------------
    Eric Zuo
    ------------------------------



  • 6.  RE: Values of sqlLib.sqlData.sqlcode

    Posted Wed January 26, 2022 02:02 PM
      |   view attached
    Hi Eric,

    Great!
    Every database has its SQLCODEs and meanings. Some SQLCODEs and meanings may match, but perhaps others may not. I will attach the DB2 Messages Codes and look for the meaning of the SQLCODE error.  perhaps you cound find in google the sqlcode to another database manager

    ex.
    +100 ROW NOT FOUND FOR FETCH,
    UPDATE OR DELETE, OR THE
    RESULT OF A QUERY IS AN EMPTY
    TABLE
    Explanation: One of the following conditions
    occurred:
    v No row met the search conditions specified in an
    UPDATE or DELETE statement.
    v The result of a SELECT INTO statement was an
    empty table.
    v The result of the subselect of an INSERT statement is
    empty.
    v A FETCH statement was executed when the cursor
    was positioned after the last row of the result table.
    When a SELECT statement is executed using SPUFI,
    this SQLCODE indicates normal completion.
    This SQLCODE is also issued when LOB data cannot
    be returned. This situation can occur when an
    application is running with isolation level UR and
    another application has locked the LOB table space.
    System action: No data was retrieved, updated, or
    deleted.
    SQLSTATE: 02000

    I hope help you.

    regards,
    Hsieh


    ------------------------------
    Hsieh YUAN
    ------------------------------

    Attachment(s)



  • 7.  RE: Values of sqlLib.sqlData.sqlcode

    Posted Thu January 27, 2022 11:01 AM
    Thank you Hsieh,
    It seems I need to be more specified on my question. I need the detail in the error, I cannot find it explained online,  and the debug output in EGL program gives no contents. Our application was bad written , cannot debug on it.
    I will ask another question with Oracle. 

    Thanks you again.
    Eric


    ------------------------------
    Eric Zuo
    ------------------------------



  • 8.  RE: Values of sqlLib.sqlData.sqlcode

    Posted Thu January 27, 2022 04:38 AM

    Hi Eric
    both sysVar.sqlData and sqlLib.sqlData are part of standard EGL, and they both will have the same values during execution.

    The sysVar.sqlData has existed since the start of EGL and its predecessors VAG and CSP, and as I understand it is maintained for backward compatibility reason with the tons of existing code outthere.

    The sqlLib.sqlData was added to EGL language when libraries were invented, and can/should be used in new coding. The sqlLib Library also contains functions for handling sql based databases.

    Please examine the documentation about sysVar.sqlData and sqlLib.sqlData here: https://www.ibm.com/docs/en/rbd/9.6?topic=sqllib-sqllibsqldata-egl-system-variable
    Hope this helps
    Best Regards
    Morten Hansen, IBM Denmark



    ------------------------------
    Morten Hansen
    ------------------------------