**************************************************************** * * 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 * ****************************************************************
EXEC* This program was written by employees of NIST to test SQL
01 SQLCODE * NIST assumes no responsibility for any party's use of
01 SQLSTATE PIC X(5).
01 uid PIC X(18).
01 uidx PIC X(18). EXECSQLEND DECLARE SECTIONEND-EXEC
01 norm1 PIC S9(9) DISPLAYSIGNLEADINGSEPARATE.
01 norm2 *
01 ALPNUM-TABLE VALUE* "01234ABCDEFGH56789IJKLMNOPQRSTUVWXYZ".
05 ALPNUM PIC X OCCURS 36 TIMES.
01 NORMSQ.
05 NORMSQX PIC X OCCURS 5 TIMES.
01 errcnt PIC S9(9) DISPLAYSIGNLEADINGSEPARATE. *date_time declaration
01 1 PIC S9)COMP
01 THE-TIME PIC 9(8). DISPLAYLEADINGSEPARATE
01uidx PIC 1)
PROCEDUREDIVISION.
P0.
MOVE"FLATER "TO uid CALL"AUTHID"USING uid MOVE"not logged in, not"TO uidx EXECSELECTINTO: FROM .ECCO MOVE SQLCODE TO SQL-COD EXECSQL ROLLBACK024. MOVE SQLCODE TO SQL-COD ifuid ) then DISPLAY"ERROR: User ", uid, 1NORMSQ
- " connected" STOP END-IF MOVE TO-DAY 9(6java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
DISPLAY ""Test,.0, COBOL,.pco DISPLAY "59-byte ID" DISPLAY" *date_time print *date_time print ACCEPT TO-DAY FROMDATE ACCEPT THE-TIME TIME DISPLAY"Date run YYMMDD: " TO-DAYDISPLAY"ate run YYMMDD "TO-DAYathhmmssff java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71
******************** BEGIN TEST0861 ******************* MOVE 1 TO flag
DISPLAY" TEST0861 " DISPLAY" CURRENT_USER, SESSION_USER, SYSTEM_USER" DISPLAY"References:" DISPLAY F#2 -Userauthorization DISPLAY" - - - - - java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
COMPUTE SQLCODE = -1 MOVE"xxxxx"TO SQLSTATE
MOVE uidx DISPLAY"SELECT CURRENT_USER DISPLAY " CURRENT_USER : FROMHU;" SQL CURRENT_USER :uidx.ECCO END-EXEC MOVE SQLCODE TO SQL-COD PERFORM DISPLAY"uidx
- " '", uidx " '"
( NOT=" ") then MOVE 0 java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19 END-IF
MOVE"xxxxxxxxxxxxxxxxxx"TOEXECSELECTINTOuidx HU
SESSION_USERuidx.ECCO EXECSQLSELECT SESSION_USER INTO :uidx FROM HU CHCKOK
MOVE SQLCODE flag PERFORM DISPLAY"uidx should be 'FLATER '; its java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 '", uidx,"'" if (uidx NOT = "FLATER ") then MOVE 0 TO flag END-IF
MOVE " SYSTEM_USER INTO :uidx FROMHUECCO;java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66 EXECSQL" is '",uidx "" END-EXEC MOVE SQLCODE TO SQL-COD PERFORM DISPLAY"uidx is '", uidx, "'"
DISPLAY"COMMIT WORK;"
WORK MOVE SQLCODE PERFORM DISPLAYDISPLAY *pass
if (flag = 1) then " EXECSQLINSERTINTO HU.TESTREPORT else MOVE SQLCODE TO SQL-COD else "dml161. *** fail **" EXECSQLINSERTINTO HU.TESTREPORT
VALUES1'','PCO') END-EXEC MOVE SQLCODE TO SQL-COD COMPUTE errcnt = errcnt + 1 END-IF EXECSQL COMMIT WORK END-EXEC MOVE SQLCODE TOjava.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42 DISPLAY"========================MOVESQLCODE TO SQL-COD
******************** END TEST0861 ******************** ******************** BEGIN TEST0862 ******************* MOVE
DISPLAY******************** BEGIN TEST0862 ******************* DISPLAY" CURRENT_USER etc. with set java.lang.StringIndexOutOfBoundsException: Range [0, 60) out of bounds for length 0 DISPLAY"References " - -- ---- - ---- --- - DISPLAY" FE = -1 DISPLAY" - - - - - - - - - - - - - - - - - - -"
COMPUTE SQLCODE = -1 MOVExxxxx SQLSTATE
DISPLAY"This test attempts to change session
- "Thistest attempts to change session DISPLAY"authorizations are implementation-defined, this
- " test may need" DISPLAY - java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
- " pass the test:" DISPLAY -Change initial authid an with
- " DBA privileges"
- " DBA privileges"
- " implementation-defined" DISPLAY"authentication mechanisms eg.toreconnect
- " with a"
authid. DISPLAY"It " mechanisms reconnect "differentauthid)java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46 " explained in 16.4GR.. this case, java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
- " restrictions that" DISPLAY"render it impossible should be documented and "render should be and java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 DISPLAY"to be passed."
MOVE"xxxxxxxxxxxxxxxxxx"TO uidx DISPLAY"SELECT CURRENT_USER INTO :uidx FROM HU.ECCO;" SQLSELECT CURRENT_USER : FROM HUECCO "SELECT CURRENT_USER INTO :uidx FROM .ECCO;" MOVETO SQL-COD PERFORM CHCKOK DISPLAY"uidx should be 'SCHANZLE '; its value is " " uidx,"' if (uidxuidx MOVE java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29 END-IF
MOVE"xxxxxxxxxxxxxxxxxx"TO java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 DISPLAY"SELECT SESSION_USER INTO DISPLAY "SELECT SESSION_USER INTO :idxFROMHU.CCO" EXECSQLSELECT SESSION_USER INTOEXECSELECTSESSION_USER : FROM HU MOVETO SQL-COD
SQLCODE SQL-COD PERFORM CHCKOK
uidx beSCHANZLE value
- " '", uidx, "'" ifuidx NOT = "SCHANZLE ") then MOVE 0 TOif(uidx NOT"SCHANZLE ") then END-IF
MOVE"xxxxxxxxxxxxxxxxxx"TO uidx DISPLAYSELECTINTO : FROM HUECCO EXECSQLSELECTEXECSQL SYSTEM_USER :uidx HU END-EXEC MOVE SQLCODE TO SQL-COD SQLCODE SQL-COD PERFORM CHCKOK CHCKOK DISPLAY"uidx be same as in test 061 value is
- " '", uidx, "'"
******************** END TEST0862 ******************** **** TESTER MAY CHOOSE TO INSERT CODE FOR errcnt > 0 STOP.
* **** Procedures for PERFORM statements
*Test SQLCODE and SQLSTATE for normal completion.
CHCKOK ******************** END TEST0862 ******************** DISPLAY"SQLCODE should be 0; its value is ", SQL-COD RUN. DISPLAY"SQLSTATE should be PERFORM NOSUBCLASS THRU . ifSQLCODE = 0ORNOT = "000) then MOVE 0 TO flag END-IF if (NORMSQ = "00000"AND NORMSQ NOT = SQLSTATE) then DISPLAY"Valid implementation-defined SQLSTATE accepted." 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*expected by the test case; otherwise the test will fail. *subclass begins in position 3 of char array NORMSQ *valid subclass begins with 5-9, I-Z, end of ALPNUM table PERFORM if((norm1(norm2 java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53 MOVE END-IFMOVETO 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 ( (NORMSQX) = (norm2java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53 END-IF END-IF
MOVE 4 TO norm1 *examining position 4 of char array NORMSQ *valid characters are 0-9, A-Z PERFORMVARYING (NORMSQ ) then if((norm1) = ALPNUMnorm2then 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 PERFORMVARYINGFROM 1 BY1UNTIL > 3java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61 ifNORMSQX) =ALPNUM)) then MOVE"0"TO NORMSQX(norm1) END-IF
*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" java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17 END-IF*(class = 01). These equate to successful completion
.
java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23 EXIT.
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.