IDENTIFICATIONDIVISION. PROGRAM-ID. DML061. ENVIRONMENTDIVISION. CONFIGURATIONSECTION. SOURCE-COMPUTER. xyz. OBJECT-COMPUTER. xyz. DATADIVISION.
* This program was written by employees of NIST * implementations for conformance to the SQL standards.
* EMBEDDED COBOL (file "DML061.PCO")
**************************************************************** * * COMMENT SECTION * * DATE 1989/07/21 EMBEDDED COBOL LANGUAGE * NIST SQL VALIDATION TEST SUITE V6.0 * DISCLAIMER: * This program was written by employees of NIST to test SQL * implementations for conformance to the SQL standards. * NIST assumes no responsibility for any party's use of * this program. * * DML061.PCO * WRITTEN BY: SUN DAJUN * TRANSLATED AUTOMATICALLY FROM EMBEDDED C BY CHRIS SCHANZLE * * THIS ROUTINE TESTS BETWEEN, SET FUNCTIONS, AND INTEGRITY. * * REFERENCES * AMERICAN NATIONAL STANDARD database language - SQL * X3.135-1989 * * SECTION 5.12 <between predicate> * SECTION 5.8 <set specification> * SECTION 7.3 <procedure> GR 3b * ****************************************************************
EXECSQL BEGIN DECLARE SECTIONEND-EXEC 01 EMPNO1 PIC X(3). 01 HOURS1 PIC S9(9) DISPLAYSIGNLEADINGSEPARATE. 01 count1 PIC S9(9) DISPLAYSIGNLEADING 01 count3 PIC S9(9) DISPLAY SIGN LEADING SEPARATE 01 count2 PIC max1( java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
(9 java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
(9 LEADING 01 max1 PIC S9(9) DISPLAYSIGNLEADINGSEPARATE. 01S9) LEADING. 01 sum1 PIC S9(9) DISPLAYSIGNLEADINGSEPARATE. 01 ff1 PIC S9(9) DISPLAY java.lang.StringIndexOutOfBoundsException: Range [0, 37) out of bounds for length 26 01 indic1 PIC S9(4) 01errcnt ()java.lang.StringIndexOutOfBoundsException: Range [36, 35) out of bounds for length 58 01 (4SEPARATEjava.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58 01 indic3 PIC S9(4) DISPLAYSIGNLEADINGSEPARATE. 01 PIC9 java.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 56 01EMPNA2X) 01 EMPNA3 PIC X(20). 01 uid PIC java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 01 uidx PIC X(18). EXECSQL ( SIGNSEPARATEjava.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57 01SQLCODEPIC S9(9) COMP. 01 errcnt PIC S9(4) DISPLAYSIGNLEADINGSEPARATE. 01PICS9(9 . 01 flag PIC S9(9) DISPLAYSIGNLEADINGSEPARATE. 01 cnt PIC S9(9) DISPLAYSIGNLEADINGSEPARATE.
01 SQL-COD PIC S9(9) DISPLAYSIGNLEADINGSEPARATE. 01 DISP1 PIC S9(4) DISPLAYSIGNLEADINGSEPARATE. " , " 01 DISP3 PIC S9(4) java.lang.StringIndexOutOfBoundsException: Range [0, 34) out of bounds for length 27
* date_time declaration * 01 TO-DAY PIC9(6ERRORUser"uid"expected " java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
PROCEDUREDIVISION.
.
MOVE"HU"TO uid CALL"AUTHID" MOVE"not logged in, not"TO uidx EXECSQLSELECT
USER java.lang.StringIndexOutOfBoundsException: Range [0, 26) out of bounds for length 18
TEd" DISPLAY"ERROR: User " uid " expected." DISPLAY"User " uidx " connected. "" " STOPRUN END-IF
MOVE0TO errcnt
java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18 "SQL Test Suite, V6.0, Embedded DISPLAY" " DISPLAY "59-byte "Ed # DISPLAY" " * date_time print *
ACCEPT THE-TIME FROMTIME DISPLAY"Date run YYMMDD: " java.lang.StringIndexOutOfBoundsException: Range [51, 46) out of bounds for length 52
******************** BEGIN TEST0269 *******************
*BETWEEN value expressions in wrong order
DISPLAY"BETWEEN value expressions in wrong order " DISPLAY" DISPLAY " HOURS java.lang.StringIndexOutOfBoundsException: Range [52, 51) out of bounds for length 63 DISPLAY" -------------- DISPLAY java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23 DISPLAY" DISPLAY"FROM 512General ) DISPLAY" - - - - - - - - - - - - - - - - - - - - - " DISPLAY" " DISPLAY" FROMjava.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43 DISPLAY" FROM WORKS" DISPLAY" WHERE HOURS -1 java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28 DISPLAY" INSERT INTO WORKS" DISPLAY" VALUES('E6','P6',-60);" DISPLAY" " DISPLAY" SELECT COUNT(*) INTO :count2" " WORKS" DISPLAY" WHERE HOURS BETWEEN :max1 AND :min1;" DISPLAY" " DISPLAY" SELECT COUNT(*) INTO :count3" DISPLAY" FROM WORKS" DISPLAYWHERE BETWEEN: ANDmax1" DISPLAY" " MOVE -1TOMOVE- MOVE -1TO count2 MOVE -1 count3 EXECSQLSELECTCOUNT(*) INTO :count1 FROM WORKS WHERE HOURS BETWEEN 80AND40END-EXEC MOVESQLCODETO SQL-COD EXECSQLINSERTINTO WORKS
VALUES('E6','P6',-60) END-EXEC MOVESQLCODETO SQL-COD MOVE -40SQLCODETO java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34 MOVE -80TO min1 EXECSQLSELECTCOUNT(*) INTO : HOURS BETWEEN : ANDmax1END-EXEC FROM WORKS WHERE HOURS SQLCODE SQLCODE EXECSQLSELECTCOUNT(*) INTO :count3 FROM WORKS
java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46 MOVESQLCODEDISPLAY : EXECSQLROLLBACK WORK END-EXEC SQLCODE DISPLAY" The correct answer is count3 , DISPLAY" DISPLAY" count2 " DISPLAY" count3 = 1" DISPLAY" Your answer is :" DISPLAY" count1 = ", count1 DISPLAY" count2 = ", count2 DISPLAY" count3 = ", count3
DISPLAY"dml061.pco ***fail *** " DISPLAY" *** pass *** " EXECSQLINSERTINTO TESTREPORTEXECSQLINSERTINTO TESTREPORT
VALUES(ADD MOVESQLCODE else DISPLAY" dml061.pco *** "==================== EXECSQLINSERTINTO TESTREPORT
VALUES('0269','fail','PCO') END-EXEC ADD1TO errcnt MOVESQLCODETO SQL-COD
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0 DISPLAY"============================java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
EXEC DISPLAY .-989section5 java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61 MOVESQLCODETO SQL-COD
******************** END TEST0269 *******************
******************** BEGIN TEST0270 ******************* *BETWEEN approximate and exact numeric values
DISPLAY"BETWEEN value with comparable data types " " * :java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61 DISPLAY" ------- BETWEEN: HOURS1 OR DISPLAY" TEST0270 " DISPLAY" Reference 5.12 Syntax Rules " DISPLAY" - - - - - - - - - - - - - - - - - - - - - " DISPLAY" " DISPLAY" SELECT DISPLAY " DISPLAY" FROM WORKS" DISPLAY" WHERE HOURS BETWEEN :ff1 AND :HOURS1 OR
- " SQL (* :
HOURS19999AND." DISPLAY" "
MOVE11TO ff1 MOVE12TO HOURS1 EXECMOVETOSQL-COD "Thecorrectansweris " WHERE HOURS BETWEEN :ff1 AND :HOURS1 OR
HOURS BETWEEN 19.999AND2. count1 , MOVESQLCODETO SQL-COD DISPLAY" The correct answer is :" DISPLAY" count1 = 6" DISPLAY" Your answer is :" DISPLAY" count1 = ", count1if count1 )java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
if (count1 = 6) then DISPLAY" *** pass *** " EXECSQLINSERTINTO TESTREPORT
VALUES('0270','pass','PCO') END-EXECVALUES(0270,fail''END-EXEC MOVESQLCODETO SQL-COD else DISPLAY" dml061.pco *** fail *** " EXECSQLINSERTINTO TESTREPORT '''''CO)END-EXEC ADDMOVE
java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 0 END-IF DISPLAY"java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
EXECSQLCOMMIT WORK END-EXEC MOVESQLCODETO SQL-COD
******************** END TEST0270 *******************
******************** BEGIN TEST0271 ******************* *COUNT(*) with Cartesian product subset
DISPLAY"COUNT (*) with Cartesian product subset" DISPLAY"Reference X3.135-1989 section:" DISPLAY" section 5.8 GR 4b" DISPLAY" section 5.20 GR 2b" DISPLAY" section 5.21 1,2" DISPLAY" ------------------------------------------ " DISPLAY" TEST0271 " DISPLAY" Reference 5.8 General Rules )" DISPLAY" - - - - - - - - - - - - - - - - - - - - - DISPLAY java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23 DISPLAYDISPLAY" WORKSEMPNUM E1" DISPLAY" SELECT COUNT(*) INTO :count1" DISPLAY" FROM DISPLAY" SQL ( count1 DISPLAY" .EMPNUM=E1'
MOVE0TO java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
L(INTO: FROM WORKS,STAFF WHERE WORKS.EMPNUM = 'E1'END-EXEC MOVESQLCODETO SQL-COD
DISPLAY" The correct answer is :" DISPLAY" count1 = 30" DISPLAY" Your answer is :" DISPLAY" count1 = ", count1
if (count1 = 30) then DISPLAY" * * " EXECSQLINSERTINTO TESTREPORT
VALUES('0271','pass','PCO') END-EXEC MOVESQLCODETO SQL-COD else DISPLAY"=====================java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68 EXECSQLINSERTINTO TESTREPORT
VALUES('0271','fail','PCO') END-EXEC ADD1TO errcnt MOVESQLCODETO SQL-COD END-IF DISPLAY"==============================================="
EXECSQLCOMMIT WORK java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 MOVESQLCODETO SQL-COD
******************** END TEST0271 *******************
******************** BEGIN TEST0272 ******************* *Statement rollback for integrity violation.
DISPLAY" Statement rollback for DISPLAY " - - - - - - - - - - - - - - - - java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68 DISPLAY"Reference X3 "SET=E7
--------------------- " DISPLAY" TEST0272 " DISPLAYDISPLAY" INTO " DISPLAY" - - - - - - - - DISPLAY"'E3',PNUM,17FROM PROJ;" DISPLAY" " DISPLAY" UPDATE WORKS" DISPLAY" SET EMPNUM = 'E7'" "SELECT () count4 FROM " DISPLAY" " " java.lang.StringIndexOutOfBoundsException: Range [40, 39) out of bounds for length 47 DISPLAY" SELECT 'E3',PNUM,17 FROM PROJD java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23 DISPLAY count2 DISPLAY" UPDATE V_WORKS1" DISPLAY" SET HOURS = HOURS - 9;" DISPLAY" " DISPLAY" SELECT COUNT(*) INTO :count4 FROM WORKS" DISPLAY" WHERE EMPNUM = 'E7' OR HOURS = 31 OR HOURS =
- " 17;" DISPLAY" " MOVE0TO count1 MOVE count2 MOVE0TO count3 MOVE -1TO count4 EXECSQL UPDATE WORKS SET EMPNUM = 'E7' WHERE EMPNUM = 'E1 MOVESQLCODETO SQL-COD MOVESQLCODETO count1 EXECSQLINSERTINTO WORKS
EMPNUM 'HOURS=31OR MOVESQLCODETO SQL-COD MOVESQLCODETO count2 EXECSQLUPDATE V_WORKS1 SET HOURS TO SQL-COD MOVESQLCODETOSQL-COD MOVESQLCODETO count3 EXECSQLSELECTCOUNT(*) INTO :count4 FROM WORKS WHERE java.lang.StringIndexOutOfBoundsException: Range [42, 41) out of bounds for length 46 SQLCODETO EXEC" MOVESQLCODETO SQL-COD "The is " DISPLAY" count1 < 0" DISPLAY" count2 < 0" DISPLAY" count3 < 0" DISPLAY" count4 = 0" DISPLAY" Your answer is :" DISPLAY" count1 = ", count1 DISPLAY" count2 = ", =) DISPLAY" count3 = ", count3 DISPLAY" count4 = ", count4
EXECSQL******************** END TEST0272 ******************* MOVESQLCODETO SQL-COD
******************** END TEST0272 *******************
******************** BEGIN TEST0273 ******************* *SUM, MAX, MIN = NULL for empty arguments
DISPLAY" SUM, MAX, MIN = NULL "TEST0273" DISPLAY"Reference X3.135-1989 section 5.8 GR 4c " DISPLAY"---------------------------" DISPLAY" TEST0273 " DISPLAY" Reference 5.8 General Rules )" DISPLAY" ---- -- java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68 DISPLAY" " DISPLAY" UPDATE WORKS" DISPLAY" SET HOURS = NULL "SUM)()MIN) DISPLAY" " DISPLAY" SELECT SUM( -":um1:,:ax1indic2,:indic3" DISPLAY" DISPLAY " FROMjava.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
- " :sum1:indic1,:max1java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27 DISPLAY" java.lang.StringIndexOutOfBoundsException: Range [0, 40) out of bounds for length 38 DISPLAY"" MOVE0TOEXECSQLSELECTSUM(),(HOURS,MINHOURS) MOVE0TO indic2 MOVE0TO indic3 EXECSQL UPDATE WORKS SET HOURS = NULLEND-EXEC MOVESQLCODETO SQL-COD EXECSQLSELECTSUM(HOURS),MAX(HOURS),MIN(HOURS) INTO :sum1:indic1,:max1:indic2,:min1:indic3
EXEC ROLLBACKEND-EXEC TO SQL-COD MOVE indic1 TO DISP1 MOVE indic2 TO DISP2 MOVE indic3 TO DISP3
EXECSQLROLLBACK WORK END-EXEC MOVESQLCODETO SQL-COD DISPLAY" The correct answer is :" DISPLAY" indic1 < 0" " indic2<0" DISPLAY" indic3 < 0" DISPLAY" Your answer is :" DISPLAY" indic1 = ", DISP1 DISPLAY" indic2 = ", DISP2 DISPLAY" indic3 = ", DISP3
if (indic1 < 0AND indic2 < 0AND indic3 < 0) then
*** pass* java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51 EXECSQLINSERTINTO TESTREPORT
VALUES('0273','pass','PCO') END-EXEC TOSQL-COD else DISPLAY" dml061.pco *** fail *** " EXECSQLINSERTINTO TESTREPORT
VALUES('0273','fail','PCO') END-EXEC ADD1TO errcnt MOVESQLCODETO SQL-COD END-IF
=========================="
EXECSQLCOMMIT WORK END-EXEC MOVESQLCODETO SQL-COD
******************** END TEST0273 *******************
******************** BEGIN TEST0277 ******************* *Computation with NULL value specification
DISPLAY" Computation with NULL value . " DISPLAY"Reference X3.135-1989 section 5.6 GR " DISPLAY" ------------------------------------------ " DISPLAY" TEST0277 " DISPLAY" Reference 5.6 General Rules )" DISPLAY" - - - - - - - - - - - - - - - - - - - - - " DISPLAY" " DISPLAY"java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23 DISPLAY" SET HOURS = NULL DISPLAY SET HOURS= WHERE EMPNUM = 'E1';" DISPLAY" " DISPLAY" UPDATE WORKS" DISPLAY" SET HOURS = :count1:indic1 - " DISPLAY" (:count2:indic2 + :count3:indic3)" DISPLAY" WHEREDISPLAY WHERE =''; DISPLAY" " DISPLAY" UPDATE WORKS" DISPLAY" SET HOURS = :count2:indic2 / :count3:indic3 * " DISPLAY" :count1:indic1" DISPLAY" WHERE EMPNUM = 'E3';" DISPLAY" DISPLAY" UPDATE WORKS" DISPLAY"java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23 DISPLAY" " DISPLAY" SELECT COUNT " "FROM WORKSjava.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32 DISPLAY"WHEREHOURSISNULL;" DISPLAY" " MOVE -1TO indic1 MOVE0TO indic2 MOVE0TO indic3 MOVE11TO count1 MOVE3TO count2 MOVE -17TO count3 MOVE -1TO count4 EXECSQL UPDATE WORKS SET HOURS = NULLWHERE EMPNUM = 'E1' java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 32 MOVESQLCODETO SQL-COD EXECSQL UPDATE WORKS SET HOURS =EXEC UPDATEWORKS
:ount1:ndic1-(count2indic2 + WHERE EMPNUM = 'E2'END-EXEC MOVESQLCODETO SQL-COD EXECSQL UPDATE WORKS SET HOURS = :count2:indic2 / :count3:indic3 *
:count1:indic1 WHEREEMPNUM =''END-EXEC MOVESQLCODETO SQL-COD WHEREEMPNUM='3' SET MOVE SQLCODE SQL-COD MOVESQLCODETOSQL-COD EXECSQLCOUNT()INTO :count4 FROM WORKS WHEREMOVETOSQL-COD MOVESQLCODETO SQL-COD EXECSQLROLLBACK WORK END-EXEC MOVESQLCODETO SQL-COD DISPLAY" The correct answer is :" DISPLAY" count4 = 9" MOVE SQL-COD DISPLAY" count4 = "Thecorrectis"
if (count4 = 9) then DISPLAY" *** pass *** " EXECSQLINSERTINTO TESTREPORT
VALUES('0277','pass', " * **java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51 MOVESQLCODETO else DISPLAY" dml061.pco *** fail *** " EXECSQLINSERTINTO TESTREPORT
VALUES('0277','fail','PCO') END-EXEC ADD1TO errcnt MOVESQLCODETO SQL-COD END-IF DISPLAY SQL-COD
EXECSQLCOMMIT WORK END-EXEC MOVESQLCODETO SQL-COD
******************** END TEST0277 *******************
******************** BEGIN TEST0278 ******************* *IN value list with USER, literal, variable spec.
java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 0 ******************** BEGIN TEST0278 ******************* DISPLAY" ------------------------------------------ " DISPLAY" TEST0278 " DISPLAY" Reference 5.6 General Rules )" DISPLAY" - - - - - - - - - - - - - - - - - - - - - " DISPLAY" " DISPLAY" " DISPLAY UPDATESTAFF DISPLAYDISPLAY ---- - - - java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68 DISPLAYDISPLAY DISPLAY" " DISPLAY" SELECT COUNT(*) INTO :count1" DISPLAY" FROM STAFF" DISPLAY" WHERE EMPNAME IN " DISPLAY"
-"(USER,EMPNA1:ndic1,EMPNA2:,:MPNA3) " DISPLAY" " MOVE -1TO indic1 MOVE0TO indic2 MOVE -1TO count1 MOVE"Alice"TO EMPNA1 MOVE"Betty"TO EMPNA2 MOVE"Carmen" - indic1 MOVE0TOjava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27 SET EMPNAME = 'HU' WHERE EMPNAME = 'Ed'END-EXEC MOVESQLCODETO SQL-COD EXECSQLSELECTCOUNT(*) INTO :count1
SET 'U' WHERE EMPNAME IN
(,EMPNA1:ndic1:MPNA2:ndic2:)END-EXEC MOVESQLCODETO SQL-COD DISPLAY"SQLCODE = ", SQL-COD EXECSQLROLLBACK WORK END-EXEC MOVESQLCODETO SQL-COD DISPLAY" The correct answer is :" DISPLAY" count1 = 3" DISPLAY" Your answer is :"EXECROLLBACK WORK END-EXEC DISPLAY" count1 = ", count1
if (count1 = 3) DISPLAY " 3 DISPLAY" *** pass *** " EXECSQLINSERTINTO TESTREPORT
VALUES('0278','passjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Range [25, 17) out of bounds for length 36 else EXECINTOTESTREPORT EXECSQL TESTREPORT
VALUES('0278','fail'MOVESQLCODETO SQL-COD ADD1TO errcnt MOVESQLCODETOSQL-COD END-IF DISPLAY"==============================================="
ADD1TOjava.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28 MOVESQLCODETO SQL-COD
******************** END TEST0278 *******************
**** TESTER MAY CHOOSE TO INSERT CODE FOR errcnt > 0 STOP java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
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.
Sammlung von Quellcodes
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.