* Standard COBOL (file "DML148.SCO") calling SQL * procedures in file "DML148.MCO".
**************************************************************** * * COMMENT SECTION * * DATE 1995/2/6 STANDARD 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. * * DML148.SCO * WRITTEN BY: Joan Sullivan (mostly) * TRANSLATED AUTOMATICALLY FROM EMBEDDED COBOL BY CHRIS SCHANZLE * Standard COBOL by David Flater * * This routine tests the ordering of columns in joins. * * REFERENCES * FIPS PUB 127-2 14.1 Transitional SQL * ANSI SQL-1992 * ****************************************************************
DISPLAY"DECLARE C14811 CURSOR FOR" DISPLAY" SELECT * FROM HU.WORKS NATURAL LEFT JOIN
- " HU.PROJ" DISPLAY" ORDER BY EMPNUM DESC, PNUM;" * EXEC SQL DECLARE C14811 CURSOR FOR * SELECT * FROM HU.WORKS NATURAL LEFT JOIN HU.PROJ * ORDER BY EMPNUM DESC, PNUM END-EXEC
MOVE"xxx"TO pn MOVE"xxx"TO en COMPUTE hr = -1 MOVE"xxxxxxxxxxxxxxxxxxxx"TO pname MOVE"xxxxxx"TO pt COMPUTE bu = -1 MOVE"xxxxxxxxxxxxxxx"TO ct DISPLAY"FETCH C14811 INTO :pn, :en, :hr, :pname, :pt, :bu,
- " :ct;" * EXEC SQL FETCH C14811 INTO :pn, :en, :hr, :pname, :pt, :bu, * :ct; CALL"SUB4"USINGSQLCODE SQLSTATE pn en hr pname pt
bu ct MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"pn should be P2; its value is ", pn DISPLAY"en should be E4; its value is ", en DISPLAY"hr should be 20; its value is ", hr DISPLAY"pname should be CALM; its value is ", pname DISPLAY"pt should be Code; its value is ", pt DISPLAY"bu should be 30000; its value is ", bu DISPLAY"ct should be Vienna; its value is ", ct if (pn NOT = "P2"OR en NOT = "E4") then MOVE 0 TO flag END-IF if (hr NOT = 20 OR pname NOT = "CALM") then MOVE 0 TO flag END-IF if (pt NOT = "Code"OR bu NOT = 30000) then MOVE 0 TO flag END-IF if (ct NOT = "Vienna") then MOVE 0 TO flag END-IF
MOVE"xxx"TO pn MOVE"xxx"TO en COMPUTE hr = -1 MOVE"xxxxxxxxxxxxxxxxxxxx"TO pname MOVE"xxxxxx"TO pt COMPUTE bu = -1 MOVE"xxxxxxxxxxxxxxx"TO ct DISPLAY"FETCH C14811 INTO :pn, :en, :hr, :pname, :pt, :bu,
- " :ct;" * EXEC SQL FETCH C14811 INTO :pn, :en, :hr, :pname, :pt, :bu, * :ct; CALL"SUB5"USINGSQLCODE SQLSTATE pn en hr pname pt
bu ct MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"pn should be P4; its value is ", pn DISPLAY"en should be E4; its value is ", en DISPLAY"hr should be 40; its value is ", hr DISPLAY"pname should be SDP; its value is ", pname DISPLAY"pt should be Design; its value is ", pt DISPLAY"bu should be 20000; its value is ", bu DISPLAY"ct should be Deale; its value is ", ct if (pn NOT = "P4"OR en NOT = "E4") then MOVE 0 TO flag END-IF if (hr NOT = 40 OR pname NOT = "SDP") then MOVE 0 TO flag END-IF if (pt NOT = "Design"OR bu NOT = 20000) then MOVE 0 TO flag END-IF if (ct NOT = "Deale") then MOVE 0 TO flag END-IF
DISPLAY"DECLARE C14812 CURSOR FOR" DISPLAY" SELECT * FROM HU.WORKS JOIN HU.PROJ USING
- " (PNUM)" DISPLAY" ORDER BY EMPNUM DESC, PNUM;" * EXEC SQL DECLARE C14812 CURSOR FOR * SELECT * FROM HU.WORKS JOIN HU.PROJ USING (PNUM) * ORDER BY EMPNUM DESC, PNUM END-EXEC
MOVE"xxx"TO pn MOVE"xxx"TO en COMPUTE hr = -1 MOVE"xxxxxxxxxxxxxxxxxxxx"TO pname MOVE"xxxxxx"TO pt COMPUTE bu = -1 MOVE"xxxxxxxxxxxxxxx"TO ct DISPLAY"FETCH C14812 INTO :pn, :en, :hr, :pname, :pt, :bu,
- " :ct;" * EXEC SQL FETCH C14812 INTO :pn, :en, :hr, :pname, :pt, :bu, * :ct; CALL"SUB8"USINGSQLCODE SQLSTATE pn en hr pname pt
bu ct MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"pn should be P2; its value is ", pn DISPLAY"en should be E4; its value is ", en DISPLAY"hr should be 20; its value is ", hr DISPLAY"pname should be CALM; its value is ", pname DISPLAY"pt should be Code; its value is ", pt DISPLAY"bu should be 30000; its value is ", bu DISPLAY"ct should be Vienna; its value is ", ct if (pn NOT = "P2"OR en NOT = "E4") then MOVE 0 TO flag END-IF if (hr NOT = 20 OR pname NOT = "CALM") then MOVE 0 TO flag END-IF if (pt NOT = "Code"OR bu NOT = 30000) then MOVE 0 TO flag END-IF if (ct NOT = "Vienna") then MOVE 0 TO flag END-IF
MOVE"xxx"TO pn MOVE"xxx"TO en COMPUTE hr = -1 MOVE"xxxxxxxxxxxxxxxxxxxx"TO pname MOVE"xxxxxx"TO pt COMPUTE bu = -1 MOVE"xxxxxxxxxxxxxxx"TO ct DISPLAY"FETCH C14812 INTO :pn, :en, :hr, :pname, :pt, :bu,
- " :ct;" * EXEC SQL FETCH C14812 INTO :pn, :en, :hr, :pname, :pt, :bu, * :ct; CALL"SUB9"USINGSQLCODE SQLSTATE pn en hr pname pt
bu ct MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"pn should be P4; its value is ", pn DISPLAY"en should be E4; its value is ", en DISPLAY"hr should be 40; its value is ", hr DISPLAY"pname should be SDP; its value is ", pname DISPLAY"pt should be Design; its value is ", pt DISPLAY"bu should be 20000; its value is ", bu DISPLAY"ct should be Deale; its value is ", ct if (pn NOT = "P4"OR en NOT = "E4") then MOVE 0 TO flag END-IF if (hr NOT = 40 OR pname NOT = "SDP") then MOVE 0 TO flag END-IF if (pt NOT = "Design"OR bu NOT = 20000) then MOVE 0 TO flag END-IF if (ct NOT = "Deale") then MOVE 0 TO flag END-IF
DISPLAY"DECLARE C14813 CURSOR FOR" DISPLAY" SELECT * FROM HU.WORKS RIGHT JOIN HU.PROJ" DISPLAY" ON HU.WORKS.PNUM = HU.PROJ.PNUM" DISPLAY" ORDER BY 1 DESC, 2;" * EXEC SQL DECLARE C14813 CURSOR FOR * SELECT * FROM HU.WORKS RIGHT JOIN HU.PROJ * ON HU.WORKS.PNUM = HU.PROJ.PNUM * ORDER BY 1 DESC, 2 END-EXEC
MOVE"xxx"TO pn MOVE"xxx"TO pn2 MOVE"xxx"TO en COMPUTE hr = -1 MOVE"xxxxxxxxxxxxxxxxxxxx"TO pname MOVE"xxxxxx"TO pt COMPUTE bu = -1 MOVE"xxxxxxxxxxxxxxx"TO ct DISPLAY"FETCH C14813 INTO :en, :pn, :hr, :pn2, :pname,
- " :pt, :bu, :ct;" * EXEC SQL FETCH C14813 INTO :en, :pn, :hr, :pn2, :pname, * :pt, :bu, :ct; CALL"SUB12"USINGSQLCODE SQLSTATE en pn hr pn2 pname pt
bu ct MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"en should be E4; its value is ", en DISPLAY"pn should be P2; its value is ", pn DISPLAY"hr should be 20; its value is ", hr DISPLAY"pn2 should be P2; its value is ", pn2 DISPLAY"pname should be CALM; its value is ", pname DISPLAY"pt should be Code; its value is ", pt DISPLAY"bu should be 30000; its value is ", bu DISPLAY"ct should be Vienna; its value is ", ct if (en NOT = "E4"OR pn NOT = "P2") then MOVE 0 TO flag END-IF if (hr NOT = 20 OR pname NOT = "CALM") then MOVE 0 TO flag END-IF if (pt NOT = "Code"OR bu NOT = 30000) then MOVE 0 TO flag END-IF if (ct NOT = "Vienna"OR pn2 NOT = "P2") then MOVE 0 TO flag END-IF
MOVE"xxx"TO pn MOVE"xxx"TO pn2 MOVE"xxx"TO en COMPUTE hr = -1 MOVE"xxxxxxxxxxxxxxxxxxxx"TO pname MOVE"xxxxxx"TO pt COMPUTE bu = -1 MOVE"xxxxxxxxxxxxxxx"TO ct DISPLAY"FETCH C14813 INTO :en, :pn, :hr, :pn2, :pname,
- " :pt, :bu, :ct;" * EXEC SQL FETCH C14813 INTO :en, :pn, :hr, :pn2, :pname, * :pt, :bu, :ct; CALL"SUB13"USINGSQLCODE SQLSTATE en pn hr pn2 pname pt
bu ct MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"en should be E4; its value is ", en DISPLAY"pn should be P4; its value is ", pn DISPLAY"hr should be 40; its value is ", hr DISPLAY"pn2 should be P4; its value is ", pn2 DISPLAY"pname should be SDP; its value is ", pname DISPLAY"pt should be Design; its value is ", pt DISPLAY"bu should be 20000; its value is ", bu DISPLAY"ct should be Deale; its value is ", ct if (en NOT = "E4"OR pn NOT = "P4") then MOVE 0 TO flag END-IF if (hr NOT = 40 OR pname NOT = "SDP") then MOVE 0 TO flag END-IF if (pt NOT = "Design"OR bu NOT = 20000) then MOVE 0 TO flag END-IF if (ct NOT = "Deale"OR pn2 NOT = "P4") then MOVE 0 TO flag END-IF
DISPLAY"DECLARE C14821 CURSOR FOR" DISPLAY" SELECT EMPNAME, CITY, T_DECIMAL" DISPLAY" FROM HU.STAFF LEFT OUTER JOIN SEVEN_TYPES " DISPLAY" ON -GRADE / 11 BETWEEN T_REAL AND T_DECIMAL" DISPLAY" ORDER BY EMPNAME;" * EXEC SQL DECLARE C14821 CURSOR FOR * SELECT EMPNAME, CITY, T_DECIMAL * FROM HU.STAFF LEFT OUTER JOIN SEVEN_TYPES * ON -GRADE / 11 BETWEEN T_REAL AND T_DECIMAL * ORDER BY EMPNAME END-EXEC
MOVE"xxxxxxxxxxxxxxxxxxxx"TO ename MOVE"xxxxxxxxxxxxxxx"TO ct MOVE 48 TO int1 MOVE 48 TO indic1 DISPLAY"FETCH C14821 INTO :ename, :ct, :int1:indic1;" * EXEC SQL FETCH C14821 INTO :ename, :ct, :int1:indic1 * ; CALL"SUB27"USINGSQLCODE SQLSTATE ename ct int1
indic1 MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"ename should be Alice; its value is ", ename DISPLAY"ct should be Deale; its value is ", ct DISPLAY"indic1 should be -1; its value is ", indic1 if (ename NOT = "Alice"OR ct NOT = "Deale") then MOVE 0 TO flag END-IF if (indic1 NOT = -1) then MOVE 0 TO flag END-IF
MOVE"xxxxxxxxxxxxxxxxxxxx"TO ename MOVE"xxxxxxxxxxxxxxx"TO ct MOVE 48 TO int1 MOVE 48 TO indic1 DISPLAY"FETCH C14821 INTO :ename, :ct, :int1:indic1;" * EXEC SQL FETCH C14821 INTO :ename, :ct, :int1:indic1 * ; CALL"SUB28"USINGSQLCODE SQLSTATE ename ct int1
indic1 MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"ename should be Betty; its value is ", ename DISPLAY"ct should be Vienna; its value is ", ct DISPLAY"int1 should be 0; its value is ", int1 DISPLAY"indic1 should be 0; its value is ", indic1 if (ename NOT = "Betty"OR ct NOT = "Vienna") then MOVE 0 TO flag END-IF if (int1 NOT = 0 OR indic1 NOT = 0) then MOVE 0 TO flag END-IF
MOVE"xxxxxxxxxxxxxxxxxxxx"TO ename MOVE"xxxxxxxxxxxxxxx"TO ct MOVE 48 TO int1 MOVE 48 TO indic1 DISPLAY"FETCH C14821 INTO :ename, :ct, :int1:indic1;" * EXEC SQL FETCH C14821 INTO :ename, :ct, :int1:indic1 * ; CALL"SUB29"USINGSQLCODE SQLSTATE ename ct int1
indic1 MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"ename should be Betty; its value is ", ename DISPLAY"ct should be Vienna; its value is ", ct DISPLAY"int1 should be 0; its value is ", int1 DISPLAY"indic1 should be 0; its value is ", indic1 if (ename NOT = "Betty"OR ct NOT = "Vienna") then MOVE 0 TO flag END-IF if (int1 NOT = 0 OR indic1 NOT = 0) then MOVE 0 TO flag END-IF
MOVE"xxxxxxxxxxxxxxxxxxxx"TO ename MOVE"xxxxxxxxxxxxxxx"TO ct MOVE 48 TO int1 MOVE 48 TO indic1 DISPLAY"FETCH C14821 INTO :ename, :ct, :int1:indic1;" * EXEC SQL FETCH C14821 INTO :ename, :ct, :int1:indic1 * ; CALL"SUB30"USINGSQLCODE SQLSTATE ename ct int1
indic1 MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"ename should be Carmen; its value is ", ename DISPLAY"ct should be Vienna; its value is ", ct DISPLAY"indic1 should be -1; its value is ", indic1 if (ename NOT = "Carmen"OR ct NOT = "Vienna") then MOVE 0 TO flag END-IF if (indic1 NOT = -1) then MOVE 0 TO flag END-IF
MOVE"xxxxxxxxxxxxxxxxxxxx"TO ename MOVE"xxxxxxxxxxxxxxx"TO ct MOVE 48 TO int1 MOVE 48 TO indic1 DISPLAY"FETCH C14821 INTO :ename, :ct, :int1:indic1;" * EXEC SQL FETCH C14821 INTO :ename, :ct, :int1:indic1 * ; CALL"SUB31"USINGSQLCODE SQLSTATE ename ct int1
indic1 MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"ename should be Don; its value is ", ename DISPLAY"ct should be Deale; its value is ", ct DISPLAY"indic1 should be -1; its value is ", indic1 if (ename NOT = "Don"OR ct NOT = "Deale") then MOVE 0 TO flag END-IF if (indic1 NOT = -1) then MOVE 0 TO flag END-IF
MOVE"xxxxxxxxxxxxxxxxxxxx"TO ename MOVE"xxxxxxxxxxxxxxx"TO ct MOVE 48 TO int1 MOVE 48 TO indic1 DISPLAY"FETCH C14821 INTO :ename, :ct, :int1:indic1;" * EXEC SQL FETCH C14821 INTO :ename, :ct, :int1:indic1 * ; CALL"SUB32"USINGSQLCODE SQLSTATE ename ct int1
indic1 MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"ename should be Ed; its value is ", ename DISPLAY"ct should be Akron; its value is ", ct DISPLAY"indic1 should be -1; its value is ", indic1 if (ename NOT = "Ed"OR ct NOT = "Akron") then MOVE 0 TO flag END-IF if (indic1 NOT = -1) then MOVE 0 TO flag END-IF
DISPLAY"FETCH C14821 INTO :ename, :ct, :int1:indic1;" * EXEC SQL FETCH C14821 INTO :ename, :ct, :int1:indic1 * ; CALL"SUB33"USINGSQLCODE SQLSTATE ename ct int1
indic1 MOVESQLCODETO SQL-COD DISPLAY"SQLCODE should be 100; its value is ", SQL-COD DISPLAY"SQLSTATE should be 02000; its value is ", SQLSTATE PERFORM NOSUBCLASS THRU EXIT-NOSUBCLASS if (SQLCODENOT = 100 OR NORMSQ NOT = "02000") then MOVE 0 TO flag END-IF if (NORMSQ = "02000"AND NORMSQ NOT = SQLSTATE) then DISPLAY"Valid implementation-defined SQLSTATE accepted." END-IF DISPLAY" "
*Subtest number two *Comparable CHAR types *IN predicate, with literals and variable value
DISPLAY"int1 = 10;" MOVE 10 TO int1 DISPLAY"DECLARE C14822 CURSOR FOR" DISPLAY" SELECT T_INT, T_CHAR, EMPNAME, EMPNUM, GRADE " DISPLAY" FROM SEVEN_TYPES RIGHT JOIN HU.STAFF" DISPLAY" ON GRADE IN (:int1, 11, 13) AND EMPNUM = T_CHAR" DISPLAY" ORDER BY EMPNAME, T_INT;" * EXEC SQL DECLARE C14822 CURSOR FOR * SELECT T_INT, T_CHAR, EMPNAME, EMPNUM, GRADE * FROM SEVEN_TYPES RIGHT JOIN HU.STAFF * ON GRADE IN (:int1, 11, 13) AND EMPNUM = T_CHAR * ORDER BY EMPNAME, T_INT END-EXEC
MOVE 49 TO int1 MOVE 49 TO indic1 MOVE"xxxxxxxxxx"TO tc MOVE 49 TO indic2 MOVE"xxxxxxxxxxxxxxxxxxxx"TO ename MOVE"xxx"TO en MOVE 49 TO gr DISPLAY"FETCH C14822 INTO :int1:indic1, :tc:indic2,
- " :ename, :en, :gr;" * EXEC SQL FETCH C14822 INTO :int1:indic1, :tc:indic2, * :ename, :en, :gr; CALL"SUB36"USINGSQLCODE SQLSTATE int1 indic1 tc
indic2 ename en gr MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"indic1 should be -1; its value is ", indic1 DISPLAY"indic2 should be -1; its value is ", indic2 DISPLAY"ename should be Alice; its value is ", ename DISPLAY"en should be E1; its value is ", en DISPLAY"gr should be 12; its value is ", gr if (indic1 NOT = -1 OR indic2 NOT = -1) then MOVE 0 TO flag END-IF if (ename NOT = "Alice"OR en NOT = "E1") then MOVE 0 TO flag END-IF if (gr NOT = 12) then MOVE 0 TO flag END-IF
MOVE 49 TO int1 MOVE 49 TO indic1 MOVE"xxxxxxxxxx"TO tc MOVE 49 TO indic2 MOVE"xxxxxxxxxxxxxxxxxxxx"TO ename MOVE"xxx"TO en MOVE 49 TO gr DISPLAY"FETCH C14822 INTO :int1:indic1, :tc:indic2,
- " :ename, :en, :gr;" * EXEC SQL FETCH C14822 INTO :int1:indic1, :tc:indic2, * :ename, :en, :gr; CALL"SUB37"USINGSQLCODE SQLSTATE int1 indic1 tc
indic2 ename en gr MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"indic1 should be 0; its value is ", indic1 DISPLAY"indic2 should be 0; its value is ", indic2 DISPLAY"int1 should be 2; its value is ", int1 DISPLAY"tc should be E2; its value is ", tc DISPLAY"ename should be Betty; its value is ", ename DISPLAY"en should be E2; its value is ", en DISPLAY"gr should be 10; its value is ", gr if (indic1 NOT = 0 OR indic2 NOT = 0) then MOVE 0 TO flag END-IF if (int1 NOT = 2 OR tc NOT = "E2") then MOVE 0 TO flag END-IF if (ename NOT = "Betty"OR en NOT = "E2") then MOVE 0 TO flag END-IF if (gr NOT = 10) then MOVE 0 TO flag END-IF
MOVE 49 TO int1 MOVE 49 TO indic1 MOVE"xxxxxxxxxx"TO tc MOVE 49 TO indic2 MOVE"xxxxxxxxxxxxxxxxxxxx"TO ename MOVE"xxx"TO en MOVE 49 TO gr DISPLAY"FETCH C14822 INTO :int1:indic1, :tc:indic2,
- " :ename, :en, :gr;" * EXEC SQL FETCH C14822 INTO :int1:indic1, :tc:indic2, * :ename, :en, :gr; CALL"SUB38"USINGSQLCODE SQLSTATE int1 indic1 tc
indic2 ename en gr MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"indic1 should be -1; its value is ", indic1 DISPLAY"indic2 should be -1; its value is ", indic2 DISPLAY"ename should be Carmen; its value is ", ename DISPLAY"en should be E3; its value is ", en DISPLAY"gr should be 13; its value is ", gr if (indic1 NOT = -1 OR indic2 NOT = -1) then MOVE 0 TO flag END-IF if (ename NOT = "Carmen"OR en NOT = "E3") then MOVE 0 TO flag END-IF if (gr NOT = 13) then MOVE 0 TO flag END-IF
MOVE"xxx"TO pn MOVE"xxx"TO en MOVE 5 TO bu MOVE 5 TO hr MOVE 5 TO indic1 MOVE 5 TO indic2 DISPLAY"FETCH C14823 INTO :pn, :bu, :hr:indic1,
- " :en:indic2;" * EXEC SQL FETCH C14823 INTO :pn, :bu, :hr:indic1, :en:indic2 * ; CALL"SUB41"USINGSQLCODE SQLSTATE pn bu hr
indic1 en indic2 MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"pn should be P1; its value is ", pn DISPLAY"bu should be 10000; its value is ", bu DISPLAY"indic1 should be -1; its value is ", indic1 DISPLAY"indic2 should be -1; its value is ", indic2 if (pn NOT = "P1"OR bu NOT = 10000) then MOVE 0 TO flag END-IF if (indic1 NOT = -1 OR indic2 NOT = -1) then MOVE 0 TO flag END-IF
MOVE"xxx"TO pn MOVE"xxx"TO en MOVE 5 TO bu MOVE 5 TO hr MOVE 5 TO indic1 MOVE 5 TO indic2 DISPLAY"FETCH C14823 INTO :pn, :bu, :hr:indic1,
- " :en:indic2;" * EXEC SQL FETCH C14823 INTO :pn, :bu, :hr:indic1, :en:indic2 * ; CALL"SUB42"USINGSQLCODE SQLSTATE pn bu hr indic1
en indic2 MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"pn should be P2; its value is ", pn DISPLAY"bu should be 30000; its value is ", bu DISPLAY"hr should be 80; its value is ", hr DISPLAY"en should be E2; its value is ", en DISPLAY"indic1 should be 0; its value is ", indic1 DISPLAY"indic2 should be 0; its value is ", indic2 if (pn NOT = "P2"OR bu NOT = 30000) then MOVE 0 TO flag END-IF if (indic1 NOT = 0 OR indic2 NOT = 0) then MOVE 0 TO flag END-IF if (hr NOT = 80 OR en NOT = "E2") then MOVE 0 TO flag END-IF
MOVE"xxx"TO pn MOVE"xxx"TO en MOVE 5 TO bu MOVE 5 TO hr MOVE 5 TO indic1 MOVE 5 TO indic2 DISPLAY"FETCH C14823 INTO :pn, :bu, :hr:indic1,
- " :en:indic2;" * EXEC SQL FETCH C14823 INTO :pn, :bu, :hr:indic1, :en:indic2 * ; CALL"SUB43"USINGSQLCODE SQLSTATE pn bu hr indic1
en indic2 MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"pn should be P3; its value is ", pn DISPLAY"bu should be 30000; its value is ", bu DISPLAY"hr should be 80; its value is ", hr DISPLAY"en should be E1; its value is ", en DISPLAY"indic1 should be 0; its value is ", indic1 DISPLAY"indic2 should be 0; its value is ", indic2 if (pn NOT = "P3"OR bu NOT = 30000) then MOVE 0 TO flag END-IF if (indic1 NOT = 0 OR indic2 NOT = 0) then MOVE 0 TO flag END-IF if (hr NOT = 80 OR en NOT = "E1") then MOVE 0 TO flag END-IF
MOVE"xxx"TO pn MOVE"xxx"TO en MOVE 5 TO bu MOVE 5 TO hr MOVE 5 TO indic1 MOVE 5 TO indic2 DISPLAY"FETCH C14823 INTO :pn, :bu, :hr:indic1,
- " :en:indic2;" * EXEC SQL FETCH C14823 INTO :pn, :bu, :hr:indic1, :en:indic2 * ; CALL"SUB44"USINGSQLCODE SQLSTATE pn bu hr indic1
en indic2 MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"pn should be P4; its value is ", pn DISPLAY"bu should be 20000; its value is ", bu DISPLAY"indic1 should be -1; its value is ", indic1 DISPLAY"indic2 should be -1; its value is ", indic2 if (pn NOT = "P4"OR bu NOT = 20000) then MOVE 0 TO flag END-IF if (indic1 NOT = -1 OR indic2 NOT = -1) then MOVE 0 TO flag END-IF
MOVE"xxx"TO pn MOVE"xxx"TO en MOVE 5 TO bu MOVE 5 TO hr MOVE 5 TO indic1 MOVE 5 TO indic2 DISPLAY"FETCH C14823 INTO :pn, :bu, :hr:indic1,
- " :en:indic2;" * EXEC SQL FETCH C14823 INTO :pn, :bu, :hr:indic1, :en:indic2 * ; CALL"SUB45"USINGSQLCODE SQLSTATE pn bu hr indic1
en indic2 MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"pn should be P5; its value is ", pn DISPLAY"bu should be 10000; its value is ", bu DISPLAY"indic1 should be -1; its value is ", indic1 DISPLAY"indic2 should be -1; its value is ", indic2 if (pn NOT = "P5"OR bu NOT = 10000) then MOVE 0 TO flag END-IF if (indic1 NOT = -1 OR indic2 NOT = -1) then MOVE 0 TO flag END-IF
MOVE"xxx"TO pn MOVE"xxx"TO en MOVE 5 TO bu MOVE 5 TO hr MOVE 5 TO indic1 MOVE 5 TO indic2 DISPLAY"FETCH C14823 INTO :pn, :bu, :hr:indic1,
- " :en:indic2;" * EXEC SQL FETCH C14823 INTO :pn, :bu, :hr:indic1, :en:indic2 * ; CALL"SUB46"USINGSQLCODE SQLSTATE pn bu hr
indic1 en indic2 MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"pn should be P6; its value is ", pn DISPLAY"bu should be 50000; its value is ", bu DISPLAY"indic1 should be -1; its value is ", indic1 DISPLAY"indic2 should be -1; its value is ", indic2 if (pn NOT = "P6"OR bu NOT = 50000) then MOVE 0 TO flag END-IF if (indic1 NOT = -1 OR indic2 NOT = -1) then MOVE 0 TO flag END-IF
DISPLAY"FETCH C14823 INTO :pn, :bu, :hr:indic1,
- " :en:indic2;" * EXEC SQL FETCH C14823 INTO :pn, :bu, :hr:indic1, :en:indic2 * ; CALL"SUB47"USINGSQLCODE SQLSTATE pn bu hr
indic1 en indic2 MOVESQLCODETO SQL-COD DISPLAY"SQLCODE should be 100; its value is ", SQL-COD DISPLAY"SQLSTATE should be 02000; its value is ", SQLSTATE PERFORM NOSUBCLASS THRU EXIT-NOSUBCLASS if (SQLCODENOT = 100 OR NORMSQ NOT = "02000") then MOVE 0 TO flag END-IF if (NORMSQ = "02000"AND NORMSQ NOT = SQLSTATE) then DISPLAY"Valid implementation-defined SQLSTATE accepted." END-IF DISPLAY" "
DISPLAY"DECLARE C14824 CURSOR FOR" DISPLAY" SELECT HU.STAFF.CITY,EMPNAME,PNAME,BUDGET" DISPLAY" FROM HU.STAFF LEFT JOIN HU.PROJ" DISPLAY" ON HU.STAFF.CITY = HU.PROJ.CITY" DISPLAY" AND HU.STAFF.CITY <> 'Vienna'" DISPLAY" AND EMPNAME <> 'Don'" DISPLAY" WHERE BUDGET > 15000 OR BUDGET IS NULL" DISPLAY" ORDER BY HU.STAFF.CITY, EMPNAME, BUDGET;" * EXEC SQL DECLARE C14824 CURSOR FOR * SELECT HU.STAFF.CITY,EMPNAME,PNAME,BUDGET * FROM HU.STAFF LEFT JOIN HU.PROJ * ON HU.STAFF.CITY = HU.PROJ.CITY * AND HU.STAFF.CITY <> 'Vienna' * AND EMPNAME <> 'Don' * WHERE BUDGET > 15000 OR BUDGET IS NULL * ORDER BY HU.STAFF.CITY, EMPNAME, BUDGET END-EXEC
MOVE"xxxxxxxxxxxxxxxxxxxx"TO ename MOVE"xxxxxxxxxxxxxxxxxxxx"TO pname MOVE"xxxxxxxxxxxxxxx"TO ct MOVE 28 TO bu DISPLAY"FETCH C14824 INTO :ct, :ename, :pname:indic1,
- " :bu:indic2;" * EXEC SQL FETCH C14824 INTO :ct, :ename, :pname:indic1, * :bu:indic2; CALL"SUB50"USINGSQLCODE SQLSTATE ct ename pname
indic1 bu indic2 MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"ct should be Akron; its value is ", ct DISPLAY"ename should be Ed; its value is ", ename DISPLAY"indic1 should be -1; its value is ", indic1 DISPLAY"indic2 should be -1; its value is ", indic2 if (ct NOT = "Akron"OR ename NOT = "Ed") then MOVE 0 TO flag END-IF if (indic1 NOT = -1 OR indic2 NOT = -1) then MOVE 0 TO flag END-IF
MOVE"xxxxxxxxxxxxxxxxxxxx"TO ename MOVE"xxxxxxxxxxxxxxxxxxxx"TO pname MOVE"xxxxxxxxxxxxxxx"TO ct MOVE 28 TO bu DISPLAY"FETCH C14824 INTO :ct, :ename, :pname:indic1,
- " :bu:indic2;" * EXEC SQL FETCH C14824 INTO :ct, :ename, :pname:indic1, * :bu:indic2; CALL"SUB51"USINGSQLCODE SQLSTATE ct ename pname
indic1 bu indic2 MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"ct should be Deale; its value is ", ct DISPLAY"ename should be Alice; its value is ", ename DISPLAY"pname should be SDP; its value is ", pname DISPLAY"bu should be 20000; its value is ", bu DISPLAY"indic1 should be 0; its value is ", indic1 DISPLAY"indic2 should be 0; its value is ", indic2 if (ct NOT = "Deale"OR ename NOT = "Alice") then MOVE 0 TO flag END-IF if (pname NOT = "SDP"OR bu NOT = 20000) then MOVE 0 TO flag END-IF if (indic1 NOT = 0 OR indic2 NOT = 0) then MOVE 0 TO flag END-IF
MOVE"xxxxxxxxxxxxxxxxxxxx"TO ename MOVE"xxxxxxxxxxxxxxxxxxxx"TO pname MOVE"xxxxxxxxxxxxxxx"TO ct MOVE 28 TO bu DISPLAY"FETCH C14824 INTO :ct, :ename, :pname:indic1,
- " :bu:indic2;" * EXEC SQL FETCH C14824 INTO :ct, :ename, :pname:indic1, * :bu:indic2; CALL"SUB52"USINGSQLCODE SQLSTATE ct ename pname
indic1 bu indic2 MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"ct should be Deale; its value is ", ct DISPLAY"ename should be Alice; its value is ", ename DISPLAY"pname should be PAYR; its value is ", pname DISPLAY"bu should be 50000; its value is ", bu DISPLAY"indic1 should be 0; its value is ", indic1 DISPLAY"indic2 should be 0; its value is ", indic2 if (ct NOT = "Deale"OR ename NOT = "Alice") then MOVE 0 TO flag END-IF if (pname NOT = "PAYR"OR bu NOT = 50000) then MOVE 0 TO flag END-IF if (indic1 NOT = 0 OR indic2 NOT = 0) then MOVE 0 TO flag END-IF
MOVE"xxxxxxxxxxxxxxxxxxxx"TO ename MOVE"xxxxxxxxxxxxxxxxxxxx"TO pname MOVE"xxxxxxxxxxxxxxx"TO ct MOVE 28 TO bu DISPLAY"FETCH C14824 INTO :ct, :ename, :pname:indic1,
- " :bu:indic2;" * EXEC SQL FETCH C14824 INTO :ct, :ename, :pname:indic1, * :bu:indic2; CALL"SUB53"USINGSQLCODE SQLSTATE ct ename pname
indic1 bu indic2 MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"ct should be Deale; its value is ", ct DISPLAY"ename should be Don; its value is ", ename DISPLAY"indic1 should be -1; its value is ", indic1 DISPLAY"indic2 should be -1; its value is ", indic2 if (ct NOT = "Deale"OR ename NOT = "Don") then MOVE 0 TO flag END-IF if (indic1 NOT = -1 OR indic2 NOT = -1) then MOVE 0 TO flag END-IF
MOVE"xxxxxxxxxxxxxxxxxxxx"TO ename MOVE"xxxxxxxxxxxxxxxxxxxx"TO pname MOVE"xxxxxxxxxxxxxxx"TO ct MOVE 28 TO bu DISPLAY"FETCH C14824 INTO :ct, :ename, :pname:indic1,
- " :bu:indic2;" * EXEC SQL FETCH C14824 INTO :ct, :ename, :pname:indic1, * :bu:indic2; CALL"SUB54"USINGSQLCODE SQLSTATE ct ename
pname indic1 bu indic2 MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"ct should be Vienna; its value is ", ct DISPLAY"ename should be Betty; its value is ", ename DISPLAY"indic1 should be -1; its value is ", indic1 DISPLAY"indic2 should be -1; its value is ", indic2 if (ct NOT = "Vienna"OR ename NOT = "Betty") then MOVE 0 TO flag END-IF if (indic1 NOT = -1 OR indic2 NOT = -1) then MOVE 0 TO flag END-IF
MOVE"xxxxxxxxxxxxxxxxxxxx"TO ename MOVE"xxxxxxxxxxxxxxxxxxxx"TO pname MOVE"xxxxxxxxxxxxxxx"TO ct MOVE 28 TO bu DISPLAY"FETCH C14824 INTO :ct, :ename, :pname:indic1,
- " :bu:indic2;" * EXEC SQL FETCH C14824 INTO :ct, :ename, :pname:indic1, * :bu:indic2; CALL"SUB55"USINGSQLCODE SQLSTATE ct ename pname
indic1 bu indic2 MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"ct should be Vienna; its value is ", ct DISPLAY"ename should be Carmen; its value is ", ename DISPLAY"indic1 should be -1; its value is ", indic1 DISPLAY"indic2 should be -1; its value is ", indic2 if (ct NOT = "Vienna"OR ename NOT = "Carmen") then MOVE 0 TO flag END-IF if (indic1 NOT = -1 OR indic2 NOT = -1) then MOVE 0 TO flag END-IF
DISPLAY"FETCH C14824 INTO :ct, :ename, :pname:indic1,
- " :bu:indic2;" * EXEC SQL FETCH C14824 INTO :ct, :ename, :pname:indic1, * :bu:indic2; CALL"SUB56"USINGSQLCODE SQLSTATE ct ename pname
indic1 bu indic2 MOVESQLCODETO SQL-COD DISPLAY"SQLCODE should be 100; its value is ", SQL-COD DISPLAY"SQLSTATE should be 02000; its value is ", SQLSTATE PERFORM NOSUBCLASS THRU EXIT-NOSUBCLASS if (SQLCODENOT = 100 OR NORMSQ NOT = "02000") then MOVE 0 TO flag END-IF if (NORMSQ = "02000"AND NORMSQ NOT = SQLSTATE) then DISPLAY"Valid implementation-defined SQLSTATE accepted." END-IF DISPLAY" "
*Subtest number five *Difference between WHERE and ON
DISPLAY"DECLARE C14825 CURSOR FOR" DISPLAY" SELECT HU.STAFF.CITY,EMPNAME,PNAME,BUDGET" DISPLAY" FROM HU.STAFF LEFT JOIN HU.PROJ" DISPLAY" ON HU.STAFF.CITY = HU.PROJ.CITY" DISPLAY" AND HU.STAFF.CITY <> 'Vienna'" DISPLAY" WHERE (BUDGET > 15000 OR BUDGET IS NULL)" DISPLAY" AND EMPNAME <> 'Don'" DISPLAY" ORDER BY HU.STAFF.CITY, EMPNAME, BUDGET;" * EXEC SQL DECLARE C14825 CURSOR FOR * SELECT HU.STAFF.CITY,EMPNAME,PNAME,BUDGET * FROM HU.STAFF LEFT JOIN HU.PROJ * ON HU.STAFF.CITY = HU.PROJ.CITY * AND HU.STAFF.CITY <> 'Vienna' * WHERE (BUDGET > 15000 OR BUDGET IS NULL) * AND EMPNAME <> 'Don' * ORDER BY HU.STAFF.CITY, EMPNAME, BUDGET END-EXEC
MOVE"xxxxxxxxxxxxxxxxxxxx"TO ename MOVE"xxxxxxxxxxxxxxxxxxxx"TO pname MOVE"xxxxxxxxxxxxxxx"TO ct MOVE 28 TO bu DISPLAY"FETCH C14825 INTO :ct, :ename, :pname:indic1,
- " :bu:indic2;" * EXEC SQL FETCH C14825 INTO :ct, :ename, :pname:indic1, * :bu:indic2; CALL"SUB59"USINGSQLCODE SQLSTATE ct ename pname
indic1 bu indic2 MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"ct should be Akron; its value is ", ct DISPLAY"ename should be Ed; its value is ", ename DISPLAY"indic1 should be -1; its value is ", indic1 DISPLAY"indic2 should be -1; its value is ", indic2 if (ct NOT = "Akron"OR ename NOT = "Ed") then MOVE 0 TO flag END-IF if (indic1 NOT = -1 OR indic2 NOT = -1) then MOVE 0 TO flag END-IF
MOVE"xxxxxxxxxxxxxxxxxxxx"TO ename MOVE"xxxxxxxxxxxxxxxxxxxx"TO pname MOVE"xxxxxxxxxxxxxxx"TO ct MOVE 28 TO bu DISPLAY"FETCH C14825 INTO :ct, :ename, :pname:indic1,
- " :bu:indic2;" * EXEC SQL FETCH C14825 INTO :ct, :ename, :pname:indic1, * :bu:indic2; CALL"SUB60"USINGSQLCODE SQLSTATE ct ename pname
indic1 bu indic2 MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"ct should be Deale; its value is ", ct DISPLAY"ename should be Alice; its value is ", ename DISPLAY"pname should be SDP; its value is ", pname DISPLAY"bu should be 20000; its value is ", bu DISPLAY"indic1 should be 0; its value is ", indic1 DISPLAY"indic2 should be 0; its value is ", indic2 if (ct NOT = "Deale"OR ename NOT = "Alice") then MOVE 0 TO flag END-IF if (pname NOT = "SDP"OR bu NOT = 20000) then MOVE 0 TO flag END-IF if (indic1 NOT = 0 OR indic2 NOT = 0) then MOVE 0 TO flag END-IF
MOVE"xxxxxxxxxxxxxxxxxxxx"TO ename MOVE"xxxxxxxxxxxxxxxxxxxx"TO pname MOVE"xxxxxxxxxxxxxxx"TO ct MOVE 28 TO bu DISPLAY"FETCH C14825 INTO :ct, :ename, :pname:indic1,
- " :bu:indic2;" * EXEC SQL FETCH C14825 INTO :ct, :ename, :pname:indic1, * :bu:indic2; CALL"SUB61"USINGSQLCODE SQLSTATE ct ename pname
indic1 bu indic2 MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"ct should be Deale; its value is ", ct DISPLAY"ename should be Alice; its value is ", ename DISPLAY"pname should be PAYR; its value is ", pname DISPLAY"bu should be 50000; its value is ", bu DISPLAY"indic1 should be 0; its value is ", indic1 DISPLAY"indic2 should be 0; its value is ", indic2 if (ct NOT = "Deale"OR ename NOT = "Alice") then MOVE 0 TO flag END-IF if (pname NOT = "PAYR"OR bu NOT = 50000) then MOVE 0 TO flag END-IF if (indic1 NOT = 0 OR indic2 NOT = 0) then MOVE 0 TO flag END-IF
MOVE"xxxxxxxxxxxxxxxxxxxx"TO ename MOVE"xxxxxxxxxxxxxxxxxxxx"TO pname MOVE"xxxxxxxxxxxxxxx"TO ct MOVE 28 TO bu DISPLAY"FETCH C14825 INTO :ct, :ename, :pname:indic1,
- " :bu:indic2;" * EXEC SQL FETCH C14825 INTO :ct, :ename, :pname:indic1, * :bu:indic2; CALL"SUB62"USINGSQLCODE SQLSTATE ct ename pname indic1
bu indic2 MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"ct should be Vienna; its value is ", ct DISPLAY"ename should be Betty; its value is ", ename DISPLAY"indic1 should be -1; its value is ", indic1 DISPLAY"indic2 should be -1; its value is ", indic2 if (ct NOT = "Vienna"OR ename NOT = "Betty") then MOVE 0 TO flag END-IF if (indic1 NOT = -1 OR indic2 NOT = -1) then MOVE 0 TO flag END-IF
MOVE"xxxxxxxxxxxxxxxxxxxx"TO ename MOVE"xxxxxxxxxxxxxxxxxxxx"TO pname MOVE"xxxxxxxxxxxxxxx"TO ct MOVE 28 TO bu DISPLAY"FETCH C14825 INTO :ct, :ename, :pname:indic1,
- " :bu:indic2;" * EXEC SQL FETCH C14825 INTO :ct, :ename, :pname:indic1, * :bu:indic2; CALL"SUB63"USINGSQLCODE SQLSTATE ct ename pname
indic1 bu indic2 MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"ct should be Vienna; its value is ", ct DISPLAY"ename should be Carmen; its value is ", ename DISPLAY"indic1 should be -1; its value is ", indic1 DISPLAY"indic2 should be -1; its value is ", indic2 if (ct NOT = "Vienna"OR ename NOT = "Carmen") then MOVE 0 TO flag END-IF if (indic1 NOT = -1 OR indic2 NOT = -1) then MOVE 0 TO flag END-IF
DISPLAY"FETCH C14825 INTO :ct, :ename, :pname:indic1,
- " :bu:indic2;" * EXEC SQL FETCH C14825 INTO :ct, :ename, :pname:indic1, * :bu:indic2; CALL"SUB64"USINGSQLCODE SQLSTATE ct ename pname indic1
bu indic2 MOVESQLCODETO SQL-COD DISPLAY"SQLCODE should be 100; its value is ", SQL-COD DISPLAY"SQLSTATE should be 02000; its value is ", SQLSTATE PERFORM NOSUBCLASS THRU EXIT-NOSUBCLASS if (SQLCODENOT = 100 OR NORMSQ NOT = "02000") then MOVE 0 TO flag END-IF if (NORMSQ = "02000"AND NORMSQ NOT = SQLSTATE) then DISPLAY"Valid implementation-defined SQLSTATE accepted." END-IF DISPLAY" "
*Subtest number six *Correlation name with self-JOIN
DISPLAY"DECLARE C14826 CURSOR FOR" DISPLAY" SELECT XX.T_INT, YY.T_INT" DISPLAY" FROM SEVEN_TYPES XX RIGHT OUTER JOIN SEVEN_TYPES
- " YY" DISPLAY" ON XX.T_INT = YY.T_INT +1" DISPLAY" ORDER BY YY.T_INT;" * EXEC SQL DECLARE C14826 CURSOR FOR * SELECT XX.T_INT, YY.T_INT * FROM SEVEN_TYPES XX RIGHT OUTER JOIN SEVEN_TYPES YY * ON XX.T_INT = YY.T_INT +1 * ORDER BY YY.T_INT END-EXEC
MOVE 0 TO int1 MOVE 40 TO indic1 MOVE 0 TO int2 DISPLAY"FETCH C14826 INTO :int1:indic1, :int2;" * EXEC SQL FETCH C14826 INTO :int1:indic1, :int2; CALL"SUB67"USINGSQLCODE SQLSTATE int1 indic1 int2 MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"int1 should be 2; its value is ", int1 DISPLAY"indic1 should be 0; its value is ", indic1 DISPLAY"int2 should be 1; its value is ", int2 if (int1 NOT = 2 OR indic1 NOT = 0) then MOVE 0 TO flag END-IF if (int2 NOT = 1) then MOVE 0 TO flag END-IF
MOVE 0 TO int1 MOVE 40 TO indic1 MOVE 0 TO int2 DISPLAY"FETCH C14826 INTO :int1:indic1, :int2;" * EXEC SQL FETCH C14826 INTO :int1:indic1, :int2; CALL"SUB68"USINGSQLCODE SQLSTATE int1 indic1 int2 MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"int1 should be 3; its value is ", int1 DISPLAY"indic1 should be 0; its value is ", indic1 DISPLAY"int2 should be 2; its value is ", int2 if (int1 NOT = 3 OR indic1 NOT = 0) then MOVE 0 TO flag END-IF if (int2 NOT = 2) then MOVE 0 TO flag END-IF
MOVE 0 TO int1 MOVE 40 TO indic1 MOVE 0 TO int2 DISPLAY"FETCH C14826 INTO :int1:indic1, :int2;" * EXEC SQL FETCH C14826 INTO :int1:indic1, :int2; CALL"SUB69"USINGSQLCODE SQLSTATE int1 indic1 int2 MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"indic1 should be -1; its value is ", indic1 DISPLAY"int2 should be 3; its value is ", int2 if (indic1 NOT = -1 OR int2 NOT = 3) then MOVE 0 TO flag END-IF
MOVE 0 TO gr MOVE 0.0 TO flt1 MOVE 0.0 TO flt2 MOVE 40 TO indic1 MOVE 40 TO indic2 DISPLAY"FETCH C14827 INTO :gr, :flt1:indic1,
- " :flt2:indic2;" * EXEC SQL FETCH C14827 INTO :gr, :flt1:indic1, :flt2:indic2 * ; CALL"SUB72"USINGSQLCODE SQLSTATE gr flt1 indic1
flt2 indic2 MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"gr should be 10; its value is ", gr MOVE flt1 TO FLT-1 DISPLAY"flt1 should be -444 +- 0.1; its value is ", FLT-1 MOVE flt2 TO FLT-1 DISPLAY"flt2 should be -55 +- 0.1; its value is ", FLT-1 if (gr NOT = 10) then MOVE 0 TO flag END-IF if (flt1 < -444.1 OR flt1 > -443.9) then MOVE 0 TO flag END-IF if (flt2 < -55.1 OR flt2 > -54.9) then MOVE 0 TO flag END-IF
MOVE 0 TO gr MOVE 0.0 TO flt1 MOVE 0.0 TO flt2 MOVE 40 TO indic1 MOVE 40 TO indic2 DISPLAY"FETCH C14827 INTO :gr, :flt1:indic1,
- " :flt2:indic2;" * EXEC SQL FETCH C14827 INTO :gr, :flt1:indic1, :flt2:indic2 * ; CALL"SUB73"USINGSQLCODE SQLSTATE gr flt1 indic1
flt2 indic2 MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"gr should be 12; its value is ", gr DISPLAY"indic1 should be -1; its value is ", indic1 DISPLAY"indic2 should be -1; its value is ", indic2 if (gr NOT = 12) then MOVE 0 TO flag END-IF if (indic1 NOT = -1 OR indic2 NOT = -1) then MOVE 0 TO flag END-IF
MOVE 0 TO gr MOVE 0.0 TO flt1 MOVE 0.0 TO flt2 MOVE 40 TO indic1 MOVE 40 TO indic2 DISPLAY"FETCH C14827 INTO :gr, :flt1:indic1,
- " :flt2:indic2;" * EXEC SQL FETCH C14827 INTO :gr, :flt1:indic1, :flt2:indic2 * ; CALL"SUB74"USINGSQLCODE SQLSTATE gr flt1 indic1
flt2 indic2 MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"gr should be 12; its value is ", gr DISPLAY"indic1 should be -1; its value is ", indic1 DISPLAY"indic2 should be -1; its value is ", indic2 if (gr NOT = 12) then MOVE 0 TO flag END-IF if (indic1 NOT = -1 OR indic2 NOT = -1) then MOVE 0 TO flag END-IF
MOVE 0 TO gr MOVE 0.0 TO flt1 MOVE 0.0 TO flt2 MOVE 40 TO indic1 MOVE 40 TO indic2 DISPLAY"FETCH C14827 INTO :gr, :flt1:indic1,
- " :flt2:indic2;" * EXEC SQL FETCH C14827 INTO :gr, :flt1:indic1, :flt2:indic2 * ; CALL"SUB75"USINGSQLCODE SQLSTATE gr flt1 indic1
flt2 indic2 MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"gr should be 13; its value is ", gr MOVE flt1 TO FLT-1 DISPLAY"flt1 should be 44 +- 0.1; its value is ", FLT-1 MOVE flt2 TO FLT-1 DISPLAY"flt2 should be 555 +- 0.1; its value is ", FLT-1 if (gr NOT = 13) then MOVE 0 TO flag END-IF if (flt1 < 43.9 OR flt1 > 44.1) then MOVE 0 TO flag END-IF if (flt2 < 554.9 OR flt2 > 555.1) then MOVE 0 TO flag END-IF
MOVE 0 TO gr MOVE 0.0 TO flt1 MOVE 0.0 TO flt2 MOVE 40 TO indic1 MOVE 40 TO indic2 DISPLAY"FETCH C14827 INTO :gr, :flt1:indic1,
- " :flt2:indic2;" * EXEC SQL FETCH C14827 INTO :gr, :flt1:indic1, :flt2:indic2 * ; CALL"SUB76"USINGSQLCODE SQLSTATE gr flt1 indic1
flt2 indic2 MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"gr should be 13; its value is ", gr MOVE flt1 TO FLT-1 DISPLAY"flt1 should be 44 +- 0.1; its value is ", FLT-1 MOVE flt2 TO FLT-1 DISPLAY"flt2 should be 555 +- 0.1; its value is ", FLT-1 if (gr NOT = 13) then MOVE 0 TO flag END-IF if (flt1 < 43.9 OR flt1 > 44.1) then MOVE 0 TO flag END-IF if (flt2 < 554.9 OR flt2 > 555.1) then MOVE 0 TO flag END-IF
DISPLAY"FETCH C14827 INTO :gr, :flt1:indic1,
- " :flt2:indic2;" * EXEC SQL FETCH C14827 INTO :gr, :flt1:indic1, :flt2:indic2 * ; CALL"SUB77"USINGSQLCODE SQLSTATE gr flt1 indic1
flt2 indic2 MOVESQLCODETO SQL-COD DISPLAY"SQLCODE should be 100; its value is ", SQL-COD DISPLAY"SQLSTATE should be 02000; its value is ", SQLSTATE PERFORM NOSUBCLASS THRU EXIT-NOSUBCLASS if (SQLCODENOT = 100 OR NORMSQ NOT = "02000") then MOVE 0 TO flag END-IF if (NORMSQ = "02000"AND NORMSQ NOT = SQLSTATE) then DISPLAY"Valid implementation-defined SQLSTATE accepted." END-IF DISPLAY" "
* EXEC SQL COMMIT WORK; CALL"SUB83"USINGSQLCODE SQLSTATE MOVESQLCODETO SQL-COD ******************** END TEST0844 ******************** **** 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 (SQLCODENOT = 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.
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.32 Sekunden
(vorverarbeitet am 2026-04-29)
¤
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.