Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2013
    Posts
    5

    Unanswered: why can't I get GET DIAGNOSTICS compiled?

    Hi, I am totally lost when I using GET DIAGNOSTICS. I just copied the example from IBM official site:

    http://pic.dhe.ibm.com/infocenter/dz...iagnostics.htm

    and my code is

    Code:
            
    
    	DECLARE EXIT HANDLER FOR SQLEXCEPTION
    	BEGIN
    
    		GET CURRENT DIAGNOSTICS CONDITION 1 msg_text = MESSAGE_TEXT;
    	
    	 END;
    But I got the following error while compiling,

    Code:
    DB21034E  The command was processed as an SQL statement because it was not a
    valid Command Line Processor command.  During SQL processing it returned:
    SQL0104N  An unexpected token "GET CURRENT DIAGNOSTICS CONDITION" was found
    following "EXCEPTION  BEGIN    ".  Expected tokens may include:
    "<psm_statement>".  LINE NUMBER=43.  SQLSTATE=42601
    I checked my db2 version and it should be version 9.7
    db2licm -l
    Product name: "DB2 Enterprise Server Edition"
    License type: "CPU Option"
    Expiry date: "Permanent"
    Product identifier: "db2ese"
    Version information: "9.7"
    Enforcement policy: "Soft Stop"

    Why I can't use GET DIAGNOSTICS this way ?

    ==============================================adde d below

    I changed the code to

    Code:
    	DECLARE EXIT HANDLER FOR SQLEXCEPTION
    	BEGIN
    
    		GET DIAGNOSTICS EXCEPTION 1 msg_text = MESSAGE_TEXT;
    	
    	 END;
    it works, but I want to use the line_number
    Code:
    	DECLARE EXIT HANDLER FOR SQLEXCEPTION
    	BEGIN
    
    		GET DIAGNOSTICS exception 1 RETVAL = DB2_LINE_NUMBER;
    
    	 END;
    and I got following error:

    Code:
    DB21034E  The command was processed as an SQL statement because it was not a
    valid Command Line Processor command.  During SQL processing it returned:
    SQL0104N  An unexpected token "DB2_LINE_NUMBER" was found following "exception
    1 RETVAL =".  Expected tokens may include:  "<psm_diag_condition_item>".  LINE
    NUMBER=42.  SQLSTATE=42601
    I am wondering how can I get line number where the sql error occurred?
    Last edited by loppp; 09-10-13 at 06:29.

  2. #2
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11
    do not mix doc from other platform with your platform
    according the supplied link :
    IBM Information Management Software for z/OS Solutions Information Center
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.be

  3. #3
    Join Date
    Jul 2013
    Posts
    5
    oh, ok, thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •