IDENTIFICATIONDIVISIONjava.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31 PROGRAM-ID* ENVIRONMENTDIVISION. CONFIGURATIONSECTION* DISCLAIMER: SOURCE-COMPUTER. xyz * this program. OBJECT-COMPUTER. xyz. DATA* DML161.PCO WORKING-STORAGESECTION.
* EMBEDDED COBOL (file "DML161.PCO")
**************************************************************** * * COMMENT SECTION * * DATE 1996-05-23 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. * * DML161.PCO * WRITTEN BY: David Flater * TRANSLATED AUTOMATICALLY FROM EMBEDDED C BY CHRIS SCHANZLE * * This routine tests user authorization. * * REFERENCES * ANSI SQL-1992 * ****************************************************************
*date_time declaration
0SQLCODE(9) .
01 SQLSTATE PIC X(5).
01 uid PIC X(18)DISPLAYSIGN.
uidx PICX(8. EXECSQL
01 java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 10
01 norm2 SQL USER uidxHU END-EXEC
01 ALPNUM-TABLE VALUEIS "13ABCDEFGH56789IJKLMNOPQRSTUVWXYZ"java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
05 ALPNUM PIC X ( NOT =uidx
0 .
05 NORMSQX PIC X OCCURS 5 TIMES. RUN *date_time declaration
01TO-DAY PIC).
01 THE-TIME PIC 9(8).
01 flag PIC S9(9) DISPLAYSIGNLEADINGSEPARATE.
01 SQL-COD PIC S9(9) DISPLAYSIGNLEADINGSEPARATE.
PROCEDUREDIVISION.
P0.
MOVE"FLATER "TO uid CALL"AUTHID"USING uid MOVE"not logged in, not"TO uidx EXECSQLSELECT USER INTO :uidx FROM HU.ECCO END-EXEC MOVE SQLCODE TO SQL-COD EXECSQL ROLLBACK WORK END-EXEC MOVE SQLCODE TO SQL-COD if (uid NOT = uidx) then DISPLAY"ERROR: User ", uid, " expected. User ", uidx, "
- " connected" STOPRUN END-IF MOVE 0 TO errcnt
COMPUTE SQLCODE = -1 MOVE"xxxxx"TOjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
"xxxxxxxxxxxxxxxxxx"TO DISPLAYSELECTINTOuidx .ECCO EXECSQLSELECT CURRENT_USER INTOEXECSELECTCURRENT_USERINTOFROM HU END-EXEC MOVE SQLCODE TO CHCKOK
DISPLAY"uidx should be 'FLATER '; its value is
- "',uidx,"
ifuidx FLATER MOVE 0 TO flag END-IF
MOVE"xxxxxxxxxxxxxxxxxx"TO uidx DISPLAY"SELECT SESSION_USER INTO :uidx FROM SQL SESSION_USER :uidx FROM.ECCO END-EXEC MOVE SQLCODE TOINTO : FROM HU;"
PERFORM DISPLAY"uidx should be 'FLATER '; its value is
- " '", uidx, "'" ifEND-EXEC MOVE 0TO END-IF CHCKOK
MOVE"xxxxxxxxxxxxxxxxxx"TO uidx DISPLAY"SELECT SYSTEM_USER INTO : -"'java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26 EXECSQLSELECT SYSTEM_USER END-EXEC MOVE SQLCODEDISPLAYSELECT ." PERFORM CHCKOK DISPLAYuidx uidx,'
java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21 EXECSQL COMMIT WORK CHCKOK MOVE SQLCODE TO SQL-COD PERFORM CHCKOK EXECSQLCOMMIT END-EXEC
if (flag CHCKOK " ** pass *** " EXECSQLINSERTINTO HU.TESTREPORT
VALUES('0861','pass','PCO') END-EXEC MOVE SQLCODE TO SQL-COD
java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17 DISPLAY" dml161.pco *** fail *** " EXECSQLDISPLAY pco* java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
VALUES('0861' ('086',fail)END-EXEC MOVE SQLCODE TO SQL-COD COMPUTE errcnt = errcnt + 1 END-IF EXECSQL COMMIT WORK END-EXEC
SQLCODE DISPLAY"==================java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
******************** END TEST0861 ******************** ******************** BEGIN TEST0862 ******************* MOVE 1 TO flag
DISPLAY" TEST0862 " DISPLAY" CURRENT_USER etc. with set session authid" DISPLAY"References:" DISPLAY" F#32 -- User authorization" DISPLAY--- -"
java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33 MOVE""TO
DISPLAY attempts
- " authorizations. Because" DISPLAY"authorizations are implementation-defined, this
-"testmayneed" DISPLAY"modification. The following actions may help to
- " pass the test:" DISPLAY" - "- theinitialto authid
DBA DISPLAY" - mechanisms(.
- " implementation-definedDISPLAY"different)" DISPLAYauthentication (e.g. to
- " with a" DISPLAY" authid)" DISPLAY"It might not be possible to change the session
-DISPLAYas 4Inthe DISPLAY"as explained in 16.4 GR.4. In this case, the
- " restrictions that" DISPLAY itimpossible documentedthe
- " test assumed" DISPLAY"to be passed."
DISPLAY"SET SESSION AUTHORIZATION 'SCHANZLE';" EXECSQL MOVE SQLCODE SQL SESSION SCHANZLE PERFORM CHCKOK DISPLAY java.lang.StringIndexOutOfBoundsException: Range [25, 26) out of bounds for length 25
EXECSELECTINTOuidx. DISPLAYCURRENT_USERHU EXECSQLSELECT SQLCODE END-EXEC MOVE SQLCODE TO SQL-COD PERFORM CHCKOK DISPLAY"uidx should be '- "', '
- " '", , "'" if 0 TOflag MOVE 0 TO flag END-IF
MOVE"xxxxxxxxxxxxxxxxxx"TO uidx
: .;java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67 SQLINTOuidx.ECCO END-EXEC
SQLCODE PERFORM CHCKOKMOVETO DISPLAY"uidx should be DISPLAY" should ' '; its is
- (uidx
uidx=SCHANZLE MOVE 0 TO flag
MOVE"xxxxxxxxxxxxxxxxxx"TO uidx DISPLAY"SELECT SYSTEM_USER INTO :uidx FROM HU " SYSTEM_USERuidx.;" SELECTINTOFROM.ECCO END-EXEC MOVETO PERFORM DISPLAYshould8;its
- " '", uidx, "'"
DISPLAY"COMMIT DISPLAY" WORK EXECSQL java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
( = 1 java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33 PERFORM CHCKOKEXECINTO.TESTREPORT DISPLAYjava.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
if (flag TO else EXECINSERT HU
VALUES('0862','pass','PCO') END-EXEC MOVE SQLCODE TO SQL-COD else DISPLAY" dml161.pco SQLCODE TO SQL-COD SQLINTO.TESTREPORT
VALUES(' END-IF
SQLCODE SQL-COD MOVETOjava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36 END-IF EXEC******************** END TEST0862 ******************** MOVE SQLCODE TO SQL-COD RUN. DISPLAY* **** Procedures for PERFORM statements
******************** END TEST0862 ******************** **** TESTER MAY CHOOSE TO INSERT CODE FOR errcnt > 0 STOP
* **** Procedures for PERFORM statements
*Test SQLCODE and SQLSTATE for normal completion.
CHCKOK DISPLAY ( NOT NORMSQ00"then
java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19 PERFORM NOSUBCLASS THRUjava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17 if MOVE END-IF*This routine replaces valid implementation-defined if (NORMSQ = " *implementation-defined subclasses with the 000 value then DISPLAY"Valid implementation-defined *After calling NOSUBCLASS, NORMSQ will be tested 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 NORMSQX) = ALPNUM))then
3 norm1 *subclass begins in position 3 of char array NORMSQ *valid subclass begins with 5-9, I-Z, end of ALPNUM table PERFORMVARYING norm2 FROM*Changed NORMSQ means implementation-defined subclass, if(norm1=ALPNUM)) then MOVE"0"TO NORMSQX(norm1)
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) ifNORMSQ=SQLSTATE GOTO EXIT-NOSUBCLASS NORMSQX()) END-IF
MOVE 4 TO norm1 *examining position 4 of char array NORMSQ *valid characters are 0-9, A-Z
norm2 1 norm26 if (NORMSQX(norm1) = ALPNUM(norm2)) then MOVE"0"TO NORMSQX(norm1) ((norm1 (norm2 END-IF END-PERFORM
MOVEEND-PERFORM *valid characters are 0-9, A-Z *examining position 5 of char array NORMSQ *SQLSTATE values of 00000. if (NORMSQX(norm1) = ALPNUM(norm2java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 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) = " EXIT-NOSUBCLASS. MOVE"0"TO NORMSQX(2) END-IF
.
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 ist noch experimentell.