midrange.com code scratchpad
Name:
SQL warnings now reported to applications
Scriptlanguage:
Plain Text
Tabwidth:
4
Date:
10/18/2011 08:03:36 pm
IP:
Logged
Description:
SQL warnings now reported to applications - Test diff between V5R4 & V7R1
Code:
  1.      D cursor1DS       ds                  qualified                          
  2.      D  sum                           6  0                                    
  3.      D  maxFLD2                      10                                       
  4.                                                                               
  5.      D rs              s             52                                       
  6.                                                                               
  7.       /free                                                                   
  8.        exec sql set option datfmt=*iso, commit=*none;                         
  9.                                                                               
  10.        exec sql create table QTEMP/TESTPF (FLD1 dec ( 5, 0), FLD2 char (10 ));
  11.                                                                               
  12.        exec sql insert into QTEMP/TESTPF  values(10, 'HELL10'),               
  13.                                                 (20, 'HELL20'),               
  14.                                                 (NULL, 'ZZZZZZZZZZ'),         
  15.                                                 (30, 'HELL30');               
  16.                                                                               
  17.        exec sql                                                               
  18.           declare cursor1 scroll cursor for                                   
  19.              select sum(fld1),max(fld2) from TESTPF;                          
  20.                                                                               
  21.        exec sql open cursor1;       
  22.                                           
  23.        exec sql  fetch from cursor1 into :cursor1DS;                          
  24.                                                                                 
  25.        rs = 'SQLSTATE=' + SQLSTATE + '; ' + 'SQLCODE=' + %char(SQLCODE) + '; '+ 
  26.             'Result=' + %char(cursor1DS.sum) + ', ' + cursor1DS.maxfld2;        
  27.                                                                                 
  28.        dsply rs;                                                                
  29.                                                                                 
  30.        exec sql close cursor1;                                                  
  31.                                                                                 
  32.        *inlr = *on;                                                             
  33.                                                                                 
  34.       /end-free                                                                 
© 2004-2019 by midrange.com generated in 0.006s valid xhtml & css