* Standard COBOL (file "YTS806.SCO") calling SQL * procedures in file "YTS806.MCO".
*Copyright 1996 National Computing Centre Ltd, *and Computer Logic R&D S.A *on behalf of 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 * * YTS806.SCO * WRITTEN BY: Susan Watters * TRANSLATED AUTOMATICALLY FROM EMBEDDED COBOL BY CHRIS SCHANZLE * * This routine tests NATURAL FULL OUTER JOIN <table ref> - * dynamic * * * REFERENCES * 7.5 <joined table> * 7.5 SR.6 * 7.5 GR.1d * 7.5 GR.5d * 7.5 GR.6a * 17.1 Description of SQL item descriptor areas * 17.2 <allocate descriptor statement> * 17.3 <deallocate descriptor statement> * 17.4 <get descriptor statement> * 17.6 <prepare statement> * 17.7 <deallocate prepared statement> * 17.8 <describe statement> * 17.9 <using clause> * 17.12 <dynamic declare cursor> * 17.14 <dynamic open statement> * 17.15 <dynamic fetch statement> * 17.16 <dynamic close statement> * F#4 Joined table * F#40 Full outer join * F#1 Dynamic SQL * * DATE LAST ALTERED 02.01.96 CTS5 Hand-over Test * * QA Status: Full FC * * Revised by DWF 1996-03-27 * Added rollback after authid * Removed EXEC SQL from printf * Renamed variables * Fixed coding rule violations * Fixed syntax errors * Fixed descriptor usage * Fixed string lengths * Fixed printout * Fixed expected results ****************************************************************
* EXEC SQL DELETE FROM CTS1.CONCATBUF; CALL"SUB19"USINGSQLCODE SQLSTATE MOVESQLCODETO SQL-COD * EXEC SQL INSERT INTO CTS1.CONCATBUF VALUES ( * 'SELECT * FROM STAFF1 NATURAL FULL OUTER JOIN' || * ' STAFFA ORDER BY EMPNUM, EMPNAME, GRADE, PNUM' * ); CALL"SUB20"USINGSQLCODE SQLSTATE MOVESQLCODETO SQL-COD * EXEC SQL SELECT ZZ INTO :longst FROM CTS1.CONCATBUF * ; CALL"SUB21"USINGSQLCODE SQLSTATE longst MOVESQLCODETO SQL-COD DISPLAY"longst=""", longst, """"
DISPLAY"PREPARE sn FROM :longst;" * EXEC SQL PREPARE sn FROM :longst; CALL"SUB22"USINGSQLCODE SQLSTATE longst MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY" "
*Demand that they be able to allocate at least 7. This is an *Intermediate test, so their descriptors have no excuse to be *wimpy.
DISPLAY"ALLOCATE DESCRIPTOR 'dn' WITH MAX 7;" * EXEC SQL ALLOCATE DESCRIPTOR 'dn' WITH MAX 7; CALL"SUB23"USINGSQLCODE SQLSTATE MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY" "
DISPLAY"DESCRIBE sn USING SQL DESCRIPTOR 'dn';" * EXEC SQL DESCRIBE sn USING SQL DESCRIPTOR 'dn'; CALL"SUB24"USINGSQLCODE SQLSTATE MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY" "
MOVE"xxxxxxxxxxxxxxxxxxxx"TO colnam MOVE 0 TO coltyp DISPLAY"GET DESCRIPTOR 'dn' VALUE 1 :colnam = NAME,
- " :coltyp = TYPE;" * EXEC SQL GET DESCRIPTOR 'dn' VALUE 1 :colnam = NAME, * :coltyp = TYPE; CALL"SUB25"USINGSQLCODE SQLSTATE colnam coltyp MOVESQLCODETO SQL-COD DISPLAY"colnam should be EMPNUM; its value is ", colnam DISPLAY"coltyp should be 1 (CHAR); its value is ", coltyp if (colnam NOT = "EMPNUM"OR coltyp NOT = 1) then MOVE 0 TO flag END-IF
MOVE"xxxxxxxxxxxxxxxxxxxx"TO colnam MOVE 0 TO coltyp DISPLAY"GET DESCRIPTOR 'dn' VALUE 2 :colnam = NAME,
- " :coltyp = TYPE;" * EXEC SQL GET DESCRIPTOR 'dn' VALUE 2 :colnam = NAME, * :coltyp = TYPE; CALL"SUB26"USINGSQLCODE SQLSTATE colnam coltyp MOVESQLCODETO SQL-COD DISPLAY"colnam should be EMPNAME; its value is ", colnam DISPLAY"coltyp should be 1 (CHAR); its value is ", coltyp if (colnam NOT = "EMPNAME"OR coltyp NOT = 1) then MOVE 0 TO flag END-IF
MOVE"xxxxxxxxxxxxxxxxxxxx"TO colnam MOVE 0 TO coltyp DISPLAY"GET DESCRIPTOR 'dn' VALUE 3 :colnam = NAME,
- " :coltyp = TYPE;" * EXEC SQL GET DESCRIPTOR 'dn' VALUE 3 :colnam = NAME, * :coltyp = TYPE; CALL"SUB27"USINGSQLCODE SQLSTATE colnam coltyp MOVESQLCODETO SQL-COD DISPLAY"colnam should be GRADE; its value is ", colnam DISPLAY"coltyp should be 3 (DECIMAL); its value is ",
coltyp if (colnam NOT = "GRADE"OR coltyp NOT = 3) then MOVE 0 TO flag END-IF
MOVE"xxxxxxxxxxxxxxxxxxxx"TO colnam MOVE 0 TO coltyp DISPLAY"GET DESCRIPTOR 'dn' VALUE 4 :colnam = NAME,
- " :coltyp = TYPE;" * EXEC SQL GET DESCRIPTOR 'dn' VALUE 4 :colnam = NAME, * :coltyp = TYPE; CALL"SUB28"USINGSQLCODE SQLSTATE colnam coltyp MOVESQLCODETO SQL-COD DISPLAY"colnam should be CITY; its value is ", colnam DISPLAY"coltyp should be 1 (CHAR); its value is ", coltyp if (colnam NOT = "CITY"OR coltyp NOT = 1) then MOVE 0 TO flag END-IF
MOVE"xxxxxxxxxxxxxxxxxxxx"TO colnam MOVE 0 TO coltyp DISPLAY"GET DESCRIPTOR 'dn' VALUE 5 :colnam = NAME,
- " :coltyp = TYPE;" * EXEC SQL GET DESCRIPTOR 'dn' VALUE 5 :colnam = NAME, * :coltyp = TYPE; CALL"SUB29"USINGSQLCODE SQLSTATE colnam coltyp MOVESQLCODETO SQL-COD DISPLAY"colnam should be HOURS; its value is ", colnam DISPLAY"coltyp should be 4 (INT); its value is ", coltyp if (colnam NOT = "HOURS"OR coltyp NOT = 4) then MOVE 0 TO flag END-IF
MOVE"xxxxxxxxxxxxxxxxxxxx"TO colnam MOVE 0 TO coltyp DISPLAY"GET DESCRIPTOR 'dn' VALUE 6 :colnam = NAME,
- " :coltyp = TYPE;" * EXEC SQL GET DESCRIPTOR 'dn' VALUE 6 :colnam = NAME, * :coltyp = TYPE; CALL"SUB30"USINGSQLCODE SQLSTATE colnam coltyp MOVESQLCODETO SQL-COD DISPLAY"colnam should be SALARY; its value is ", colnam DISPLAY"coltyp should be 3 (DECIMAL); its value is ",
coltyp if (colnam NOT = "SALARY"OR coltyp NOT = 3) then MOVE 0 TO flag END-IF
MOVE"xxxxxxxxxxxxxxxxxxxx"TO colnam MOVE 0 TO coltyp DISPLAY"GET DESCRIPTOR 'dn' VALUE 7 :colnam = NAME,
- " :coltyp = TYPE;" * EXEC SQL GET DESCRIPTOR 'dn' VALUE 7 :colnam = NAME, * :coltyp = TYPE; CALL"SUB31"USINGSQLCODE SQLSTATE colnam coltyp MOVESQLCODETO SQL-COD DISPLAY"colnam should be PNUM; its value is ", colnam DISPLAY"coltyp should be 3 (DECIMAL); its value is ",
coltyp if (colnam NOT = "PNUM"OR coltyp NOT = 3) then MOVE 0 TO flag END-IF
*execute a <dynamic declare cursor> for statement sn
DISPLAY"DECLARE cn CURSOR for sn;" * EXEC SQL DECLARE cn CURSOR FOR sn END-EXEC
MOVE"xxx"TO eno MOVE"xxxxxxxxxxxxxxxxxxxx"TO enaam COMPUTE grd = -1 MOVE"xxxxxxxxxxxxxxx"TO cit COMPUTE hrs = -1 COMPUTE sal = -1 COMPUTE pno = -1 DISPLAY"FETCH cn INTO :eno, :enaam, :grd, :cit, :hrs,
- " :sal, :pno;" * EXEC SQL FETCH cn INTO * :eno, :enaam, :grd, :cit, :hrs, :sal, :pno; CALL"SUB33"USINGSQLCODE SQLSTATE eno enaam grd cit hrs
sal pno MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"eno should be E1; its value is ", eno DISPLAY"enaam should be Alice; its value is ", enaam DISPLAY"grd should be 4; its value is ", grd DISPLAY"cit should be Lyon; its value is ", cit DISPLAY"hrs should be 20; its value is ", hrs DISPLAY"sal should be 40000; its value is ", sal DISPLAY"pno should be 11; its value is ", pno if (eno NOT = "E1"OR enaam NOT = "Alice"OR
grd NOT = 4) then MOVE 0 TO flag END-IF if (cit NOT = "Lyon"OR hrs NOT = 20 OR sal NOT
= 40000) then MOVE 0 TO flag END-IF if (pno NOT = 11) then MOVE 0 TO flag END-IF
MOVE"xxx"TO eno MOVE"xxxxxxxxxxxxxxxxxxxx"TO enaam COMPUTE grd = -1 MOVE"xxxxxxxxxxxxxxx"TO cit COMPUTE hrs = -1 COMPUTE sal = -1 COMPUTE pno = -1 DISPLAY"FETCH cn INTO :eno, :enaam, :grd, :cit, :hrs,
- " :sal, :pno;" * EXEC SQL FETCH cn INTO * :eno, :enaam, :grd, :cit, :hrs, :sal, :pno; CALL"SUB34"USINGSQLCODE SQLSTATE eno enaam grd cit hrs
sal pno MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"eno should be E1; its value is ", eno DISPLAY"enaam should be Alice; its value is ", enaam DISPLAY"grd should be 8; its value is ", grd DISPLAY"cit should be Lyon; its value is ", cit DISPLAY"hrs should be 20; its value is ", hrs DISPLAY"sal should be 40000; its value is ", sal DISPLAY"pno should be 11; its value is ", pno if (eno NOT = "E1"OR enaam NOT = "Alice"OR
grd NOT = 8) then MOVE 0 TO flag END-IF if (cit NOT = "Lyon"OR hrs NOT = 20 OR sal NOT
= 40000) then MOVE 0 TO flag END-IF if (pno NOT = 11) then MOVE 0 TO flag END-IF
MOVE"xxx"TO eno MOVE"xxxxxxxxxxxxxxxxxxxx"TO enaam COMPUTE grd = -1 MOVE"xxxxxxxxxxxxxxx"TO cit COMPUTE hrs = -1 COMPUTE sal = -1 COMPUTE pno = -1 DISPLAY"FETCH cn INTO :eno, :enaam, :grd, :cit, :hrs,
- " :sal, :pno;" * EXEC SQL FETCH cn INTO * :eno, :enaam, :grd, :cit, :hrs, :sal, :pno; CALL"SUB35"USINGSQLCODE SQLSTATE eno enaam grd cit hrs
sal pno MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"eno should be E1; its value is ", eno DISPLAY"enaam should be Alice; its value is ", enaam DISPLAY"grd should be 12; its value is ", grd DISPLAY"cit should be Geneva; its value is ", cit DISPLAY"hrs should be 20; its value is ", hrs DISPLAY"sal should be 40000; its value is ", sal DISPLAY"pno should be 11; its value is ", pno if (eno NOT = "E1"OR enaam NOT = "Alice"OR
grd NOT = 12) then MOVE 0 TO flag END-IF if (cit NOT = "Geneva"OR hrs NOT = 20 OR sal NOT = 40000) then MOVE 0 TO flag END-IF if (pno NOT = 11) then MOVE 0 TO flag END-IF
MOVE"xxx"TO eno MOVE"xxxxxxxxxxxxxxxxxxxx"TO enaam COMPUTE grd = -1 MOVE"xxxxxxxxxxxxxxx"TO cit COMPUTE hrs = -1 COMPUTE sal = -1 COMPUTE pno = -1 DISPLAY"FETCH cn INTO :eno, :enaam, :grd, :cit, :hrs,
- " :sal, :pno;" * EXEC SQL FETCH cn INTO * :eno, :enaam, :grd, :cit, :hrs, :sal, :pno; CALL"SUB36"USINGSQLCODE SQLSTATE eno enaam grd cit hrs
sal pno MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"eno should be E2; its value is ", eno DISPLAY"enaam should be Betty; its value is ", enaam DISPLAY"grd should be 16; its value is ", grd DISPLAY"cit should be Strasbourg; its value is ", cit DISPLAY"hrs should be 15; its value is ", hrs DISPLAY"sal should be 20000; its value is ", sal DISPLAY"pno should be 12; its value is ", pno if (eno NOT = "E2"OR enaam NOT = "Betty"OR
grd NOT = 16) then MOVE 0 TO flag END-IF if (cit NOT = "Strasbourg"OR hrs NOT = 15 OR sal NOT = 20000) then MOVE 0 TO flag END-IF if (pno NOT = 12) then MOVE 0 TO flag END-IF
MOVE"xxx"TO eno MOVE"xxxxxxxxxxxxxxxxxxxx"TO enaam COMPUTE grd = -1 MOVE"xxxxxxxxxxxxxxx"TO cit COMPUTE hrs = -1 COMPUTE sal = -1 COMPUTE pno = -1 DISPLAY"FETCH cn INTO :eno, :enaam, :grd, :cit, :hrs,
- " :sal, :pno;" * EXEC SQL FETCH cn INTO * :eno, :enaam, :grd, :cit, :hrs, :sal, :pno; CALL"SUB37"USINGSQLCODE SQLSTATE eno enaam grd cit hrs
sal pno MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"eno should be E2; its value is ", eno DISPLAY"enaam should be Betty; its value is ", enaam DISPLAY"grd should be 16; its value is ", grd DISPLAY"cit should be Strasbourg; its value is ", cit DISPLAY"hrs should be 15; its value is ", hrs DISPLAY"sal should be 20000; its value is ", sal DISPLAY"pno should be 13; its value is ", pno if (eno NOT = "E2"OR enaam NOT = "Betty"OR
grd NOT = 16) then MOVE 0 TO flag END-IF if (cit NOT = "Strasbourg"OR hrs NOT = 15 OR sal NOT = 20000) then MOVE 0 TO flag END-IF if (pno NOT = 13) then MOVE 0 TO flag END-IF
MOVE"xxx"TO eno MOVE"xxxxxxxxxxxxxxxxxxxx"TO enaam COMPUTE grd = -1 MOVE"xxxxxxxxxxxxxxx"TO cit COMPUTE hrs = -1 COMPUTE sal = -1 COMPUTE pno = -1 DISPLAY"FETCH cn INTO :eno, :enaam, :grd, :cit, :hrs,
- " :sal, :pno;" * EXEC SQL FETCH cn INTO * :eno, :enaam, :grd, :cit, :hrs, :sal, :pno; CALL"SUB38"USINGSQLCODE SQLSTATE eno enaam grd cit hrs
sal pno MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"eno should be E2; its value is ", eno DISPLAY"enaam should be Betty; its value is ", enaam DISPLAY"grd should be 20; its value is ", grd DISPLAY"cit should be Munich; its value is ", cit DISPLAY"hrs should be 15; its value is ", hrs DISPLAY"sal should be 20000; its value is ", sal DISPLAY"pno should be 12; its value is ", pno if (eno NOT = "E2"OR enaam NOT = "Betty"OR
grd NOT = 20) then MOVE 0 TO flag END-IF if (cit NOT = "Munich"OR hrs NOT = 15 OR sal NOT = 20000) then MOVE 0 TO flag END-IF if (pno NOT = 12) then MOVE 0 TO flag END-IF
MOVE"xxx"TO eno MOVE"xxxxxxxxxxxxxxxxxxxx"TO enaam COMPUTE grd = -1 MOVE"xxxxxxxxxxxxxxx"TO cit COMPUTE hrs = -1 COMPUTE sal = -1 COMPUTE pno = -1 DISPLAY"FETCH cn INTO :eno, :enaam, :grd, :cit, :hrs,
- " :sal, :pno;" * EXEC SQL FETCH cn INTO * :eno, :enaam, :grd, :cit, :hrs, :sal, :pno; CALL"SUB39"USINGSQLCODE SQLSTATE eno enaam grd cit hrs
sal pno MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"eno should be E2; its value is ", eno DISPLAY"enaam should be Betty; its value is ", enaam DISPLAY"grd should be 20; its value is ", grd DISPLAY"cit should be Munich; its value is ", cit DISPLAY"hrs should be 15; its value is ", hrs DISPLAY"sal should be 20000; its value is ", sal DISPLAY"pno should be 13; its value is ", pno if (eno NOT = "E2"OR enaam NOT = "Betty"OR
grd NOT = 20) then MOVE 0 TO flag END-IF if (cit NOT = "Munich"OR hrs NOT = 15 OR sal NOT = 20000) then MOVE 0 TO flag END-IF if (pno NOT = 13) then MOVE 0 TO flag END-IF
MOVE"xxx"TO eno MOVE"xxxxxxxxxxxxxxxxxxxx"TO enaam COMPUTE grd = -1 MOVE"xxxxxxxxxxxxxxx"TO cit COMPUTE hrs = -1 COMPUTE sal = -1 COMPUTE pno = -1 DISPLAY"FETCH cn INTO :eno, :enaam, :grd, :cit, :hrs,
- " :sal, :pno;" * EXEC SQL FETCH cn INTO * :eno, :enaam, :grd, :cit, :hrs, :sal, :pno; CALL"SUB40"USINGSQLCODE SQLSTATE eno enaam grd cit hrs
sal pno MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"eno should be E3; its value is ", eno DISPLAY"enaam should be Colin; its value is ", enaam DISPLAY"grd should be 24; its value is ", grd DISPLAY"cit should be Leuven; its value is ", cit DISPLAY"hrs should be 10; its value is ", hrs DISPLAY"sal should be 15000; its value is ", sal DISPLAY"pno should be 14; its value is ", pno if (eno NOT = "E3"OR enaam NOT = "Colin"OR
grd NOT = 24) then MOVE 0 TO flag END-IF if (cit NOT = "Leuven"OR hrs NOT = 10 OR sal NOT = 15000) then MOVE 0 TO flag END-IF if (pno NOT = 14) then MOVE 0 TO flag END-IF
MOVE"xxx"TO eno MOVE"xxxxxxxxxxxxxxxxxxxx"TO enaam COMPUTE grd = -1 MOVE"xxxxxxxxxxxxxxx"TO cit COMPUTE hrs = -1 COMPUTE sal = -1 COMPUTE pno = -1 DISPLAY"FETCH cn INTO :eno, :enaam, :grd, :cit, :hrs,
- " :sal, :pno;" * EXEC SQL FETCH cn INTO * :eno, :enaam, :grd, :cit, :hrs, :sal, :pno; CALL"SUB41"USINGSQLCODE SQLSTATE eno enaam grd cit hrs
sal pno MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"eno should be E3; its value is ", eno DISPLAY"enaam should be Colin; its value is ", enaam DISPLAY"grd should be 24; its value is ", grd DISPLAY"cit should be Leuven; its value is ", cit DISPLAY"hrs should be 10; its value is ", hrs DISPLAY"sal should be 8000; its value is ", sal DISPLAY"pno should be 15; its value is ", pno if (eno NOT = "E3"OR enaam NOT = "Colin"OR
grd NOT = 24) then MOVE 0 TO flag END-IF if (cit NOT = "Leuven"OR hrs NOT = 10 OR sal NOT = 8000) then MOVE 0 TO flag END-IF if (pno NOT = 15) then MOVE 0 TO flag END-IF
MOVE"xxx"TO eno MOVE"xxxxxxxxxxxxxxxxxxxx"TO enaam COMPUTE grd = -1 MOVE"xxxxxxxxxxxxxxx"TO cit COMPUTE hrs = -1 COMPUTE sal = -1 COMPUTE pno = -1 DISPLAY"FETCH cn INTO :eno, :enaam, :grd, :cit, :hrs,
- " :sal, :pno;" * EXEC SQL FETCH cn INTO * :eno, :enaam, :grd, :cit, :hrs, :sal, :pno; CALL"SUB42"USINGSQLCODE SQLSTATE eno enaam grd cit hrs
sal pno MOVESQLCODETO SQL-COD PERFORM CHCKOK DISPLAY"eno should be E3; its value is ", eno DISPLAY"enaam should be Colin; its value is ", enaam DISPLAY"grd should be 24; its value is ", grd DISPLAY"cit should be Leuven; its value is ", cit DISPLAY"hrs should be 10; its value is ", hrs DISPLAY"sal should be 8000; its value is ", sal DISPLAY"pno should be 16; its value is ", pno if (eno NOT = "E3"OR enaam NOT = "Colin"OR
grd NOT = 24) then MOVE 0 TO flag END-IF if (cit NOT = "Leuven"OR hrs NOT = 10 OR sal NOT = 8000) then MOVE 0 TO flag END-IF if (pno NOT = 16) then MOVE 0 TO flag END-IF
MOVE"xxx"TO eno MOVE"xxxxxxxxxxxxxxxxxxxx"TO enaam COMPUTE grd = -1 MOVE"xxxxxxxxxxxxxxx"TO cit MOVE 99 TO indic1 MOVE 99 TO indic2 MOVE 99 TO indic3 DISPLAY"FETCH cn INTO :eno, :enaam, :grd, :cit,
- " :hrs:indic1," DISPLAY":sal:indic2, :pno:indic3;" * EXEC SQL FETCH cn INTO * :eno, :enaam, :grd, :cit, :hrs:indic1, :sal:indic2, * :pno:indic3; CALL"SUB43"USINGSQLCODE SQLSTATE eno enaam grd cit hrs
indic1 sal indic2 pno indic3 MOVESQLCODETO SQL-COD DISPLAY"eno should be E4; its value is ", eno DISPLAY"enaam should be Daniel; its value is ", enaam DISPLAY"grd should be 28; its value is ", grd DISPLAY"cit should be Cologne; its value is ", cit DISPLAY"indic1 should be -1; its value is ", indic1 DISPLAY"indic2 should be -1; its value is ", indic2 DISPLAY"indic3 should be -1; its value is ", indic3 if (eno NOT = "E4"OR enaam NOT = "Daniel"OR
grd NOT = 28) then MOVE 0 TO flag END-IF if (cit NOT = "Cologne"OR indic1 NOT = -1 OR
indic2 NOT = -1) then MOVE 0 TO flag END-IF if (indic3 NOT = -1) then MOVE 0 TO flag END-IF
MOVE"xxx"TO eno MOVE"xxxxxxxxxxxxxxxxxxxx"TO enaam MOVE 99 TO indic1 MOVE 99 TO indic2 COMPUTE hrs = -1 COMPUTE sal = -1 COMPUTE pno = -1 DISPLAY"FETCH cn INTO " DISPLAY":eno, :enaam, :grd:indic1, :cit:indic2, :hrs,
- " :sal, :pno;" * EXEC SQL FETCH cn INTO * :eno, :enaam, :grd:indic1, :cit:indic2, :hrs, :sal, :pno * ; CALL"SUB44"USINGSQLCODE SQLSTATE eno enaam grd indic1
cit indic2 hrs sal pno MOVESQLCODETO SQL-COD DISPLAY"eno should be E5; its value is ", eno DISPLAY"enaam should be Edward; its value is ", enaam DISPLAY"hrs should be 30; its value is ", hrs DISPLAY"sal should be 50000; its value is ", sal DISPLAY"pno should be 17; its value is ", pno DISPLAY"indic1 should be -1; its value is ", indic1 DISPLAY"indic2 should be -1; its value is ", indic2 if (eno NOT = "E5"OR enaam NOT = "Edward") then MOVE 0 TO flag END-IF if (indic1 NOT = -1 OR indic2 NOT = -1) then MOVE 0 TO flag END-IF if (hrs NOT = 30 OR sal NOT = 50000) then MOVE 0 TO flag END-IF if (pno NOT = 17) then MOVE 0 TO flag END-IF
DISPLAY"FETCH cn INTO :eno, :enaam, :grd, :cit, :hrs,
- " :sal, :pno;" * EXEC SQL FETCH cn INTO * :eno, :enaam, :grd, :cit, :hrs, :sal, :pno; CALL"SUB45"USINGSQLCODE SQLSTATE eno enaam grd cit hrs
sal pno MOVESQLCODETO SQL-COD
*That should generate a no data exception *which is SQLSTATE 02000
DISPLAY"SQLCODE should be 100; its value is ", SQL-COD if (SQLCODENOT = 100) then MOVE 0 TO flag END-IF DISPLAY"SQLSTATE should be 02000; its value is ", SQLSTATE PERFORM NOSUBCLASS THRU EXIT-NOSUBCLASS if (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" "
**** 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.21 Sekunden
(vorverarbeitet am 2026-05-02)
¤
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.