DIVISIONjava.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31 PROGRAM-ID. DML001. ENVIRONMENTDIVISION. CONFIGURATIONSECTION. SOURCE-COMPUTER. xyz. OBJECT-COMPUTER. xyz. DATADIVISION. WORKING-STORAGESECTION.
* EMBEDDED COBOL (file "DML001.PCO")
**************************************************************** * * COMMENT SECTION * * DATE 1987/08/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. * * DML001.PCO * WRITTEN BY: HU YANPING * TRANSLATED AUTOMATICALLY FROM EMBEDDED C BY CHRIS SCHANZLE * * THIS ROUTINE TESTS THE DECLARE CURSOR STATEMENT IN THE * LANGUGE OF SQL. THE FORMAT: * DECLARE <cursor name> CURSOR * FOR <cursor specification> * * REFERENCES * AMERICAN NATIONAL STANDARD database language - SQL * X3.135-1989 * * SECTION 8.3 <declare cursor> * ****************************************************************
SQL DECLARE END-EXEC 01 PNO1 PIC 01 EMPNM1 X(20). 01SQL DECLARE SECTIONEND-EXEC 01 HOUR1 S9DISPLAYSIGNSEPARATE. 01 iii PIC S9(9) DISPLAYSIGNLEADINGSEPARATE. 01 uid PIC X(18). 01 uidx PIC X(18). EXECSQLEND DECLARE SECTIONEND-EXEC 01SQLCODE01 errcnt PIC(4)DISPLAYLEADINGSEPARATEjava.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58 01 errcnt S9 SEPARATE. 01 i PIC S9(9)DISPLAYLEADINGSEPARATE 01 ii01 SQL-COD PIC S9() DISPLAYSIGNLEADINGSEPARATE. 01 SQL-COD01PIC9(6)
* date_time declaration * DIVISION. 01 THE-TIME()
PROCEDUREDIVISION.
P0.
MOVE"HU"TO uid "HU"TO uid MOVE"not loggedin not java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44 EXECSELECT
USERuidx.ECCO if (uid NOT = uidx) then ": User"uid "expected.java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52 DISPLAY" uidx " connected." DISPLAY" " " " connected END-IF
MOVE DISPLAY " Test Suite .0, EmbeddedCOBOL, dml001.pco" DISPLAY" " DISPLAY "- " DISPLAY"TEd Version #" DISPLAY" " * date_time print * ACCEPT TO-DAY FROMDATE
THE-TIME FROM java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36 DISPLAY
******************** BEGIN TEST0001 *******************
MOVE i
DISPLAY" TEST0001 "" runYYMMDD: " TO-DAY:"THE-TIME DISPLAY"declare with ORDER BY < column specification > DESC
- " " DISPLAY"reference X3.135-1989 section 8.3 General Rules 3)
- " b)" DISPLAY" - - - - - - - - - - - - - - - - - - -" DISPLAY" *** FOR SELECT java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 MOVETO DISPLAY" ** WHEREPNUM'2 " DISPLAY" *** ORDER BY EMPNUM DESC " DISPLAY" "
EXEC"declare with ORDER BY <columnspecification DESC SELECT,HOURS FROM WHERE PNUM='P2' ORDER EMPNUM EXECSQLOPEN X "**FORSELECTEMPNUM,HOURS " MOVESQLCODETO SQL-COD"**WHERE PNUM='P2' "
MOVE1TO" PERFORM X CURSOR DISPLAY"EMPNO"", i=", i " DISPLAY"The answer WORKS DISPLAY" order by EMPNO DESC. "
if EMPNO""AND i = 4then DISPLAYEXECOPENXEND-EXEC DISPLAY "= SQLCODE SQL-COD EXECSQLINTO
VALUES PERFORMUNTIL >14 MOVETOSQL-COD else DISPLAY" dml001.pco *** fail ***"
java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20 "=======java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 SQLINTOjava.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
VALUESDISPLAY"***pass**" ADD1TO errcnt MOVESQLCODE=========================== END-IF DISPLAY" SQLCODE SQL-COD MOVE"dml001pco** fail ***"
******************** END TEST0001 ******************* ******************** BEGIN TEST0002 *******************
MOVE0TO i
EXECSQLINTOjava.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44 DISPLAYdeclare integer DISPLAY"reference X3.135-1989 section 8.3 General Rules 3)
-" b)java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16 DISPLAY"-- " DISPLAY DISPLAY" *** SQL COMMIT WORK END-EXEC
RE ='P2'" DISPLAY" *** ORDER BY 2 ASC " DISPLAY******************** END TEST0001 *******************
EXECSQL FOR EMPNUM FROM WORKS WHERE ='P2' ORDERBY" with ORDER BY unsigned integer > ASC " EXECOPENjava.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
b"
DISPLAYDISPLAY ** FROM java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45 DISPLAY"The "**ORDER2" DISPLAY" order by HOUR1 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 ifi=4ANDHOUR1=80)then DISPLAY" *** pass ***" DISPLAY "================================ EXECBY2ASC
VALUES'pass,') END-EXEC MOVESQLCODE java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34 else DISPLAYdml001fail DISPLAY "============================= EXECSQLDISPLAY Thebe&"
VALUESfail END-EXEC ADD1TO ( =4AND = 80) then MOVESQLCODE END-IF " EXEC WORK MOVESQLCODETOMOVESQLCODETO
******************** END TEST0002 ******************* ******************** BEGIN TEST0003 *******************
0 i
DISPLAYTEST0003 DISPLAY"declare with ORDER BY < sort specification > ... " DISPLAY"reference X3 SQLCODE SQL-COD
- " "" "-- -----------------java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
DISPLAY******** END TEST0002 ************ ******************** BEGIN TEST0003 ******************* DISPLAY * WORKS DISPLAYDISPLAY"eferenceX31351989section 83 Rules ) DISPLAY"** ORDER BY 2DESCEMPNUMDESC" DISPLAY" "
EXECSQL DECLARE Z CURSOR FORSELECT EMPNUM DISPLAY" - - - " "** FORSELECT EMPNUM,HOURS java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52 WHERE PNUM='P2' ORDER2, DESC EXECSQLOPEN"** WHEREPNUM='P2' " MOVE java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
MOVE1TO PERFORMUNTIL > 14
DISPLAYThe 4 i=",i"&" DISPLAY" order by HOUR1 DESC, EMPNO DESC." if (i WHEREPNUM DISPLAY**pass DISPLAY "===== SQL Z java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35 SQLINTOTESTREPORT
('0003',pass''' java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51 MOVETO else " order by DESC, EMPNO DESC" DISPLAY "= " * ***" EXEC java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
VALUES('0003','fail ('0003''ass 1TO MOVESQLCODETO END-IF DISPLAY" " EXEC============================" MOVESQLCODETO SQL-COD
******************** END TEST0003 ******************* ******************** BEGIN TEST0004 *******************
MOVE errcnt DISPLAY DISPLAYDISPLAY"" DISPLAY"reference X3.135-1989EXECSQLCOMMITWORK END-EXEC DISPLAY------- -- ------java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63 DISPLAY" *** FOR SELECT WORKS.EMPNUM ******************** BEGIN TEST0004 ******************* DISPLAY * FROM" DISPLAY" *** WHERE WORKSDISPLAY " " X3.1351989 8.3General Rules 2" DISPLAY" *** SELECT STAFF.EMPNUM " DISPLAY"***FROM STAFF " DISPLAY" *** WHERE STAFF.GRADE=13 " DISPLAY * BY DESC" DISPLAY" "
EXECSQL DECLARE A CURSOR FOR . FROM WORKS WHERE WORKS.PNUM " ** SELECT STAFF.EMPNUM "
SELECT STAFF. "** WHERE STAFF.GRADE=3" FROMjava.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25 SQL A CURSOR ORDERFOR WORKS
WORKS MOVESQLCODE java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
MOVE1TO STAFF PERFORMUNTIL > 14
DISPLAY" i = ",WHERE.GRADE DISPLAYThe be5& BY DESC if (i = 5ANDSQL A END-EXEC DISPLAY" *** pass *** DISPLAY "=============================java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68 EXECSQLINSERTINTO uld i = 5& ORDER DESC"
VALUES('0004','pass','PCO') END-EXEC MOVESQLCODETO SQL-COD else DISPLAY" SQLINSERTINTOTESTREPORT DISPLAY "===============================java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68 EXECSQLINSERTINTO TESTREPORT dml001dml001*fail
===========================java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68 ADD1TO errcnt MOVE SQL-COD END-IF DISPLAY" EXECSQLCOMMITMOVESQLCODE SQL-COD MOVESQLCODEDISPLAY java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
******************** END TEST0004 ******************* ******************** BEGIN TEST0005 *******************
MOVE00TO
DISPLAY" TEST0005 " DISPLAY" declare with UNION ALL " "eference X3.135-1989 8.3 GeneralRules2)java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71 DISPLAY -------- ---- " DISPLAY" * SELECTWORKSEMPNUM" DISPLAY" *** FROM WORKS " DISPLAY" *** WHERE WORKS.PNUM='P2' " DISPLAY * " DISPLAY" * STAFF.EMPNUM " DISPLAY" *** FROM STAFFDISPLAY " * ALLjava.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38 DISPLAY" DISPLAY "** FROM" DISPLAY""
EXECSQL DECLARE B java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 FORSELECTFOR WORKS FROM WORKS WHERE.PNUM=''
UNION ALL SELECT STAFF.EMPNUM FROM STAFF STAFF WHERESTAFF=13END-EXEC EXECSQLOPEN B END-EXEC MOVETO
MOVESQL B END-EXEC
P46 ii14
DISPLAY" The correct DISPLAYThe have. if (i = 6) then P46 ii
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 DISPLAY
=====================" EXECINSERT java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
VALUESDISPLAY
else "dml001.pco ***fail ***" DISPLAY "==============================java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68 EXEC dml001*
java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20 ADD1TO MOVEINSERT TESTREPORT END-IF DISPLAY" " EXECSQLWORK MOVESQLCODETO SQL-CODSQLCODETO
******************** END TEST0005 ******************* ******************** BEGIN TEST0158 *******************
MOVE0TO i
DISPLAY"TEST0158 " DISPLAY" declare with UNION " DISPLAY******************** BEGIN TEST0158 ******************* DISPLAY" - ---------------- --" DISPLAY" *** SELECT EMPNAME,PNUM,HOURS " DISPLAY * FROM,WORKS DISPLAY"declare with UNION " DISPLAYDISPLAY" X3.351989 8.GeneralRules2" DISPLAY" *** SELECT EMPNAME,PNUM,HOURS " DISPLAY * STAFF " DISPLAY" *** WHERE NOT EXISTS " DISPLAY" *** (SELECT HOURS " DISPLAY" *** FROM "**WHERE.EMPNUM .EMPNUMjava.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65 DISPLAYDISPLAY"**FROMSTAFF,WORKS " DISPLAY" "
EXECSQL"** ( HOURS "
EMPNAME FROM"**WHERESTAFFEMPNUM=WORKSEMPNUM" WHERE STAFF""
UNION SELECT EMPNAME SQL CC FROMFOR EMPNAME,HOURS WHERE EXISTS
(SELECT FROM WORKS WHERE STAFFEMPNUM.EMPNUM EXECSQLSELECT,PNUM
ODE SQL-COD
MOVE1TO ii PERFORM P45 UNTIL ii(SELECT
DISPLAY answer;i" if21) then "* **" DISPLAY 1TOjava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23 SQL TESTREPORT
VALUES('0158',if( )then MOVESQLCODETO SQL-COD else DISPLAY" dml001.pco java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20 DISPLAY "===========================java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68 EXECINSERT TESTREPORT
VALUES SQLCODE SQL-COD ADD1TO errcnt .pco ** MOVESQLCODETO========================" END-IF DISPLAY" " EXECSQLCOMMIT WORK('0158''''' java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51 MOVESQLCODE SQL-COD
******************** END TEST0158 ******************* ******************** BEGIN TEST0159 *******************
MOVE
DISPLAYwith DISPLAY" declare with UNION " DISPLAY"reference X3.135-1989 section 8.3 General Rules 2)" DISPLAY" - - - - - - - - *FROMWORKS" DISPLAY" *** "* " DISPLAY* FROM" DISPLAY" DISPLAY" *** UNION " DISPLAY *SELECT java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59 DISPLAY"* BY 31 " DISPLAY" SQLDECLARE D java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36 DISPLAYFROM DISPLAY * ,EMPNUM DISPLAY" *** FROM WORKS PNUM,,HOURS DISPLAY"** HOURS=20 " DISPLAY HOURS
EXECSQL DECLARE PNUM,HOURS FORSELECT PNUM,EMPNUM,HOURS HOURS ORDERBY , java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 27
UNION SQLCODE SQL-COD SELECT PNUM,EMPNUM,HOURS
java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23 WHERE P44 iijava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18 SELECT,EMPNUM FROMDISPLAY *pass WHERE HOURS=20
EXECSQLSQLINTOTESTREPORT MOVESQLCODETO SQL-COD
MOVE1TO ii SQLCODE SQL-COD PERFORM P44 UNTIL ii > 39
DISPLAY" The correct answer should be i=10,i=", if = 10)java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29 DISPLAY ** pass DISPLAY
('0159',fail,PCO EXECSQL1 errcnt
VALUESpass)END-EXEC MOVESQLCODEEND-IF else DISPLAY" dml001.pco *** fail ***"
"================== SQLCODE TOSQL-COD
VALUES('0159','fail','PCO******************* ADD1TO errcnt MOVESQLCODETO SQL-COD
java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17 DISPLAY" "
EXECSQLDISPLAY" X3.135-1989section8.3GeneralRules2)java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71 MOVE java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
******************** END TEST0159 ******************* ******************** BEGIN TEST0160 *******************
MOVEDISPLAY"** UNION java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
DISPLAY"** HOURS=80) " "** UNION ALL " DISPLAY * ,, DISPLAY"** FROM WORKS " DISPLAY" *** FOR (SELECT PNUM,EMPNUM,HOURS " DISPLAY * FROM" DISPLAY" *** UNION " * BY2, java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41 DISPLAY * SELECTHOURS DISPLAY" *** FROM WORKS "
RS80)" DISPLAY" *** UNION ALL " DISPLAY **SELECTHOURS DISPLAY java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18 DISPLAY" *** WHERE HOURS=12 " DISPLAY" ***WHEREHOURS80java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
EXEC DECLARE FOR (SELECT PNUM WORKS FROM WORKS HOURS12
UNION SELECT,EMPNUM FROM WORKS EXECSQLOPEN E END-EXEC
UNION ALL SELECT,EMPNUM,java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37 FROM WORKSP43 ii WHERE answer " BY2END-EXEC
SQL MOVESQLCODE
SQLINTOTESTREPORT PERFORMUNTIL >
SQLCODE SQL-COD if (i = 14) then DISPLAY" *** pass ***"
java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20 "============================= EXECADD1 errcnt
VALUES,''' java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51 MOVESQLCODETO else DISPLAY"dml001pco *** fail**" DISPLAY "============================" EXECSQLINSERTjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
ADD1TO errcnt MOVESQLCODETO SQL-COD END-IF
DISPLAY" EXECCOMMIT WORK MOVETO
******************** END TEST0160 *******************
**** TESTER MAY CHOOSE TO INSERT CODE FOR errcnt > 0 STOP.
* **** Procedures for PERFORM statements
P50. EXEC FETCH :,:HOUR1 MOVESQLCODETO SQL-COD if MOVETOjava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27 DISPLAY" EMPNO=", EMPNO SQLCODETO
-"" END-IF ADD1TO ii
.
P49 "EMPNO"" and =", HOUR1 EXEC Y :,:HOUR1 MOVESQLCODETO1
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 MOVE ii TO i DISPLAY" EMPNO=,EMPNO"andHOUR1=,HOUR1 END-IF
1TO
.
P48 EXECSQL FETCH"EMPNO",EMPNO =", HOUR1 java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72 MOVETO if (SQLCODE = 0) thenTO ii MOVE DISPLAY =",EMPNO"andHOUR1 "
- "" END-IF ADD1TO ii
.
P47. EXEC (SQLCODEthen MOVESQLCODE java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36 if (SQLCODE = 0) then MOVE ii 1TO DISPLAY"java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 END-IF ADD1TO ii
.
P46. EXEC FETCH :EMPNO MOVESQLCODETO SQL-COD TO if )then MOVE- java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14 DISPLAY"EMPNO=", EMPNO.
- " " END-IF 1TO
.
P45. EXEC FETCH INTOEMPNM1:,:HOUR1 MOVESQLCODETO SQL-COD if (SQLCODE = 0) then"=", EMPNM1= "=", MOVE ii TO DISPLAY"empname=,EMPNM1 ";pnum"hours=",
HOUR1 END-IF ADD1TOii
.
P44. EXEC FETCH :,:EMPNO END-EXEC MOVESQLCODETO SQL-COD ( = 0) java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
(SQLCODE java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36 MOVE iiHOUR1 DISPLAY"pnum=", PNO1 "; empnum=", EMPNO ii
HOUR1 END-IF ADD1TO ii
P43. EXECSQL FETCH (SQLCODE)then
QLCODE SQL-COD if (SQLCODE = 0) then MOVE i DISPLAY" pnum=", PNO1 "; empnum=", EMPNO "; hours=",
HOUR1 END-IF ADD1TO ii
.
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.8Bemerkung:
¤
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.