*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 BEGINMOVE0java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29 01SQLCODEPIC S9(9) MOVE "xxxxxxxxxx" TO
(. 01 uid PIC X(18). 01 uidx PIC X(18). 01DISPLAY" INTO :_num1,:c_num2, 01 c_num2 PIC S9(9) DISPLAYSIGNLEADINGSEPARATE. 01 c_ch1 PIC X(java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 21 01 c_ch2 PICDISPLAY" should be 1001;it is ", c_num1 "" EXECSQLEND DECLARE SECTIONEND-EXEC
norm1PICS99 java.lang.StringIndexOutOfBoundsException: Range [57, 56) out of bounds for length 57 01 java.lang.StringIndexOutOfBoundsException: Range [31, 29) out of bounds for length 68 VALUEjava.lang.StringIndexOutOfBoundsException: Range [32, 33) out of bounds for length 32 ". 05 ALPNUM PIC X OCCURS36 TIMES.
. 05 NORMSQX PIC X OCCURS5 TIMES.END-IF 01 (9 LEADING. *date_time declaration 01 TO-DAY PIC9(6). 01 THE-TIME PIC9(8). 01 flag ""
01 SQL-COD PIC S9(9)
PROCEDUREDIVISION.
P0.
MOVE"CTS1 "TO uid "xxxxxxxxx"TOc_ch2 MOVE"not logged in, not"MOVETO c_num1 EXECSQLSELECT USER INTO :uidx FROM CTS1.ECCO END-EXEC TO SQL-COD EXECSQLROLLBACK WORK END-EXEC MOVESQLCODETO SQL-COD if (uid NOT = uidx) then DISPLAYERROR User",uid,"expected. User " uidx, "
- " connected" STOP" :c_ch2;" END-IF MOVE0TO errcnt
DISPLAY" EXEC SQL FETCH CLCURS INTO :_num1, :, :,: DISPLAY "59-byte ID MOVESQLCODE TO SQL-COD
java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25 *date_time print ACCEPT TO-DAY FROMDATE ACCEPT THE-TIME FROMTIME DISPLAY"Date run YYMMDD: " TO-DAY " at hhmmssff: ""OL_NUM2should 4000; it " java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
******************** BEGIN TEST7025 ******************* MOVEc_num2 = 4000then
DISPLAY DISPLAY" Flagging - Full SQL INSENSITIVE cursor" DISPLAY"References" DISPLAY" 13.1 - END-IF DISPLAY" 13.2 - < statement> " DISPLAY" 13.3 GR.3.e.i " DISPLAY" F#79 -- Insensitive cursors " DISPLAY" MOVE0 TO java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29 DISPLAY
COMPUTESQLCODE = -1 MOVE"xxxxx"TO SQLSTATE
*Use standard schema table CTS1.CL_STANDARD *declare an insensitive cursor based on columns of *CTS1.CL_STANDARD DISPLAY"DECLARE CLCURS INSENSITIVE CURSOR" DISPLAY"FOR SELECT java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 0 DISPLAY"FROM CL_STANDARD" DISPLAY"ORDER BY COL_NUM1 DESC;" EXECSQL DECLARE CLCURS INSENSITIVE CURSOR FORSELECT COL_NUM1, COL_CH1, COL_NUM2,COL_CH2 FROM CL_STANDARD ORDERBY COL_NUM1 DESC END-EXEC
DISPLAY"OPEN CLCURS;" EXECSQLOPEN CLCURS END-EXEC
PERFORM CHCKOK DISPLAYPERFORM CHCKOK
*NOW insert a row in CL_STANDARD
he cursor again 05) EXECEXECOPENEND-EXEC
VALUES(1005,'KEVIN',4005,'java.lang.StringIndexOutOfBoundsException: Range [0, 45) out of bounds for length 25 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 ,c_num1," DISPLAY"COL_CH1 should be MARIA; it is ", c_ch1, " " DISPLAY"COL_NUM2 should be 4001; it java.lang.StringIndexOutOfBoundsException: Range [0, 54) out of bounds for length 19 DISPLAY"COL_CH2 should be RHODES DISPLAY "LOSE" if (c_num1 NOT = 1001OR java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 43
c_num2 NOT = 4001SQLCODE SQL-COD MOVE0TO flagPERFORMCHCKOK END-IF if (c_ch2 NOT = "RHODES") then *restore table CL_STANDARD in its original state END-IF DISPLAY java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
*fetch fifth row DISPLAY"FETCH CLCURS INTO :c_num1
- "
flag = 1 )then END-EXEC MOVESQLCODETO SQL-COD PERFORM CHCKOK "OL_NUM1 shouldbe ;it ,c_num1,"" DISPLAY"COL_CH1 should be NICKOS; it is ", c_ch1, " " DISPLAY"COL_NUM2 should be 4000; it is ", c_num2, " " DISPLAY"COL_CH2 should be ATHENS; it is ", c_ch2, " " if (c_num1 NOT = SQLINSENSITIVEexecuted
c_num2 NOT = 4000) then MOVE0TO flag END-IF if (c_ch2 NOT = "ATHENS") then MOVE0TO flag END-IF DISPLAY java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
*end fetches VALUES('7025','NOGO','PCO') END-EXEC *supports the extension then the inserted row should be *now visible through the cursor
DISPLAY" DISPLAY Vendor does not fully " EXECSQLCLOSEEND-EXEC MOVESQLCODETO SQL-COD PERFORMCHCKOK DISPLAY" "
*open the cursor again DISPLAY"OPEN CLCURS;" EXECOPENCLCURSEND-EXEC MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY" "
*now fetch and check if the inserted row is visible *initialise host variables MOVE xxxxxxxxxx MOVE"xxxxxxxxxx"TO c_ch2 1 MOVE0TO c_num2
DISPLAY ***** END TEST7025 ********************
- " :c_ch2;" EXECSQL FETCH CLCURS INTO :STOP. END-EXEC MOVESQLCODETO SQL-COD PERFORM CHCKOK *since the cursor is declared insensitive with cursor *specification ORDER BY DESC the last row will be *returned first DISPLAY"OL_NUM1 should 1005; it " c_num1 java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69 "QLSTATE 00000 is" SQLSTATE DISPLAY"COL_NUM2 PERFORM NOSUBCLASS THRUjava.lang.StringIndexOutOfBoundsException: Range [52, 53) out of bounds for length 52
_ java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68 *check if the inserted row is visible through the cursor *proceed if not record a NOGO if it is if (c_num1 NOT = 1005OR c_ch1 NOT = "KEVIN"OR
c_num2 NOT = 4005)then MOVE0TO flag END-IF
= "XIOS"then MOVE0TO flag END-IF DISPLAY" "
*fetch remaining 5 rows, initialising before the host variables MOVE"xxxxxxxxxx" java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0 MOVE"xxxxxxxxxx"TO c_ch2 MOVE0TO c_num1 MOVE0TO c_num2 DISPLAY"FETCH *expected by the test case; otherwise the test will fail.
- " :c_ch2;" EXECSQL java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 END-EXEC MOVESQLCODETO SQL-COD
*valid subclass begins with5-9, I-Z, endof ALPNUMPERFORMVARYING norm2 FROM14BY1UNTIL > 36 DISPLAY" MOVE "0" TO NORMS(orm1) DISPLAY"COL_CH1 should java.lang.StringIndexOutOfBoundsException: Range [0, 40) out of bounds for length 22 DISPLAY"COL_NUM2 should be 4004; it is ", c_num2, " " DISPLAY"COL_CH2 should *so proceed to zero it out, if valid (0-9,A-Z) if(num1 NOT = 1004OR c_ch1 NOT ="ORRIS"OR
c_num2 NOT = 4004) then MOVE0TO flag GOTO EXIT-NOSUBCLASS
END- MOVE0 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 END-IF DISPLAY" "
*4 remaining MOVE"xxxxxxxxxx"TO c_ch1 MOVE"xxxxxxxxxx"TO c_ch2 MOVE0TO c_num1 MOVE0TO c_num2 DISPLAY"FETCH CLCURS INTO *examining position 4 of char array NORMSQ
- " :c_ch2;" EXECSQL FETCH CLCURS INTO :c_num1, PERFORMVARYINGFROM1UNTILnorm2 36 END-EXEC TO PERFORM CHCKOK DISPLAY" D-IF DISPLAY"COL_CH1 should be GEORGE; it is ", c_ch1, " " "COL_NUM2 should 4003; it , ," java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70 DISPLAYC java.lang.StringIndexOutOfBoundsException: Range [38, 37) out of bounds for length 69 if (c_num1 NOT = 1003OR java.lang.StringIndexOutOfBoundsException: Range [0, 47) out of bounds for length 37
c_num2 NOT = 4003) then MOVE0TO flag END-IF if (c_ch2 NOT = "ARTA") then 0TO END-IF DISPLAY" "
*3 remaining MOVE"xxxxxxxxxx"TO c_ch1 MOVE"xxxxxxxxxx"java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3 MOVE0. These equate to successful completion MOVE0TO*Reference SQL-92 4.28 SQL-transactions, paragraph 2 DISPLAY"FETCH if (NORMSQX(1) = "0" (2 =""
- " :c_ch2;" EXECSQL FETCH CLCURS INTO :c_num1, :c_ch1, :c_num2, :c_ch2
MOVESQLCODETO SQL-COD
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 DISPLAY"COL_NUM1 should . DISPLAY"COL_CH1 should be MAKIS; it is ", c_ch1, " " DISPLAY"COL_NUM2 should be 4002; it is ", c_num2, " " DISPLAY"COL_CH2 should be HANIA; it is ", c_ch2, " " if (c_num1 NOT = 1002OR c_ch1 NOT = "MAKIS"OR
c_num2 NOT = 4002) then MOVE0TO flag END-IF if (c_ch2 NOT = "HANIA") then MOVE0TO flag END-IF DISPLAY" "
*2 remaining 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 MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"COL_NUM1 should be 1001; it is ", c_num1, " " DISPLAY"COL_CH1 should be MARIA; it is ", c_ch1, " " DISPLAY"COL_NUM2 should be 4001; it is ", c_num2, " " DISPLAY"COL_CH2 should be RHODES; it is ", c_ch2, " " if (c_num1 NOT = 1001OR c_ch1 NOT = "MARIA"OR
c_num2 NOT = 4001) then MOVE0TO flag END-IF if (c_ch2 NOT = "RHODES") then MOVE0TO flag END-IF DISPLAY" "
*1 remaining 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 MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"COL_NUM1 should be 1000; it is ", c_num1, " " DISPLAY"COL_CH1 should be NICKOS; it is ", c_ch1, " " DISPLAY"COL_NUM2 should be 4000; it is ", c_num2, " " DISPLAY"COL_CH2 should be ATHENS it is ", c_ch2, " " if (c_num1 NOT = 1000OR c_ch1 NOT = "NICKOS"OR
c_num2 NOT = 4000) then MOVE0TO flag END-IF if (c_ch2 NOT = "ATHENS") then MOVE0TO flag END-IF DISPLAY" "
*end fetches *now close the cursor DISPLAY"CLOSE CLCURS;" EXECSQLCLOSE CLCURS END-EXEC MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY" "
*restore table CL_STANDARD in its original state DISPLAY"ROLLBACK WORK;" EXECSQLROLLBACK WORK END-EXEC MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY" "
*record results
if ( flag = 1 ) then DISPLAY" xts725.pco *** pass *** " EXECSQLINSERTINTO CTS1.TESTREPORT
VALUES('7025','pass','PCO') END-EXEC MOVESQLCODETO SQL-COD DISPLAY"SQL extension INSENSITIVE cursor executed
- " successfully" DISPLAY"Vendor must demonstrate Intermediate Flagger
- " WARNING" else DISPLAY" xts725.pco *** NOGO *** " EXECSQLINSERTINTO CTS1.TESTREPORT
VALUES('7025','NOGO','PCO') END-EXEC MOVESQLCODETO SQL-COD DISPLAY"Vendor does not support fully " DISPLAY"Intermediate SQL extension " DISPLAY"Support for Insensitive cursors is not required" END-IF
DISPLAY"========================================"
*BAK : Check again in order to insert a third option for fail *DWF: ???
EXECSQLCOMMIT WORK END-EXEC MOVESQLCODETO SQL-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; its value is ", SQL-COD DISPLAY"SQLSTATE should be 00000; its value is ", SQLSTATE PERFORM NOSUBCLASS THRU EXIT-NOSUBCLASS if (SQLCODENOT = 0OR NORMSQ NOT = "00000") then 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 PERFORMVARYING norm2 FROM14BY1UNTIL norm2 > 36 if (NORMSQX(norm1) = ALPNUM(norm2)) then MOVE"0"TO NORMSQX(norm1) END-IF END-PERFORM
*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 FROM1BY1UNTIL norm2 > 36 if (NORMSQX(norm1) = ALPNUM(norm2)) then 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 norm2 > 36 if (NORMSQX(norm1) = ALPNUM(norm2)) then MOVE"0"TO NORMSQX(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
if (NORMSQX(1) = "0"AND NORMSQX(2) = "1") then MOVE"0"TO NORMSQX(2) END-IF
.
EXIT-NOSUBCLASS. EXIT.
Messung V0.5 in Prozent
¤ 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.0.10Bemerkung:
¤
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.