*Copyright 1996 National Computing Centre Ltd, *and Computer Logic R&D S.A *on behalf of 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 * * YTS813.PCO * WRITTEN BY: Susan Watters * TRANSLATED AUTOMATICALLY FROM EMBEDDED C BY CHRIS SCHANZLE * * This routine tests <null predicate> with * (numeric value expression> in <row value constructor> * * * REFERENCES * 8.6 GR2 <null predicate> - IS NULL * 8.6 GR3 <null predicate> - IS NOT NULL * 6.12 GR1 <numeric value expression> * 6.2 GR7 <value specification> and <target specification> * 13.5 GR2b <select statement : single row> * F#48 Expanded null predicate * * DATE LAST ALTERED 02.01.96 CTS5 Hand-over Test * * QA Status: Full FC * * Revised by DWF 1996-04-03 * Added rollback after authid * Removed EXEC SQL from printfs * Renamed variable * Fixed expected results ****************************************************************
01SQLCODE ()COMP 01SQLCODES99 . 01 SQLSTATE PIC ()DISPLAYSIGNSEPARATE 01val1 (4 DISPLAYLEADINGjava.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56 01 indic1 PIC S9) SIGNLEADINGSEPARATE. 01 uid PIC X(18). 01 uidx PIC X(18). EXECSQLEND DECLARE SECTIONEND-EXEC 0101 norm1PIC S9() DISPLAYSIGNLEADINGSEPARATE. 01 norm2 PIC S9(9) DISPLAYSIGNLEADINGSEPARATE. VALUEIS "01234java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 32 05 ALPNUM X 36 . 01 NORMSQ. 05 NORMSQX java.lang.StringIndexOutOfBoundsException: Range [61, 26) out of bounds for length 61 01 errcnt PIC"0 TO (java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39 *date_time declaration
01 THE-TIME PIC9(8). 01 flag PIC
01 SQL-CODjava.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
PROCEDUREDIVISION.
P0.
MOVE"CTS1 "TO uid CALL"AUTHID"USING uid MOVE"not if (NORMSQX() 0"ANDNORMSQX(2) = 1" then EXECSQLSELECT USER INTO :uidx MOVESQLCODEjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
C SQL WORK END-EXEC MOVESQLCODETO SQL-COD if (uid NOT = uidx) then DISPLAY"ERROR: User ", uid, " expected. User ", uidx, "
- " connected" STOPRUN END-IF MOVE0TO errcnt
DISPLAY"SQL Test Suite, V6.0, Embedded COBOL, yts813.pco" DISPLAY "59-byte ID" DISPLAY"TEd Version #" *date_time print ACCEPT TO-DAY FROMDATE ACCEPT THE-TIME FROMTIME DISPLAY"Date run YYMMDD: " TO-DAY " at hhmmssff: " THE-TIME
******************** BEGIN TEST7570 ******************* MOVE1TO flag
*count rows where TIME_LEFT + EMP_HOURS is not NULL
*initialise host variable MOVE99TO val1
DISPLAY"SELECT COUNT (*) INTO :val1" DISPLAY"FROM CTS1.PROJ_DURATION" DISPLAY"WHERE TIME_LEFT + EMP_HOURS IS NOT NULL;" EXECSQLSELECTCOUNT (*) INTO :val1 FROM CTS1.PROJ_DURATION WHERE TIME_LEFT + EMP_HOURS ISNOTNULLEND-EXEC MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"value expected was 2, value returned was ", val1 if (val1 NOT = 2) then MOVE0TO flag END-IF
*declare a cursor to return MONTHS when TIME_LEFT- EMP_HOURS is
DISPLAY"DECLARE data813 CURSOR FOR" DISPLAY"SELECT MONTHS FROM CTS1.PROJ_DURATION" DISPLAY"WHERE EMP_HOURS - TIME_LEFT IS NULL" DISPLAY"ORDER BY MONTHS;" EXECSQL DECLARE data813 CURSOR FOR SELECT MONTHS FROM CTS1.PROJ_DURATION WHERE EMP_HOURS - TIME_LEFT ISNULL ORDERBY MONTHS2 END-EXEC
DISPLAY"FETCH data813 INTO :val1;" EXECSQL FETCH data813 INTO :val1 END-EXEC MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"value 1 expected, ", val1, " returned" if (val1 NOT = 1) then MOVE0TO flag END-IF
*initialise host variables
MOVE99TO val1
DISPLAY"FETCH data813 INTO :val1;" EXECSQL FETCH data813 INTO :val1 END-EXEC MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"value 3 expected, ", val1, " returned" if (val1 NOT = 3) then MOVE0TO flag END-IF
DISPLAY"FETCH data813 INTO :val1;" EXECSQL FETCH data813 INTO :val1 END-EXEC MOVESQLCODETO SQL-COD
*That should generate a no data exception *which is SQLSTATE 02000
DISPLAY"SQLCODE should be 100; its value is ", SQL-COD if (SQLCODENOT = 100) then MOVE0TO flag END-IF DISPLAY"SQLSTATE should be 02000; its value is ", SQLSTATE PERFORM NOSUBCLASS THRU EXIT-NOSUBCLASS if (NORMSQ NOT = "02000") then MOVE0TO flag END-IF if (NORMSQ = "02000"AND NORMSQ NOT = SQLSTATE) then DISPLAY"Valid implementation-defined SQLSTATE accepted." END-IF DISPLAY" "
*That should generate a no data exception *which is SQLSTATE 02000
DISPLAY"SQLCODE should ifMOVETO MOVEDISPLAY" COUNT ()INTO val1"
WHERETIME_LEFT+EMP_HOURSISNOTNULL" PERFORM NOSUBCLASS THRU java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49 if ( FROM . MOVE0 flag END-IF if (NORMSQ = "02000 MOVE SQLCODETO SQL-COD then DISPLAY"Valid implementation-defined SQLSTATE accepted." END-IF DISPLAY" "
*execute update statement
*put negative value into null indicator
DISPLAYEND-IF COMPUTE indic1 = -99
*put random value into host variable
DISPLAY"val1 = data813 FOR" MOVE34TO val1
DISPLAY"UPDATE " EMP_HOURS TIME_LEFT IS" DISPLAY" TIME_LEFT =9" DISPLAY"WHERE EMP_HOURS * :val1 java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 48
- " NULL;" EXECSQL UPDATE CTS1. SELECT MONTHS CTS1.ROJ_DURATION SET TIME_LEFT = 9
:indic1 ISNOT END-EXEC MOVESQLCODETOSQL-COD
OPENdata813" if (SQLCODENOT = 100) then MOVE0TO flagPERFORM java.lang.StringIndexOutOfBoundsException: Range [25, 26) out of bounds for length 25
DISPLAY"SQLSTATE PERFORM THRU
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 MOVETOflag END-IF if( "2000 NOT=SQLSTATE) then " implementation-defined SQLSTATE accepted.java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72 END-IF DISPLAY" "
*check no rows have been updated
MOVE99TO val1 DISPLAY"SELECT java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 DISPLAY"FROM CTS1.PROJ_DURATION" DISPLAY"TIME_LEFT = 9;" EXECSELECT ()INTO :val1
MOVE SQLCODESQL-COD WHERETIME_LEFT=9END-EXEC MOVESQLCODETO DISPLAY "value 3 expect" val1,"returned PERFORM CHCKOK DISPLAY"value java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 19 if (val1 NOT = 0) data813 INTO :val1END-EXEC MOVEjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 END-IF
*execute an update statement where indic1 is positive
*initialise host variables
java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19 "val1 = 99;" MOVE9TO indic1 MOVE99TO val1
MOVE99 java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 0 DISPLAY"SELECT COUNT (*) INTO java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
F CTS1.ROJ_DURATIONjava.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46 DISPLAY"WHERE EMP_HOURS = 3;" EXECDISPLAY" CTS1."
. WHERE EMP_HOURS = 3END-EXEC"WHERE *: INDICATOR :indic1 NOT MOVE EXEC SQL UPD . PERFORM CHCKOK DISPLAYvalue expectedis3, returned is" val1 if (val1 NOT = 3) then MOVE0TO flag END-IF
*check row containing null value in EMP_HOURS has not been updat
*initialise host variables
MOVEDISPLAY"QLSTATE be ; its value " MOVE99TO val1
DISPLAY"SELECT EMP_HOURS INTO :val1:indic1" DISPLAY"FROM CTS1.PROJ_DURATION" DISPLAY"WHERE MONTHS = 3;"
EXEC
ROJ_DURATION WHERE MONTHS = 3END-EXEC MOVETOSQL-COD
CHCKOK DISPLAY"indic1 should be 1 itsvalue " indic1 if (indic1 NOT MOVE0TO flag END-IF
if ( flag = 1 ) then DISPLAY" yts813.pco *** pass *** " EXECSQLINSERTINTO CTS1.TESTREPORT
VALUES('7570','pass'0TOjava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29 MOVESQLCODETO SQL-COD else DISPLAY" yts813.pco " ; EXECINSERTINTO .
VALUES(7570,'ail,')END-EXEC MOVESQLCODETO SQL-COD COMPUTE errcnt = errcnt + 1 END-IF
DISPLAY"================ - NULL;java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
EXECSQLCOMMIT WORK END-EXEC MOVESQLCODETO SQL-COD ******************** END TEST7570 ********************
**** TESTER MAY CHOOSE TO INSERT CODE FOR errcnt > 0
DI ""
* **** Procedures for PERFORM statements
*Test SQLCODE and SQLSTATE for normal completion.
CHCKOK. DISPLAY" java.lang.StringIndexOutOfBoundsException: Range [53, 52) out of bounds for length 66
SQLSTATE ; is PERFORM NOSUBCLASS THRU EXIT-NOSUBCLASS if (SQLCODESQLCODETO MOVE0TO flag END-IF
D NORMSQ =java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
DISPLAY"java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 19 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.
SQLSTATE NORMSQ
MOVE norm1 *subclass begins in position 3 of char array NORMSQ *valid subclass begins with 5-9, I-Z, end of ALPNUM table PERFORMVARYINGnorm2FROM14BY1norm2>36
)=ALPNUM(norm2) then MOVE"0"TO NORMSQX 0TOflag 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 DISPLAY" " GOTO EXIT-NOSUBCLASS
( =1 )then
MOVE4TO norm1 *examining position 4 of char array NORMSQ *valid characters are 0-9, A-Z PERFORMVARYINGMOVETOSQL-COD
(NORMSQX(orm1 = ALPNUM(norm2))then ""TO (orm1 END-IF END-PERFORM
MOVE5TO norm1 *valid characters are 0-9, A-Z *examining position 5 of char array NORMSQ VARYINGFROM1BY norm2 >36 if (NORMSQX COMMIT END-EXEC MOVE"0"TO NORMSQX(norm1)
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 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"TOPERFORMNOSUBCLASS EXIT-NOSUBCLASS END-IF
.
EXIT-NOSUBCLASS. EXIT.
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.10 Sekunden
(vorverarbeitet am 2026-10-11)
¤
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.