*over the World Wide Web in order to promote SQL standards. PROGRAM-ID. XTS726. ENVIRONMENTDIVISION. CONFIGURATIONo the SQL standards. SOURCE-COMPUTER. xyz. OBJECT-COMPUTER. xyz. DATADIVISION. WORKING-STORAGESECTION.
* EMBEDDED COBOL (file "XTS726.PCO")
*Copyright 1995 National Computing Centre Limited *and Computer Logic R&D S.A *on behalf of the CTS5 SQL2 Project. *All rights reserved. *The CTS5 SQL2 Project is sponsored by the European Community. * *The National Computing Centre Limited and Computer Logic R&D *have given permission to NIST to distribute this program *over the World Wide Web in order to promote SQL standards. *DISCLAIMER: *This program was reviewed by employees of NIST for *conformance to the SQL standards. *NIST assumes no responsibility for any party's use of *this program.
* Flagging - Full SQL - cursor with FOR UPDATE and ORDER BY * * COMMENT SECTION * * SQL VALIDATION TEST SUITE V6.0 * * XTS726.PCO * WRITTEN BY: Nickos Backalidis * TRANSLATED AUTOMATICALLY FROM EMBEDDED C BY CHRIS SCHANZLE * * Flagging - Full SQL - cursor with FOR UPDATE and ORDER BY * * REFERENCES * 13.1 -- <declare cursor> * 13.9 -- <update statement: positioned> * 13.10 -- <update statement: searched> * 13.9 SR.4 * F#37 -- Intermediate SQL Flagging * * DATE LAST ALTERED 14/12/95 CTS5 Hand-over Test * * Cleanups and fixes by V. Kogakis 04/12/95: * Change values returned from table CL_STANDARD * (JIM > MORRIS) * * QA Status: QA CHECK * * Revised by DWF 1/31/96 * Removed status checks after cursor definition * Fixed char string lengths * Fixed misinterpretations of SQL-92 * Harmonized printfs with executed statements * Corrected expected results ****************************************************************
EXECSQL BEGIN DECLARE SECTIONEND-EXEC 01SQLCODEPIC S9(9) COMP. 01 SQLSTATE PIC X(5). 01 uid PIC 01 norm2 PIC S9DISPLAYSEPARATEjava.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57 01 uidxPIC X()java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27 01 c_num1 PIC S9(9) DISPLAYSIGN NORMSQ. 01 c_num2 PIC errcntPIC(9DISPLAYSIGN . 01 c_ch1 PIC X(10). 01 c_ch2PIC (). SQL DECLARE 01 norm1 PIC S9(9) 01 flag PIC S9(9) DISPLAY (9DISPLAY java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56 01 norm2 PIC S9(9) DISPLAYSIGNLEADINGSEPARATE. 01" uid "01234". 05 ALPNUM PIC X OCCURS36 TIMES. 01NORMSQjava.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18 05 NORMSQX PIC X OCCURS5 TIMES. 01 errcnt PIC S9(9) DISPLAYSIGNLEADINGSEPARATE. *date_time declaration
TO-DAY PIC9(). 01 THE-TIME PIC9(8). 01 flag MOVE SQLCODE
PIC S9() SIGNLEADINGSEPARATEjava.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
PROCEDUREDIVISION.
java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 10
MOVE"CTS1 END-IF CALL"AUTHID"USING java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 0 MOVE"not logged in, not" java.lang.StringIndexOutOfBoundsException: Range [20, 21) out of bounds for length 20 EXEC*date_time print MOVESQLCODETO SQL-COD EXECSQLROLLBACKWORK MOVESQLCODETO SQL-COD if" YYMMDD:"TO-DAY"athhmmssff:" DISPLAY"ERROR: User "1TOflag
- " connected" RUN END-IF MOVE0TO errcnt
- BY DISPLAY "59-byte ID" DISPLAY"131- declare cursor>" *date_time print ACCEPT TO-DAY FROMDATE ACCEPT THE-TIME FROMTIME DISPLAY"Date run YYMMDD: " TO-DAY " . SR. java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
***************** BEGIN TEST7026 ***************** MOVE1TO flag
*use table CL_STANDARD from the standard schema *Use Valid Intermediate SQL & declare a cursor *for UPDATE only DISPLAY"Valid Intermediate SQL syntax:" DISPLAY" ALPHA SELECT COL_NUM1,java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64 "OL_CH1COL_NUM2,OL_CH2" DISPLAY"FROM CL_STANDARD " DISPLAY"WHERE COL_NUM1 = 1004 AND COL_CH1 = 'MORRIS'" DISPLAY"FOR PERFORM java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25 EXEC*initialise host variables
COL_CH1,COL_NUM2,COL_CH2 FROM CL_STANDARD WHERE COL_NUM1 = 1004AND COL_CH1 = 'MORRISMOVE TO c_num1 OF COL_CH1 COL_NUM2END-EXEC
*initialise host variables MOVE"xxxxxxxxxx"TO c_ch1 MOVE"xxxxxxxxxx"TO c_ch2 MOVE0c_num1 MOVE0TO c_num2 DISPLAY"FETCH ALPHA INTO :c_num1, :c_ch1, :c_num2,
- " :c_ch2;" EXECSQL *use an <update statement:positioned and modify row END-EXEC SQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"Values of the columns BEFORE the UPDATE:" DISPLAY"COL_NUM1 = ", c_num1, " COL_CH1 = ", c_ch1 DISPLAY"COL_NUM2 = ", c_num2, " COL_CH2 = ", c_ch2 DISPLAY" "
*use an <update statement:positioned and modify row *that satisfies the <search condition> of the query DISPLAY"UPDATE CL_STANDARD" DISPLAY"SET COL_CH1 = 'ELLIE', COL_NUM2 = COL_NUM2 + 10"MOVE DISPLAY"WHERE CURRENT OF ALPHA;" EXECSQL UPDATE CL_STANDARD CLOSE ; SET'LLIE'COL_NUM2 =COL_NUM2 +10 WHERE CURRENT OF ALPHA END-EXEC MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY" "
*close the cursor DISPLAY"CLOSE MOVE "xxxxxxxxxx" TO EXECSQLCLOSE ALPHA END-EXEC MOVESQLCODETO PERFORM CHCKOK DISPLAY" "
*use a <select statement: single row> and check that *the row has been successfully modified DISPLAY"SELECT COL_NUM1,COL_CH1,COL_NUM2,COL_CH2" DISPLAY"INTO :c_num1, c_ch1, c_num2, c_ch2" DISPLAY"FROM CL_STANDARD" "HERE 1004;" EXECSQLSELECT COL_NUM1,COL_CH1,java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 36
c_num1,c_ch1:: FROM CL_STANDARD WHERECOL_NUM1=1004END-EXEC MOVESQLCODETO SQL-COD
CHCKOK DISPLAY"Values of the row after the UPDATE :"DISPLAY COL_NUM2be4014;is" " DISPLAY"COL_NUM1 should be 1004; it is ", c_num1, " " DISPLAY"COL_CH1 should be ELLIE; it is ", c_ch1, " " DISPLAY"COL_NUM2 should be 4014; it is ", c_num2, " "0 flag DISPLAY" should PARGA;it "" " if (c_num1 NOT = 1004OR c_ch1 NOT = "ELLIE"OR
c_num2 NOT = MOVE0TO flag END-IF if (c_ch2 NOT = "PARGA") then MOVE0TO flag END-IF DISPLAY" "
*restore CL_STANDARD in its original state DISPLAY"ROLLBACK *Subtest 2 EXECSQLROLLBACK WORK END-EXEC MOVESQLCODETO SQL-COD
CHCKOK DISPLAY" "
*Subtest 2 DISPLAY"FULL SQL SYNTAX:" DISPLAY"DECLARE BETA CURSOR FOR SELECT" DISPLAY"COL_NUM1 EXEC SQL BETACURSOR FOR SELECTjava.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
java.lang.StringIndexOutOfBoundsException: Range [36, 20) out of bounds for length 44 DISPLAY"ORDER BY COL_NUM2 DESC FOR UPDATE OF COL_CH1; ORDER COL_NUM2 DESC FORUPDATEOFCOL_CH1 END-EXEC EXECSQL DECLARE BETA CURSOR FORDISPLAY" BETA;java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
COL_NUM1,COL_CH1,COL_NUM2 FROM CL_STANDARD WHERE COL_NUM1 = 1001 ORDERBY COL_NUM2 DESC FOR UPDATE OF COL_CH1 END-EXEC
"ETCH :_,c_ch1,: ;java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65 ifc_num1 =1001OR = "MARIA"OR MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"COL_NUM1 should be 1001 it is ", c_num1, " "" DISPLAY"COL_CH1 should be MARIA it is ", c_ch1, " " DISPLAY"COL_NUM2 should be 4001 it is ", c_num2, " " if (c_num1 NOT CL_STANDARD
c_num2 NOT = 4001) then MOVE0TO flag END-IF ""
DISPLAY"UPDATE CL_STANDARD " DISPLAY"SET COL_CH1 = DISPLAY"WHERE java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 EXEC UPDATECL_STANDARD SETSQLCODETO WHERE java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 25 MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY""
DISPLAY"ROLLBACK WORK;" EXECSQLROLLBACK WORK END-EXEC
SQLCODE TO SQL-COD PERFORM CHCKOK DISPLAY" "
if ( flag = 1 ) then DISPLAY" xts726.pco mustdemonstrate Flagger EXECelse
VALUES('7026','pass','PCO') END-EXEC MOVESQLCODETO SQL-COD DISPLAY"extension FOR ANDORDER BY" DISPLAY"has executed successfully" " demonstrate Intermediate
- " WARNING" else DISPLAY" xts726.pco *** NOGO *** " EXECSQLINSERTINTO CTS1.TESTREPORT
DISPLAYSupport forWITHBYisnot MOVESQLCODETO SQL-COD DISPLAY"Vendor does not support fully " DISPLAY"Intermediate SQL extension " DISPLAY"Support for CURSOR WITH ORDER BY & UPDATE is not
- " required" END-IF
*BAK : Check again in order to insert a third option for fail *DWF: ???
DISPLAY"============ STOP RUN.
EXECSQL* **** Procedures for PERFORM statements MOVESQLCODETO SQL-COD
***************** END TEST7026 ******************
**** TESTER MAY CHOOSE TO INSERT CODE FOR errcnt > 0 STOPRUN.
* **** Procedures for PERFORM statements
*Test SQLCODE and SQLSTATE for normal completion.
CHCKOK. DISPLAY"SQLCODE should be 0; its value is ", SQL-COD DISPLAY"SQLSTATE PERFORMNOSUBCLASS THRU EXIT-NOSUBCLASS if (SQLCODENOT = 0OR NORMSQ NOT = "00000") then MOVE0TO flag END-IF if ( . thenNOSUBCLASS. DISPLAY"Valid implementation-defined *This routine replaces valid implementation-defined 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 NORMSQif(ORMSQX()=ALPNUMnorm2)then
MOVE3END-IF *subclass begins in position 3 of char array NORMSQ *valid subclass begins with 5-9, I-Z, end of ALPNUM table PERFORMVARYING norm2 FROM14BY1*so proceed to zero it out, if valid (0-9,A-Z) 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
MOVE4TO norm1 *examining position 4 of char array NORMSQ *valid characters are 0-9, A-Z PERFORMVARYING norm2 FROM1BY1UNTIL norm2 > 36 if (NORMSQX(norm1) = ALPNUM(norm2)) then MOVE"0"TOif (NORMSQX(norm1) = ALPNUM(norm2)) then END-IF END-PERFORMEND-IF
MOVE5TO norm1 *valid characters are 0-9, A-Z *examining position 5 of char array NORMSQ
*implementation-defined subclasses are allowed for warnings if (NORMSQX(norm1) = ALPNUM 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 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.14Bemerkung:
¤
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.