*Copyright 1995 National Computing Centre Limited *and Computer Logic R&D S.A *on behalf of the CTS5 SQL2 Project. *All rights reserved. *The CTS5 SQL2 Project is sponsored by the European Community. * *The National Computing Centre Limited and Computer Logic R&D *have given permission to NIST to distribute this program *over the World Wide Web in order to promote SQL standards. *DISCLAIMER: *This program was reviewed by employees of NIST for *conformance to the SQL standards. *NIST assumes no responsibility for any party's use of *this program.
**************************************************************** * * COMMENT SECTION * * SQL VALIDATION TEST SUITE V6.0 * * XTS725.PCO * WRITTEN BY: Nickos Backalidis * TRANSLATED AUTOMATICALLY FROM EMBEDDED C BY CHRIS SCHANZLE * * Flagging, Full SQL INSENSITIVE cursor * * REFERENCES * 13.1 -- <declare cursor> * 13.2 -- <open statement> * 13.3 -- GR.3.e.i * F#79 -- Insensitive cursors * F#37 -- Intermediate SQL Flagging * * DATE LAST ALTERED 14/12/95 CTS5 Hand-over Test * * Cleanups and fixes by V. Kogakis 04/12/95: * Change in the values of rows inserted in the table * * QA Status: QA check * * Revised by DWF 1/30/96 * Removed status checks after cursor definition * Fixed char string lengths ****************************************************************
EXECSQL BEGIN DECLARE SECTIONEND-EXEC 01SQLCODEPIC S9(9) COMP. 01 SQLSTATEPIC X(5). 01 uid PICX18) 01 uidxPICX(18) CONFIGURATIONSECTION. 01 c_num2 PIC S9(9) DISPLAYSIGNLEADINGSEPARATE. 01 c_ch1 PIC X(10). 01 c_ch2 PIC X(10). EXECSQLEND DECLARE SECTIONEND-EXEC 01 norm1 PIC S9(9) DISPLAYSIGNLEADINGSEPARATE. PIC () DISPLAYLEADINGSEPARATE. 01 ALPNUM-TABLE "01234java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 21 05 ALPNUM PIC X OCCURS36*on behalf of the CTS5 SQL2 Project. *The CTS5 SQL2 Project is sponsored by the European Community. 05 NORMSQX PIC X OCCURS5 TIMES. *The National Computing Centre Limited and Computer Logic R&D *date_time declaration 01 TO-DAY *over the World Wide Web in order to promote SQL standards. 01 THE-TIME PIC9(8). 01 flag PIC S9(9) DISPLAYSIGNLEADING*conformance to the SQL standards.
*Use standard schema table CTS1.CL_STANDARD *declare an insensitive cursor based on columns of  d'>MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY" "
*initialise host variables MOVE"xxxxxxxxxx"TO c_ch1java.lang.StringIndexOutOfBoundsException: Range [31, 29) out of bounds for length 39
xxxxxxx c_ch2 MOVE0TO c_num1 MOVE0TO c_num2
*use a select <statement: single row> and determine *that the row was inserted and is visible
java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 64 DISPLAY PERFORM EXECSQLSELECT COL_NUM1,COL_CH1,COL_NUM2,COL_CH2 INTO*specification ORDER BY DESC the last row will be *returned first MOVESQLCODETO DISPLAY "COL_NUM1 shoul 1005;it ",c_num1,"" PERFORM DISPLAY"COL_NUM1 should be 1005; it COL_NUM2 be 4005;it " ," DISPLAYCOL_CH1should KEVIN itis:", DISPLAY"COL_NUM2 should be 4005; it is : ", java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 62 DISPLAY"COL_CH2 should be XIOS; it is : ", c_ch2 if (c_num1 NOT = 1005NOT = 4005)then
c_num2 NOT = 4005) then MOVE0TO flag
if (c_ch2 NOT = "XIOS") then MOVE0TOif (c_ch2NOT = "XIOS") then END-IF DISPLAY" "
*now start fetching rows from CL_STANDARD DISPLAY" c_num1, :c_ch1, :c_num2,
- " :c_ch2;" EXECSQL FETCH CLCURS INTO END-EXEC MOVESQLCODETO SQL-COD PERFORM *since the cursor is declared insensitive with cursor *specification ORDER BY DESC the last row will be *returned first however if the inserted row is visible *through the cursor then record a NOGO DISPLAY"COL_NUM1 should SQL FETCH INTO :_num1,:,:c_num2,: DISPLAY"COL_CH1 be MORRIS; is , c_ch1,"" DISPLAY"COL_NUM2 should be 4004; it is ", c_num2, " " DISPLAY"COL_CH2 should be PARGA; it is ", c_ch2, " "PERFORM *check if the inserted row is visible through *the cursor proceed if not record a NOGO if it is if (c_num1 NOT = 1004OR c_ch1 NOT=" NOT = 4004then MOVE0TO flagDISPLAY" PARGA; ,c_ch2,"" END-IF
c_ch2 NOT="")then MOVE0TO flag END-IF DISPLAY" "
*fetch second row DISPLAY java.lang.StringIndexOutOfBoundsException: Range [25, 20) out of bounds for length 25
- " :c_ch2;" EXECSQL FETCH CLCURS java.lang.StringIndexOutOfBoundsException: Range [0, 39) out of bounds for length 29 END-EXEC MOVESQLCODETO SQL-COD
HCKOK DISPLAY"COL_NUM1 should be 1003; it is ", java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 21 "should GEORGE;itis "" c_ch1," java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69 "OL_NUM2 should be 4003; it is ", c_num2, " " DISPLAY"COL_CH2 should be ARTA; it is ", c_ch2, " " be4001;it ,,"" if (c_num1 NOT = 1003OR c_ch1 NOT = "GEORGE"OR
c_num2 NOT = 4003) then MOVE0TO END-IF if (c_ch2 NOT = "ARTAc_num2 ) MOVE0TO flag END-IF DISPLAY""
*fetch third row DISPLAYDISPLAY java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
- " :c_ch2;" EXECSQL FETCH CLCURS INTO :c_num1, :c_ch1, :java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 39 END-EXEC MOVESQLCODETO0TO c_num2 PERFORM CHCKOK DISPLAY"OL_NUM1 should 1002 is " c_num1, java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69 DISPLAY"COL_CH1 should be - ":_" DISPLAY"COL_NUM2 should SQL CLCURSINTO:,:_, cnum2,:_h2 DISPLAY"COL_CH2 should java.lang.StringIndexOutOfBoundsException: Range [0, 40) out of bounds for length 36 ifPERFORMCHCKOK
c_num2NOT=4002)then MOVE0TO flag END-IF if (c_ch2 NOT = "HANIA" ) then MOVE0TO flag END-IF DISPLAY" "
*fetch fourth row "ETCH INTO :_um1,:_h1 :_um2,
- " :c_ch2;" EXECSQL FETCH CLCURS INTO :java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47 END-EXEC MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"OL_NUM1should 10011001; it ,bsp; c_num2 NOT = 4001MOVE0 flag MOVE0TO (NOT XIOS END-IF if (c_ch2 NOT = DISPLAY"" MOVE0TO*fetch remaining 5 rows, initialising before the host variables END-IF DISPLAY""
*re-initialise host variables MOVE"xxxxxxxxxx"TO c_ch1 MOVE"xxxxxxxxxx"TO c_ch2 MOVE0TO c_num1 TO
*fetch fifth row DISPLAY"FETCH "c_ch2"
- " :c_ch2;" EXECSQLFETCHCLCURS cnum1 c_ch1,:, END-EXEC MOVE PERFORM DISPLAY"java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 25
,java.lang.StringIndexOutOfBoundsException: Range [65, 63) out of bounds for length 69 ", c_num2 "" DISPLAY"COL_CH2 should be DISPLAY COL_CH2 shouldbePARGA ,c_ch2,"" if(c_num1 NOT = 1000OR c_ch1 NOT= "ICKOS OR
c_num2 NOT = 4000) then MOVE0TOjava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29 END-IF
MOVE END-IF DISPLAY" "
*end fetches *close the cursor and open it again. If the vendor *supports the extension then the inserted row should be *now visible through the cursor
"CLOSE CLCURS;java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
LCURSjava.lang.StringIndexOutOfBoundsException: Range [43, 44) out of bounds for length 43 DISPLAYjava.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 65 PERFORMCHCKOK DISPLAY" "
*open the cursor again DISPLAY"OPEN CLCURS;" SQLCODETO MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY" "
*now fetch and check if the inserted row is visible *initialise host variables MOVE"xxxxxxxxxx"TO c_ch1 MOVE"xxxxxxxxxx"TO c_ch2 MOVE0TO c_num1 MOVE0TO c_num2
DISPLAY"FETCH CLCURS INTO :c_num1, :c_ch1, :c_num2,
- " :c_ch2;" EXECSQL FETCH CLCURS INTO :c_num1, :c_ch1, :c_num2, :c_ch2 END-EXEC MOVESQLCODE PERFORM CHCKOK *since the cursor is declared insensitive with cursor *specification ORDER BY DESC the last row will be *returned first DISPLAY"DISPLAY "COL_NUM2 be 4003;it , c_num2,"" DISPLAY"COL_CH1 should be KEVIN; COL_CH2 be ,c_ch2,"" DISPLAYif c_num1 1003ORc_ch1 NOT="EORGE OR
be XIOS; is" c_ch2, " *check if the inserted row is visible through the cursor *proceed if not record a NOGO if it is
(_num1 NOT =1005ORc_ch1 NOT = "KEVIN"OR
c_num2 NOT = 4005) then MOVE0TO flag
if (c_ch2 NOT = "XIOS") then
END-IF END-IF DISPLAY" "
*fetch remaining 5 rows, initialising before the host variables MOVE"xxxxxxxxxx"TO c_ch1 MOVE"xxxxxxxxxx"TO c_ch2 MOVE0TO0 c_num2
java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 29 DISPLAY"FETCH CLCURS INTO :c_num1, :c_ch1, :c_num2,
EXECSQL FETCH CLCURS INTO :c_num1, :c_ch1, :c_num2, :c_ch2 END-EXEC MOVESQLCODETO SQL-COD PERFORMCHCKOK DISPLAY CHCKOK
COL_NUM2 be;it ,java.lang.StringIndexOutOfBoundsException: Range [65, 64) out of bounds for length 69 DISPLAYCOL_NUM24001is ,java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69 *check if the inserted row is visible through the cursor *proceed if not record a NOGO if it is ifc =1005 ="
c_num2 NOT = 4005) then 0TO END-IF ifc_ch2 ="")then MOVE0TO flag END-IF DISPLAY java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
*fetch remaining 5 rows, initialising before the host variables MOVE"xxxxxxxxxx"TO c_ch1 " *re-initialise host variables MOVE0 java.lang.StringIndexOutOfBoundsException: Range [31, 29) out of bounds for length 39 MOVE0 c_num2 DISPLAY"FETCH *fetch fifth row
-":;" EXECINTO :c_num1, FETCH CLCURS INTO:_,:, c_num2, :c_ch2 END-EXEC MOVESQLCODETOPERFORMCHCKOK PERFORM1003; is" ,""
AY"COL_NUM1 should be 1004; it is ", c_num1, " " DISPLAY"COL_CH1 DISPLAY "COL_CH1 shouldbeNICKOS; t is", c_ch1, " " DISPLAY" " if (c_num1 NOT bsp; " PARGA;it is" c_ch2&nban style='color:red'>NOT = "GEORGE"OR
MOVE0TO flag
if (c_ch2 NOT = "ARTA" MOVE0TO flag END-IF"xxxxxxxxx"TOjava.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39 END-IF DISPLAY" "
DISPLAY"FETCH CLCURS INTO :c_num1, :c_ch1, :c_num2,
SQL-COD EXECSQL FETCH CLCURS INTO :c_num1, :c_ch1, :c_num2, :c_ch2 END-EXEC MOVESQLCODETOSQL-COD PERFORM CHCKOK "OL_CH1 ; is ,,"" DISPLAYCOL_CH1shouldbeMAKIS itis" , "" DISPLAY"COL_NUM2 should be 4002; it is ", c_num2, " " DISPLAY"COL_CH2 should be HANIA; it is ", c_ch2, " " ifcnum1NOTORc_ch1 NOT = "AKIS"OR
c_num2 NOT = c_num1 NOTORNOT = NICKOS MOVE0TO flag
= "HANIA" 0 flag END-IF DISPLAY" "
*2 remaining MOVE he cursor MOVE"xxxxxxxxxx"TO c_ch2 MOVE0TO c_num1 MOVE0TO c_num2 DISPLAY"FETCH CLCURS INTO :c_num1 "
- " :c_ch2;" EXECSQL FETCH CLCURS INTO :c_num1, java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
MOVE EXEC SQL ROLLBACK END-EXEC PERFORM CHCKOK MOVETO DISPLAY"COL_CH1 should be MARIA; it is "DISPLAY""
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
RHODES is,,"" if (c_num1 NOTEXECINSERTINTOCTS1TESTREPORT
c_num2 NOT = 4001 MOVE0TO flag END-IF if" MOVE0TO flag
- "WARNING" DISPLAY" "
*1 remaining MOVE"xxxxxxxxxx"TO c_ch1 MOVE x" c_ch2
&nsp; if (c_num1 NOT = 1002OR c_ch1 NOT = "MAKIS"OR
&n " :c_ch2;" EXECSQL FETCH CLCURS INTO :c_num1, :c_ch1, :c_num2, :c_ch2 MOVE0TO flag
 lor:red'>PERFORM CHCKOK DISPLAY"COL_ue'>"HANIA") &nbnbsp;", c_num1, " "
&nMOVE0TO flag
DISPLAY" "
*2 remaining MOVE"xxxxxxxxxx"TO c_ch1 MOVE"xxxxxxxxxx"TO c_ch2 MOVE0TOMOVE"xxxxxxxxxx"TO c_ch1 MOVE0TO c_num2 DISPLAY"FETCH CLCURS :c_num1, :,:,
- " :c_ch2;" SQLFETCHCLCURSINTO:, :_ch1 :,: END-EXEC
SQL-COD PERFORM CHCKOK green'>0 TO flag END-IF
&nbp; it is ", c_num1, " DISPLAY"FETCH CLCURSINTO:c_num1, :c_ch1, :c_num2, DISPLAY"COL_CH1 should be MARIA; itis,c_ch1, java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69 DISPLAY"COL_NUM2 should be 4001; it is ", c_num2, " " DISPLAY"COL_CH2 should be RHODES; it is ", c_ch2 PERFORM CHCKOK if"COL_NUM1 be 1003 it " c_num1, java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
c_num2 NOT = 4001) then DISPLAYjava.lang.StringIndexOutOfBoundsException: Range [38, 37) out of bounds for length 69 END-IF if (c_ch2 NOT = "RHODES") if (c_ch2 NOT = "RHODES") then MOVE0TO END-IF DISPLAY" "
*1 remaining MOVE" c_ch1 MOVE"xxxxxxxxxx"TO c_ch2 MOVE c_num1 MOVE0TO c_num2 DISPLAY"FETCH CLCURS MOVE""TO
- " :c_ch2;" EXECSQL FETCH CLCURS INTO :c_num1, : EXEC SQL FETCH CLCURS INTO :c_num1, :c_ch1 END-EXEC MOVESQLCODETOjava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36 PERFORM CHCKOK DISPLAY"COL_NUM1 should be 1000; it is "SQLCODE DISPLAY C shouldbeNICKOSit", c_ch1 " DISPLAY"COL_NUM2 " be ; ,c_ch1 java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69 DISPLAY"COL_CH2 should be ATHENS it is (_ =1002OR NOT = " if(NOT=1000ORc_ch1 ""OR
c_num2 NOT = 4000) then MOVE0TO flag END-IF if (c_ch2 if (c_ch2 NOT)then MOVE0TOflag END-IF DISPLAY" "
if ( flag = 1 ) thenp; MOp; DISPLAY" SPLAY "COL_CH2should be; it "Vendor does not support fully " DISPLAY"Intermediate SQL extension " DISPLAY"Support for Insensitive cursors is not required" END-IF
&nspan style='color:red'>SQLCODETO SQL-COD
java.lang.StringIndexOutOfBoundsException: Range [0, 22) out of bounds for length 19
- " successfully DISPLAY0
- "
&ntyle='color:red'>COMMIT WORK DISPLAY" xts725.pcojava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 EXECSQLINSERT"xxxxxxxxx"TOc_ch2
VALUES('7025','NOGO','PCO' 0 MOVETOjava.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38 DISPLAY"Vendor does not support EXEC SQL FETCH CLCURS INTO :c_num1, :c_ch1 c_ch2 DISPLAY"Intermediate SQL extension " DISPLAY" PERFORM
DISPLAY======================="
*BAK : Check again in order to insert a third option for fail *DWF: ???
EXECSQLCOMMIT WORK END-EXEC MOVETOSQL-COD
******************** END TEST7025 ********************
**** TESTER MAY CHOOSE TO INSERT CODE FOR errcnt > 0 STOPRUN.
* **** Procedures for PERFORM statements
*Test SQLCODE and SQLSTATE for normal completion.
CHCKOK. DISPLAY"SQLCODE should be 0; java.lang.StringIndexOutOfBoundsException: Range [0, 46) out of bounds for length 25 DISPLAY"SQLSTATE should be 00000 ose the cursor PERFORM NOSUBCLASS THRU EXIT-NOSUBCLASS if (SQLCODENOT = 0OR java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 36 MOVE0TO flag END-IF if (NORMSQ = "00000"AND NORMSQ NOT = SQLSTATE) then DISPLAY"Valid implementation-defined SQLSTATE accepted." END-IF
.
NOSUBCLASS.
*This routine replaces valid implementation-defined *subclasses with 000. This replacement equates valid *implementation-defined subclasses with the 000 value *expected by the test case; otherwise the test will fail. *After calling NOSUBCLASS, NORMSQ will be tested * SQLSTATE will be printed.
MOVE SQLSTATE TO NORMSQ
MOVE3TO norm1 *subclass begins in position 3 of char array NORMSQ *valid subclass begins with 5-9, I-Z, end of ALPNUM table
norm2 FROMBY1UNTIL >36 if (NORMSQX(norm1) = ALPNUM(norm2)) java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 21 MOVE"0"TO NORMSQX(norm1) END-IF
*Quit if NORMSQ is unchanged. Subclass is not impl.-def. *Changed NORMSQ means implementation-defined subclass, *so proceed to zero it out, if valid (0-9,A-Z) if(NORMSQ = SQLSTATE) then GOTO EXIT-NOSUBCLASS END-IF
MOVE4TO norm1 *examining position 4 of char array NORMSQ *valid characters are 0-9, A-Z PERFORMVARYING norm2 FROM1*DWF: ??? ifSQL WORKEND-EXEC MOVE"0"TO NORMSQX(norm1) END-IF END-PERFORM
MOVE5TO norm1 *valid characters are 0-9, A-Z *examining position 5 of char array NORMSQ PERFORMVARYING norm2 FROM1BY1UNTIL if (NORMSQX(norm1) .
(norm1) END-IF END-PERFORM
*implementation-defined subclasses are allowed for warnings *(class = 01). These equate to successful completion *SQLSTATE values of 00000. *Reference SQL-92 4.28 SQL-transactions, paragraph 2
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.