* Standard COBOL (file "XTS729.SCO") calling SQL * procedures in file "XTS729.MCO".
*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.
**************************************************************** * * COMMENT SECTION * * SQL VALIDATION TEST SUITE V6.0 * * XTS729.SCO * WRITTEN BY: Manolis Megaloikonomou * TRANSLATED AUTOMATICALLY FROM EMBEDDED COBOL BY CHRIS SCHANZLE * * Column name with 19 and 128 characters - regular. * * REFERENCES * 11.4 -- <column definition> * 5.4 -- <Names and identifiers> * 5.4 GR.4 * 5.4 SR.3 * 5.2 -- <token> and <separator> * 5.2 SR.8 * 5.2 SR.10 * 5.2 SR.11 * 5.2 LR.2a -- Raised. Entry SQL restriction which * restricted the length of a <regular identifier> * up to 18 <character representation>s. * 21.2.9 -- COLUMNS view. * F#1 -- Dynamic SQL. * F#2 -- Basic information schema. * F#3 -- Basic schema manipulation. * F#39 -- Long identifiers. * * DATE LAST ALTERED 14/12/95 CTS5 Hand-over Test * * Cleanups and fixes by V. Kogakis 05/12/95: * Include Files * Define NOSUBCLASS/CHCKOK at test beginning * Define cal variable * Fix Syntax errors * Add ROLLBACK after AUTHID * print timestamp * delete multiple SQLCODE and SQLSTATE initialisation * change string initialisation * Clean-up database at the end of the test * * QA Status: Full FC * * Revised by DWF 1996-02-01 * Fixed SDL transactions * Removed untranslatable field widths in printfs * Fixed char string lengths * Fixed opening & closing of wrong cursor * Added whitespace where required in table definition * Make variable names 6 chars ****************************************************************
*Set up long strings for comparison statements MOVE"COLUMNOFCHARACTERDATATYPE123456789012345
- "6789012345678901234567890123456789012345
- "678901234567890123456789012345678901234567890123"TO
str1
*Create table *ensure all columns names are of length 19 *the first column is to upper case *the second column is to be lower case *the third and fourth cols are to combine upper & lower cases & DISPLAY"CREATE TABLE TESTA6439" DISPLAY"(COLUMNOFCHARACTERSA CHARACTER(10)," DISPLAY" columnofcharactersb CHARACTER(10)," DISPLAY" cOlUmNoFNUMERICss_0 NUMERIC(5)," DISPLAY" cOlUmNoFNUMERICss_1 NUMERIC(5));" * EXEC SQL CREATE TABLE TESTA6439 * (COLUMNOFCHARACTERSA CHARACTER(10), * columnofcharactersb CHARACTER(10), * cOlUmNoFNUMERICss_0 NUMERIC(5), * cOlUmNoFNUMERICss_1 NUMERIC(5)); CALL"SUB3"USING SQLCODE SQLSTATE MOVE SQLCODE TO SQL-COD PERFORM CHCKOK DISPLAY" "
DISPLAY"INSERT INTO CTS1.TESTA6439" DISPLAY"VALUES('ABCD','DCBA',1,9999);" * EXEC SQL INSERT INTO CTS1.TESTA6439 * VALUES('ABCD','DCBA',1,9999); CALL"SUB7"USING SQLCODE SQLSTATE MOVE SQLCODE TO SQL-COD PERFORM CHCKOK DISPLAY" "
*Initialise host variables MOVE"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" TO aa MOVE"xxxxxxxxxx"TO bb MOVE 99 TO cc MOVE 99 TO dd
DISPLAY"SELECT COLUMNOFCHARACTERSA, columnofcharactersb, " DISPLAY"cOlUmNoFNUMERICss_0," DISPLAY"cOlUmNoFNUMERICss_1 INTO :aa, :bb, :cc, :dd FROM
- " CTS1.TESTA6439;" * EXEC SQL SELECT COLUMNOFCHARACTERSA, columnofcharactersb, * cOlUmNoFNUMERICss_0, cOlUmNoFNUMERICss_1 * INTO :aa, :bb, :cc, :dd FROM CTS1.TESTA6439; CALL"SUB8"USING SQLCODE SQLSTATE aa bb cc dd MOVE SQLCODE TO SQL-COD PERFORM CHCKOK DISPLAY"COLUMNOFCHARACTERSA should be ABCD; its value is
- " ", aa DISPLAY"columnofcharactersb should be DCBA; its value is
- " ", bb DISPLAY"cOlUmNoFNUMERICss_0 should be 1; its value is
- " ", cc DISPLAY"cOlUmNoFNUMERICss_1 should be 9999; its value is
- " ", dd if (aa NOT = "ABCD"OR bb NOT = "DCBA" ) then MOVE 0 TO flag END-IF if (cc NOT = 1 OR dd NOT = 9999) then MOVE 0 TO flag END-IF DISPLAY" "
*Ensure columns in the second table can be referenced correctly DISPLAY"INSERT INTO CTS1.TESTB6439" DISPLAY"VALUES('AA','BB',1,2);" * EXEC SQL INSERT INTO CTS1.TESTB6439 * VALUES('AA','BB',1,2); CALL"SUB9"USING SQLCODE SQLSTATE MOVE SQLCODE TO SQL-COD PERFORM CHCKOK DISPLAY" "
DISPLAY"INSERT INTO CTS1.TESTB6439" DISPLAY"VALUES('CC','DD',3,4);" * EXEC SQL INSERT INTO CTS1.TESTB6439 * VALUES('CC','DD',3,4); CALL"SUB10"USING SQLCODE SQLSTATE MOVE SQLCODE TO SQL-COD PERFORM CHCKOK DISPLAY" "
DISPLAY"INSERT INTO CTS1.TESTB6439" DISPLAY"VALUES('EE','FF',5,6);" * EXEC SQL INSERT INTO CTS1.TESTB6439 * VALUES('EE','FF',5,6); CALL"SUB11"USING SQLCODE SQLSTATE MOVE SQLCODE TO SQL-COD PERFORM CHCKOK DISPLAY" "
DISPLAY"INSERT INTO CTS1.TESTB6439" DISPLAY"VALUES('GG','HH',7,8);" * EXEC SQL INSERT INTO CTS1.TESTB6439 * VALUES('GG','HH',7,8); CALL"SUB12"USING SQLCODE SQLSTATE MOVE SQLCODE TO SQL-COD PERFORM CHCKOK DISPLAY" "
DISPLAY"INSERT INTO CTS1.TESTB6439" DISPLAY"VALUES('II','KK',9,0);" * EXEC SQL INSERT INTO CTS1.TESTB6439 * VALUES('II','KK',9,0); CALL"SUB13"USING SQLCODE SQLSTATE MOVE SQLCODE TO SQL-COD PERFORM CHCKOK DISPLAY" "
*Ensure the values stored in the second table can be retrieved c
DISPLAY"DECLARE a CURSOR" DISPLAY"FOR SELECT * FROM CTS1.TESTB6439 ORDER BY
- " cOlUmNoFNUMERIC12345" DISPLAY "678901234567890123456789012345678901234567890
- "1234567890123" DISPLAY "456789012345678901234567890123456789012345678901_0;" * EXEC SQL DECLARE a CURSOR * FOR SELECT * FROM CTS1.TESTB6439 * ORDER BY * cOlUmNoFNUMERIC123456789012345678901234567890 * 123456789012345678901234567890123456789012345 * 678901234567890123456789012345678901_0 END-EXEC
DISPLAY"OPEN a;" * EXEC SQL OPEN a; CALL"SUB14"USING SQLCODE SQLSTATE MOVE SQLCODE TO SQL-COD PERFORM CHCKOK DISPLAY" "
*Re-initialise host variables MOVE"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" TO aa MOVE"xxxxxxxxxx"TO bb MOVE 99 TO cc MOVE 99 TO dd
*Check first value fetched DISPLAY"FETCH a INTO :aa, :bb, :cc, :dd;" * EXEC SQL FETCH a INTO :aa, :bb, :cc, :dd; CALL"SUB15"USING SQLCODE SQLSTATE aa bb cc dd MOVE SQLCODE TO SQL-COD PERFORM CHCKOK DISPLAY"COLUMNOFCHARACTERSA should be AA; its value is ",
aa DISPLAY"columnofcharactersb should be BB; its value is ",
bb DISPLAY"cOlUmNoFNUMERICss_0 should be 1; its value is ",
cc DISPLAY"cOlUmNoFNUMERICss_1 should be 2; its value is ",
dd if (aa NOT = "AA"OR bb NOT = "BB" ) then MOVE 0 TO flag END-IF if (cc NOT = 1 OR dd NOT = 2) then MOVE 0 TO flag END-IF DISPLAY" "
*Re-initialise host variables MOVE"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" TO aa MOVE"xxxxxxxxxx"TO bb MOVE 99 TO cc MOVE 99 TO dd
*Check second value fetched DISPLAY"FETCH a INTO :aa, :bb, :cc, :dd;" * EXEC SQL FETCH a INTO :aa, :bb, :cc, :dd; CALL"SUB16"USING SQLCODE SQLSTATE aa bb cc dd MOVE SQLCODE TO SQL-COD PERFORM CHCKOK DISPLAY"COLUMNOFCHARACTERSA should be CC; its value is ",
aa DISPLAY"columnofcharactersb should be DD; its value is ",
bb DISPLAY"cOlUmNoFNUMERICss_0 should be 3; its value is ",
cc DISPLAY"cOlUmNoFNUMERICss_1 should be 4; its value is ",
dd if (aa NOT = "CC"OR bb NOT = "DD" ) then MOVE 0 TO flag END-IF if (cc NOT = 3 OR dd NOT = 4) then MOVE 0 TO flag END-IF DISPLAY" "
*Re-initialise host variables MOVE"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" TO aa MOVE"xxxxxxxxxx"TO bb MOVE 99 TO cc MOVE 99 TO dd
*Check third value fetched DISPLAY"FETCH a INTO :aa, :bb, :cc, :dd;" * EXEC SQL FETCH a INTO :aa, :bb, :cc, :dd; CALL"SUB17"USING SQLCODE SQLSTATE aa bb cc dd MOVE SQLCODE TO SQL-COD PERFORM CHCKOK DISPLAY"COLUMNOFCHARACTERSA should be EE; its value is ",
aa DISPLAY"columnofcharactersb should be FF; its value is ",
bb DISPLAY"cOlUmNoFNUMERICss_0 should be 5; its value is ",
cc DISPLAY"cOlUmNoFNUMERICss_1 should be 6; its value is ",
dd if (aa NOT = "EE"OR bb NOT = "FF" ) then MOVE 0 TO flag END-IF if (cc NOT = 5 OR dd NOT = 6) then MOVE 0 TO flag END-IF DISPLAY" "
*Re-initialise host variables MOVE"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" TO aa MOVE"xxxxxxxxxx"TO bb MOVE 99 TO cc MOVE 99 TO dd
*Check fourth value fetched DISPLAY"FETCH a INTO :aa, :bb, :cc, :dd;" * EXEC SQL FETCH a INTO :aa, :bb, :cc, :dd; CALL"SUB18"USING SQLCODE SQLSTATE aa bb cc dd MOVE SQLCODE TO SQL-COD PERFORM CHCKOK DISPLAY"COLUMNOFCHARACTERSA should be GG; its value is ",
aa DISPLAY"columnofcharactersb should be HH; its value is ",
bb DISPLAY"cOlUmNoFNUMERICss_0 should be 7; its value is ",
cc DISPLAY"cOlUmNoFNUMERICss_1 should be 8; its value is ",
dd if (aa NOT = "GG"OR bb NOT = "HH" ) then MOVE 0 TO flag END-IF if (cc NOT = 7 OR dd NOT = 8) then MOVE 0 TO flag END-IF DISPLAY" "
*Re-initialise host variables MOVE"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" TO aa MOVE"xxxxxxxxxx"TO bb MOVE 99 TO cc MOVE 99 TO dd
*Check fifth value fetched DISPLAY"FETCH a INTO :aa, :bb, :cc, :dd;" * EXEC SQL FETCH a INTO :aa, :bb, :cc, :dd; CALL"SUB19"USING SQLCODE SQLSTATE aa bb cc dd MOVE SQLCODE TO SQL-COD PERFORM CHCKOK DISPLAY"COLUMNOFCHARACTERSA should be II; its value is ",
aa DISPLAY"columnofcharactersb should be KK; its value is ",
bb DISPLAY"cOlUmNoFNUMERICss_0 should be 9; its value is ",
cc DISPLAY"cOlUmNoFNUMERICss_1 should be 0; its value is ",
dd if (aa NOT = "II"OR bb NOT = "KK" ) then MOVE 0 TO flag END-IF if (cc NOT = 9 OR dd NOT = 0) then MOVE 0 TO flag END-IF DISPLAY" "
DISPLAY"CLOSE a;" * EXEC SQL CLOSE a; CALL"SUB20"USING SQLCODE SQLSTATE MOVE SQLCODE TO SQL-COD PERFORM CHCKOK DISPLAY" "
*check columns are referenced correctly in the information schem DISPLAY"DECLARE b CURSOR" DISPLAY"FOR SELECT COLUMN_NAME, ORDINAL_POSITION FROM " DISPLAY"INFORMATION_SCHEMA.COLUMNS" DISPLAY"WHERE TABLE_SCHEMA = 'CTS1' AND TABLE_NAME =
- " 'TESTB6439';" * EXEC SQL DECLARE b CURSOR * FOR SELECT COLUMN_NAME, ORDINAL_POSITION * FROM INFORMATION_SCHEMA.COLUMNS * WHERE TABLE_SCHEMA = 'CTS1' AND TABLE_NAME = 'TESTB6439' * ORDER BY ORDINAL_POSITION END-EXEC
DISPLAY"OPEN b;" * EXEC SQL OPEN b; CALL"SUB21"USING SQLCODE SQLSTATE MOVE SQLCODE TO SQL-COD PERFORM CHCKOK DISPLAY" "
*Re-initialise host variables MOVE"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" TO aa MOVE 99 TO cc
DISPLAY"FETCH b INTO :aa, :cc;" * EXEC SQL FETCH b INTO :aa, :cc; CALL"SUB22"USING SQLCODE SQLSTATE aa cc MOVE SQLCODE TO SQL-COD PERFORM CHCKOK DISPLAY"aa should be:" DISPLAY "COLUMNOFCHARACTERDATATYPE12345678901234567890
- "1234567890123456789" DISPLAY "012345678901234567890123456789012345678901234
- "5678901234567890123" DISPLAY"its value is:" PERFORM P50 DISPLAY" " PERFORM P49 DISPLAY" " DISPLAY"cc should be 1; its value is ", cc if (aa NOT = str1 OR cc NOT = 1) then MOVE 0 TO flag END-IF DISPLAY" "
MOVE"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" TO aa MOVE 99 TO cc
DISPLAY"FETCH b INTO :aa, :cc;" * EXEC SQL FETCH b INTO :aa, :cc; CALL"SUB23"USING SQLCODE SQLSTATE aa cc MOVE SQLCODE TO SQL-COD PERFORM CHCKOK DISPLAY"aa should be:" DISPLAY "COLUMNOFCHARACTERDATATYPE12345678901234567890
- "1234567890123456789" DISPLAY "0123456789012345678901234567890123456789012345
- "67890123456789012B" DISPLAY"its value is:" PERFORM P48 DISPLAY" " PERFORM P47 DISPLAY" " DISPLAY"cc should be 2; its value is ", cc if (aa NOT = str2 OR cc NOT = 2) then MOVE 0 TO flag END-IF DISPLAY" "
MOVE"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" TO aa MOVE 99 TO cc
DISPLAY"FETCH b INTO :aa, :cc;" * EXEC SQL FETCH b INTO :aa, :cc; CALL"SUB24"USING SQLCODE SQLSTATE aa cc MOVE SQLCODE TO SQL-COD PERFORM CHCKOK DISPLAY"aa should be:" DISPLAY "COLUMNOFNUMERIC123456789012345678901234567890
- "1234567890123456789" DISPLAY "0123456789012345678901234567890123456789012345
- "6789012345678901_0" DISPLAY"its value is:" PERFORM P46 DISPLAY" " PERFORM P45 DISPLAY" " DISPLAY"cc should be 3; its value is ", cc if (aa NOT = str3 OR cc NOT = 3) then MOVE 0 TO flag END-IF DISPLAY" "
MOVE"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" TO aa MOVE 99 TO cc
DISPLAY"FETCH b INTO :aa, :cc;" * EXEC SQL FETCH b INTO :aa, :cc; CALL"SUB25"USING SQLCODE SQLSTATE aa cc MOVE SQLCODE TO SQL-COD PERFORM CHCKOK DISPLAY"aa should be:" DISPLAY "COLUMNOFNUMERIC123456789012345678901234567890
- "1234567890123456789" DISPLAY "01234567890123456789012345678901234567890123456
- "789012345678901_1" DISPLAY"its value is:" PERFORM P44 DISPLAY" " PERFORM P43 DISPLAY" " DISPLAY"cc should be 4; its value is ", cc if (aa NOT = str4 OR cc NOT = 4) then MOVE 0 TO flag END-IF DISPLAY" "
DISPLAY"CLOSE b;" * EXEC SQL CLOSE b; CALL"SUB26"USING SQLCODE SQLSTATE MOVE SQLCODE TO SQL-COD PERFORM CHCKOK DISPLAY" "
DISPLAY"INSERT INTO CTS1.TESTC6439" DISPLAY"VALUES('aaa','bbb');" * EXEC SQL INSERT INTO CTS1.TESTC6439 * VALUES('aaa','bbb'); CALL"SUB30"USING SQLCODE SQLSTATE MOVE SQLCODE TO SQL-COD PERFORM CHCKOK DISPLAY" "
DISPLAY"INSERT INTO CTS1.TESTC6439" DISPLAY"VALUES('ccc','ddd);" * EXEC SQL INSERT INTO CTS1.TESTC6439 * VALUES ('ccc','ddd'); CALL"SUB31"USING SQLCODE SQLSTATE MOVE SQLCODE TO SQL-COD PERFORM CHCKOK DISPLAY" "
DISPLAY"INSERT INTO CTS1.TESTC6439" DISPLAY"VALUES('eee','fff');" * EXEC SQL INSERT INTO CTS1.TESTC6439 * VALUES('eee','fff'); CALL"SUB32"USING SQLCODE SQLSTATE MOVE SQLCODE TO SQL-COD PERFORM CHCKOK DISPLAY" "
*select values from dynamically created table
DISPLAY"DECLARE c CURSOR" DISPLAY"FOR SELECT * FROM CTS1.TESTC6439 ORDER BY
- " COLUMNOFCHARACTERSA;" * EXEC SQL DECLARE c CURSOR * FOR SELECT * FROM CTS1.TESTC6439 * ORDER BY COLUMNOFCHARACTERSA END-EXEC
DISPLAY"OPEN c;" * EXEC SQL OPEN c; CALL"SUB33"USING SQLCODE SQLSTATE MOVE SQLCODE TO SQL-COD PERFORM CHCKOK DISPLAY" "
MOVE"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" TO aa MOVE"xxxxxxxxxx"TO bb
DISPLAY"FETCH c INTO :aa, :bb;" * EXEC SQL FETCH c INTO :aa, :bb; CALL"SUB34"USING SQLCODE SQLSTATE aa bb MOVE SQLCODE TO SQL-COD PERFORM CHCKOK DISPLAY"aa should be aaa; its value is ", aa DISPLAY"bb should be bbb; its value is ", bb if (aa NOT = "aaa"OR bb NOT = "bbb") then MOVE 0 TO flag END-IF DISPLAY" "
MOVE"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" TO aa MOVE"xxxxxxxxxx"TO bb
DISPLAY"FETCH c INTO :aa, :bb;" * EXEC SQL FETCH c INTO :aa, :bb; CALL"SUB35"USING SQLCODE SQLSTATE aa bb MOVE SQLCODE TO SQL-COD PERFORM CHCKOK DISPLAY"aa should be ccc; its value is ", aa DISPLAY"bb should be ddd; its value is ", bb if (aa NOT = "ccc"OR bb NOT = "ddd") then MOVE 0 TO flag END-IF DISPLAY" "
MOVE"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" TO aa MOVE"xxxxxxxxxx"TO bb
DISPLAY"FETCH c INTO :aa, :bb;" * EXEC SQL FETCH c INTO :aa, :bb; CALL"SUB36"USING SQLCODE SQLSTATE aa bb MOVE SQLCODE TO SQL-COD PERFORM CHCKOK DISPLAY"aa should be eee; its value is ", aa DISPLAY"bb should be fff; its value is ", bb if (aa NOT = "eee"OR bb NOT = "fff") then MOVE 0 TO flag END-IF DISPLAY" "
DISPLAY"CLOSE c;" * EXEC SQL CLOSE c; CALL"SUB37"USING SQLCODE SQLSTATE MOVE SQLCODE TO SQL-COD PERFORM CHCKOK DISPLAY" "
DISPLAY"INSERT INTO CTS1.TESTB6439" DISPLAY"VALUES('TTT','TTT',100,100,'ADD');" * EXEC SQL INSERT INTO CTS1.TESTB6439 * VALUES('TTT','TTT',100,100,'ADD'); CALL"SUB41"USING SQLCODE SQLSTATE MOVE SQLCODE TO SQL-COD PERFORM CHCKOK DISPLAY" "
MOVE"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" TO aa MOVE"xxxxxxxxxx"TO bb MOVE 99 TO cc MOVE 99 TO dd MOVE"xxxxxxxxx"TO ee
*check values inserted correctly DISPLAY"SELECT * INTO :aa, :bb, :cc, :dd, :ee FROM
- " CTS1.TESTB6439" DISPLAY"WHERE
- " COLUMNOFCHARACTERDATATYPE123456789012345678901234567" DISPLAY "89012345678901234567890123456789012345678901234567
- "89012345" DISPLAY"67890123456789012C = 'ADD';" * EXEC SQL SELECT * INTO :aa, :bb, :cc, :dd, :ee FROM * CTS1.TESTB6439 * WHERE * COLUMNOFCHARACTERDATATYPE1234567890123456789012345 * 67890123456789012345678901234567890123456789012345 * 678901234567890123456789012C = 'ADD'; CALL"SUB42"USING SQLCODE SQLSTATE aa bb cc dd ee MOVE SQLCODE TO SQL-COD PERFORM CHCKOK DISPLAY"aa should be TTT; its value is ", aa DISPLAY"bb should be TTT; its value is ", bb DISPLAY"cc should be 100; its value is ", cc DISPLAY"dd should be 100; its value is ", dd DISPLAY"ee should be ADD; its value is ", ee if (aa NOT = "TTT"OR bb NOT = "TTT" ) then MOVE 0 TO flag END-IF if (cc NOT = 100 OR dd NOT = 100 OR ee NOT = "ADD") then MOVE 0 TO flag END-IF DISPLAY" "
******************** END TEST7029 ********************
**** 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 should be 00000; its value is ", SQLSTATE PERFORM NOSUBCLASS THRU EXIT-NOSUBCLASS if (SQLCODE NOT = 0 OR NORMSQ NOT = "00000") 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 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 14 BY 1 UNTIL norm2 > 36 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.
P50. DISPLAY aa
.
P49. DISPLAY aa
.
P48. DISPLAY aa
.
P47. DISPLAY aa
.
P46. DISPLAY aa
.
P45. DISPLAY aa
.
P44. DISPLAY aa
.
P43. DISPLAY aa
.
¤ Dauer der Verarbeitung: 0.15 Sekunden
(vorverarbeitet)
¤
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.