SQLCBLLE not running correctly and does not produce MSGW

85 pts.
Tags:
AS/400
AS/400 DB2
MSGW
SQL statements
I have been facing this problem lately: normally when there is a PGM ILE COBOL running on batch and triggers an exception it makes the batch job stop get go from RUN to MSGW, but when it is a SQLCBLLE and there is a problem executing an SQL statement it simply rolls back and continues execution without passing the job to MSGW. Is there a way to know if an sqlcblle in a batch job has not executed correctly and if there is a possibility to trigger MSGW for the batch job?
0

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Discuss This Question: 5  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • bvining
    When using SQL problems are returned to the application program in the form of SQLCode values, not exceptions. In the case of non-SQL file IO you can have exceptions generated if the program, for instance, runs into an invalid key and you don't have an invalid key phrase specified, you don't have a file status clause specified, etc. I suspect your non-SQL COBOL programs are written in this manner.

    If you want the program to signal an exception (go into MSGW with an inquiry message) you need to check SQLCode and send the inquiry message your self (which is not difficult to do with APIs such as QMHSNDPM, Send Program Message). Generally any negative SQLCode value indicates you have a real problem.

    Bruce Vining
    7,070 pointsBadges:
    report
  • ToddN2000
    If the SQL fails, the data that was to return to the main program will be incomplete or null. You should test you returned data after the SQL before continuing to process the program. You can test for the number of rows returned.
    133,790 pointsBadges:
    report
  • hamzahir
    thanks for you answers. the persisting problem is that i can't edit some SQLCBLLE pgms, is there any way to check for sqlcode using a CL command after the job ended ?
    85 pointsBadges:
    report
  • ToddN2000
    If the job running the SQL creates a new table or does an INSERT into an existing table or i-Series file, you can check that to see if it ran correctly. You mention you would like to check for SQL code after the job ends. What do you hope to accomplish? You say you cannot edit some SQLCBLLE pgms, is this because of authority or another reason?
    133,790 pointsBadges:
    report
  • hamzahir
    Yes, i am not authorised to edit some pgms. You are right the correct way is to handle errors after execution as mentioned in this link :
    http://www-01.ibm.com/support/knowledgecenter/api/content/ssw_ibm_i_61/rzajp/rzajperrtncd.htm
    "Attention: If you do not test for negative SQLCODEs or specify a WHENEVER SQLERROR statement, your program will continue to the next statement. Continuing to run after an error can produce unpredictable results."
    And this is the problem i am facing, i cannot rely on manualy checking for data. Is there anyway as an administrator to check for these SQLERRORS in a log or something ?
    85 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: