**************************************************************** * * COMMENT SECTION * * DATE 1996-05-06 EMBEDDED COBOL LANGUAGE * 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. * * DML168.PCO * WRITTEN BY: David Flater * TRANSLATED AUTOMATICALLY FROM EMBEDDED C BY CHRIS SCHANZLE * * This routine tests Intermediate SQL. * * REFERENCES * FIPS PUB 127-2 14.2 Intermediate SQL * ANSI SQL-1992 * ****************************************************************
EXEC01 ALPNUM-TABLE VALUE01234ABCDEFGH56789IJKLMNOPQRSTUVWXYZ
5 ALPNUM X OCCURS36TIMES
1 SQLSTATE X(5).
01 uid PIC X(18).
01 uidx PIC X(18).
01 int1 PIC S9(9) DISPLAYSIGNLEADINGSEPARATE.
01 c4 PIC X(4). EXECSQLEND DECLARE SECTIONEND-EXEC
01 norm1 PIC S9(9) DISPLAYSIGNLEADINGSEPARATE.
01 norm2PICS99) DISPLAYSIGNSEPARATE.
01 ALPNUM-TABLE VALUE "01234ABCDEFGH56789IJKLMNOPQRSTUVWXYZ". *date_time declaration
05 LPNUM X OCCURS 36TIMES
01 NORMSQ01 THE-TIME 9(8).
05 NORMSQX 01 flag PIC S9(9) DISPLAYSIGNSEPARATE.
01 errcnt PIC S9(9) DISPLAYSIGNLEADING 1 PICS9 LEADINGjava.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59 *date_time declaration
01 TO-DAY SQLCODE SQL-COD SQL WORK
0 flagS99 SIGNSEPARATEjava.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
01 SQL-COD PIC S9 DISPLAYERROR"uid"expecteduidx java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
PROCEDURE errcnt
P0
" " uid "uid *date_time print EXECSQL THE-TIMETIME MOVE SQLCODE TO SQL-COD EXECROLLBACK MOVE SQLCODE if (uid 1 TO DISPLAY"ERROR: andCHARACTER_DATAdomains"
- " connected" STOP References
java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19 MOVE 0java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
DISPLAY DISPLAYCREATE DISPLAY
5- ID DISPLAY"TEd Version "C2 .CHARACTER_DATA *date_time print ACCEPT TO-DAY INFORMATION_SCHEMA, ACCEPTTHE-TIME java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36 DISPLAYDate:""at:"THE-TIME
******************** BEGIN TEST0876 *******************
1 TO
DISPLAY"COMMIT MOVE SQLCODE SQL-COD SQL WORK MOVEDISPLAYint1 value java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60 PERFORM CHCKOK DISPLAY" java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
DISPLAY"INSERT INTO T0876 VALUES ('T0876'," DISPLAYMOVETO
CHCKOK 'This table tests a couple ofjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 MOVE EXEC SQL DROP T0876 END-EXEC PERFORM CHCKOK DISPLAY"
MOVEDISPLAYCOMMIT
T(*) :int1 DISPLAY" FROM T0876" DISPLAY"WHERE C1 = '';" EXECSELECT(*INTO FROM T0876 ""
WHERE C1 = 'T0876'END-EXEC MOVETOjava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36 PERFORM DISPLAY"int1 VALUES('0876,'','PCOjava.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53 ifelse MOVE flag END-IF
DISPLAY"COMMIT WORK;" EXECC END-EXEC MOVETOjava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36 PERFORM DISPLAY" "
DISPLAY"==========================" EXEC DROP T0876 END-EXEC MOVE SQLCODESQLCODETO ******************** END TEST0876 ******************** DISPLAY" "
DISPLAY"COMMIT WORK;" EXECSQL COMMIT WORK END-EXEC MOVE SQLCODE TO SQL-COD PERFORMjava.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25 DISPLAY" COLUMN in ALTER TABLEisjava.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
" **pass** java.lang.StringIndexOutOfBoundsException: Range [54, 55) out of bounds for length 54 " INT);"
('087''','PCO') MOVETO else MOVETO EXECINSERT HU
VALUES('087 DISPLAY " java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
SQLCODE SQL-COD COMPUTE errcnt SQLCODE SQL-COD END-IF
EXECSQL MOVE SQLCODE TO SQL-COD" C2 CHAR (4;" ******************** END TEST0876 ******************** ******************** BEGIN TEST0878 ******************* MOVE flag
CHCKOK" DISPLAY" Keyword COLUMN in ALTER TABLE is optional"
References DISPLAY# -manipulation DISPLAY - ----"
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0 MOVE" java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
DISPLAYCOMMIT EXECSQL WORK MOVE CHCKOK PERFORM CHCKOK DISPLAY java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
DISPLAY"ALTER TABLE T0878" DISPLAY ABCD EXECSQLTABLE
DISPLAY""
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 PERFORM CHCKOK DISPLAY" "
DISPLAY"COMMIT WORK;"
java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42 MOVETO PERFORM CHCKOK T0878 DISPLAY" "
DISPLAY"ALTER TABLE T0878" " DROPC1CASCADE" EXECSQL c4 ABCD ',c4 'java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
flag
COMMIT PERFORM "
DISPLAY DISPLAY " "
DROP MOVE SQL-COD PERFORM SQL-COD DISPLAYjava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 0
(" EXEC MOVETO PERFORM CHCKOK DISPLAYjava.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
MOVE('8'pass DISPLAY* " DISPLAY" FROM java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17 EXEC * INTO FROM VALUES'')
SQLCODE PERFORMerrcnt +1 DISPLAY
c4") MOVE 0 TO
DISPLAY"COMMIT WORK;" EXEC COMMIT END-EXEC MOVE******************** END TEST0878 ******************** PERFORM CHCKOK
java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
EXEC java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
OVE SQL-COD ******************** END TEST0878 ******************** ******************** BEGIN TEST0879 ******************* MOVE 1 TO flag
DISPLAY" CHCKOK SQL WORK MOVE SQLCODE TO PERFORM CHCKOK "
DISPLAY"CREATE TABLE U0879 SQLCODE TOSQL-COD DISPLAY" C1 INT REFERENCES T0879 (C2));" EXECSQL CREATE TABLE U0879 (
C1 INT java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
PERFORM CHCKOK
AY java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
DISPLAY"ALTER TABLE java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 25 DISPLAY" DROP CONSTRAINT "COUNT()INTO" EXEC T0879
DROP RESTRICT
T0879 PERFORM
CHCKOK
DISPLAY"INSERT INTO T0879 VALUES (-1, -1);" SQLINTO VALUES- 1 MOVE SQLCODE TO" should be 200;itsvalue is ",Sjava.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72 PERFORM DISPLAY" "
MOVE int1 DISPLAYEjava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19 DISPLAY ; EXECSQLSELECTCOUNT(*) INTO :int1 FROM T0879 END-EXEC MOVE SQLCODE TO SQL-COD "java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25 DISPLAYint1 be 2 value",java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60 ifNOT )then MOVE0TO flag END-IF
DISPLAYINSERT U0879 (0;" EXECSQL 0 TO MOVE SQLCODE" 00itsvalueis" java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72 DISPLAY should value,SQL-COD if (SQLCODE NOT < 0) then MOVE END-IF ( = "200 =SQLSTATEjava.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70 "SQLSTATE should be 23000; its value is ", SQLSTATE PERFORM NOSUBCLASS THRU EXIT-NOSUBCLASS if (NORMSQ NOT = "23000") then MOVE END-IF if (NORMSQ = "23000"AND NORMSQ NOTEXEC COMMIT END-EXEC thenPERFORM java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
tion-defined" END-IF
java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
DISPLAY"INSERT INTO CONSTRAINT REFME RESTRICTEND-EXEC EXECSQLINSERTINTO T0879 SQLCODE SQL-COD
SQL-COD
SQLCODE<;its,SQL-COD if (SQLCODE NOT < 0) then MOVETO END-IFEjava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19 is SQLSTATE PERFORM THRU if (NORMSQ NOT = "23000") then MOVE 0 TO flagifNOT 20)then
Ejava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
( = "300 NORMSQNOT java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70 then DISPLAY"DISPLAY " END-IF DISPLAY"
" EXEC COMMIT MOVE SQLCODE TO SQL-COD PERFORM CHCKOK java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25 DISPLAY" SQLALTERTABLEjava.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
DISPLAY"ALTER TABLE MOVESQLCODE TO SQL-COD DISPLAY REFME EXECSQLALTER TABLE SQL WORK MOVE SQLCODE TO SQLCODE SQL-COD
CHCKOK if (SQLCODE NOT < 0) then MOVE 0 TO flag END-IF
SQLSTATE40;v ,SQLSTATE PERFORM NOSUBCLASS THRU EXIT-NOSUBCLASS
="20"then MOVE 0 TO flag END-IF ifNORMSQ0"AND NORMSQ NOT=SQLSTATE) then DISPLAY"Valid implementation-defined java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
PERFORM DISPLAY java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
DISPLAY"COMMIT MOVESQLCODE TO SQL-COD EXECSQL WORK MOVE SQLCODE
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 DISPLAY
"ALTERTABLE DISPLAY CHCKOK EXECSQLALTER TABLE
DROP CONSTRAINTEXEC DROP U0879 MOVEMOVETOSQL-COD PERFORM CHCKOK DISPLAY" "
DISPLAY WORK EXEC" WORK;" MOVETO PERFORM CHCKOK DISPLAY
DISPLAY"INSERT INTO U0879 VALUES (20);"
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 MOVE SQLCODE TO SQL-CODDISPLAY *pass PERFORM CHCKOK DISPLAY" ('0879''','PCO') java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
DISPLAYINSERTVALUES) EXECSQLINTO.TESTREPORT MOVESQLCODESjava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36 PERFORM CHCKOK DISPLAY java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
DISPLAY
WORK MOVEjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 PERFORM CHCKOK DISPLAY" "
DISPLAY"DROP TABLET0879;" EXECSQL DROP ******************** END TEST0879 ********************
QLCODE java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36 PERFORM DISPLAY" "
DISPLAY"COMMIT WORK;" EXEC WORK MOVE SQLCODE TODISPLAY SQLSTATE0;its", SQLSTATE PERFORM CHCKOKPERFORM NOSUBCLASS EXIT-NOSUBCLASS DISPLAY ( NOT NORMSQ0" hen
DISPLAYif =00 NOT=SQLSTATE EXEC DROP U0879 END-EXEC MOVETO PERFORM
java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
DISPLAY"COMMIT WORK;" EXECSQL COMMIT *implementation-defined subclasses with the 000 value MOVE SQLCODE TO SQL-COD PERFORM CHCKOK DISPLAY" "
EXECSQL COMMIT WORK END-EXEC MOVE ******************** END TEST0879 ******************** **** TESTER MAY CHOOSE TO INSERT CODE FOR errcnt > 0 STOP*so proceed to zero it out, if valid (0-9,A-Z)
* **** Procedures for PERFORM statements
*Test SQLCODE and SQLSTATE for normal completion.
. DISPLAY"SQLCODE should be 0; its value *examining position 4 of char array NORMSQ
*valid characters are 0-9, A-Z norm2 norm2 PERFORMif(norm1ALPNUM))then if (SQLCODE NOT = 0 OR NORMSQ NOTMOVE" () MOVETO END-IFEND-PERFORM if (NORMSQ norm1 *valid characters are 0-9, A-Z DISPLAY"Valid implementation-defined > 36 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
MOVE 3 TO *subclass begins in position 3 of char array NORMSQ *valid subclass begins with 5-9, I-Z, end of ALPNUM table PERFORM norm2 1 1UNTIL >3java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62 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
MOVE 4 TO norm1 *examining position 4 of char array NORMSQ *valid characters are 0-9, A-Z PERFORMVARYING norm2 FROM 1 BY 1 UNTIL norm2 > 36 if (NORMSQX(norm1) = ALPNUM(norm2)) then MOVE"0"TO NORMSQX(norm1) END-IF END-PERFORM
MOVE 5 TO norm1 *valid characters are 0-9, A-Z *examining position 5 of char array NORMSQ PERFORMVARYING norm2 FROM 1 BY 1 UNTIL 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
¤ 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.12Bemerkung:
¤
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.