**************************************************************** * * COMMENT SECTION * * DATE 1996-05-13 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. * * DML174.PCO * WRITTEN BY: David Flater * TRANSLATED AUTOMATICALLY FROM EMBEDDED C BY CHRIS SCHANZLE * * This routine tests Intermediate SQL. * * REFERENCES * FIPS PUB 127-2 14.2 Intermediate SQL * ANSI SQL-1992 * ****************************************************************
MOVE"FLATER "TO uid CALL"AUTHID"USING uid MOVE"not logged in, not"TO uidx EXECSQLSELECT USER INTO :uidx FROM HU.ECCO END-EXEC MOVE SQLCODE TO SQL-COD EXECSQL ROLLBACK WORK END-EXEC MOVE SQLCODE TO SQL-COD if (uid NOT = uidx) then DISPLAY"ERROR: User ", uid, " expected. User ", uidx, "
- " connected" STOPRUN END-IF MOVE 0 TO errcnt
DISPLAY "SQL Test Suite, V6.0, Embedded COBOL, dml174.pco" DISPLAY "59-byte ID" DISPLAY"TEd Version #" *date_time print ACCEPT TO-DAY FROMDATE ACCEPT THE-TIME FROMTIME DISPLAY"Date run YYMMDD: " TO-DAY " at hhmmssff: " THE-TIME
******************** BEGIN TEST0886 ******************* MOVE 1 TO flag
DISPLAY" FIPS sizing TEST0886" DISPLAY" FIPS sizing, VARCHAR (1000)" DISPLAY"References:" DISPLAY" FIPS 16.6 -- Sizing #3, CHARACTER VARYING max
- " length" DISPLAY" - - - - - - - - - - - - - - - - - - -"
DISPLAY"COMMIT WORK;" EXECSQL COMMIT WORK END-EXEC MOVE SQLCODE TO SQL-COD PERFORM CHCKOK DISPLAY" "
DISPLAY"INSERT INTO CONTACTS VALUES ('Harry'," DISPLAY"'Harry works in the Redundancy Automation Division
- " of the '" DISPLAY"'Materials '" DISPLAY"'Blasting Laboratory in the National Cattle
- " Acceleration '" DISPLAY"'Project of '" DISPLAY"'lower Michigan. His job is to document the
- " trajectory of '" DISPLAY"'cattle and '" DISPLAY"'correlate the loft and acceleration versus the
- " quality of '" DISPLAY"'materials '" DISPLAY"'used in the trebuchet. He served ten years as
- " the '" DISPLAY"'vice-president in '" DISPLAY"'charge of marketing in the now defunct milk trust
- " of the '" DISPLAY"'Pennsylvania '" DISPLAY"'Coalition of All Things Bovine. Prior to that he
- " '" DISPLAY"'established himself '" DISPLAY"'as a world-class graffiti artist and source of
- " all good '" DISPLAY"'bits related '" DISPLAY"'to channel dredging in poor weather. He is
- " author of over '" DISPLAY"'ten thousand '" DISPLAY"'paperback novels, including such titles as ""How
- " Many '" DISPLAY"'Pumpkins will Fit '" DISPLAY"'on the Head of a Pin,"" ""A Whole Bunch of
- " Useless Things '" DISPLAY"'that you Don''t '" DISPLAY"'Want to Know,"" and ""How to Lift Heavy Things
- " Over your '" DISPLAY"'Head without '" DISPLAY"'Hurting Yourself or Dropping Them."" He attends
- " ANSI and '" DISPLAY"'ISO standards '" DISPLAY"'meetings in his copious free time and funds the
- " development '" DISPLAY"'of test '" DISPLAY"'suites with his pocket change.'," DISPLAY"'aardvark albatross nutmeg redundancy '" DISPLAY"'automation materials blasting '" DISPLAY"'cattle acceleration trebuchet catapult '" DISPLAY"'loft coffee java sendmail SMTP '" DISPLAY"'FTP HTTP censorship expletive senility '" DISPLAY"'extortion distortion conformity '" DISPLAY"'conformance nachos chicks goslings '" DISPLAY"'ducklings honk quack melatonin tie '" DISPLAY"'noose circulation column default '" DISPLAY"'ionic doric chlorine guanine Guam '" DISPLAY"'invasions rubicon helmet plastics '" DISPLAY"'recycle HDPE nylon ceramics plumbing '" DISPLAY"'parachute zeppelin carbon hydrogen '" DISPLAY"'vinegar sludge asphalt adhesives '" DISPLAY"'tensile magnetic Ellesmere Greenland '" DISPLAY"'Knud Rasmussen precession '" DISPLAY"'navigation positioning orbit altitude '" DISPLAY"'resistance radiation levitation '" DISPLAY"'yoga demiurge election violence '" DISPLAY"'collapsed fusion cryogenics gravity '" DISPLAY"'sincerity idiocy budget accounting '" DISPLAY"'auditing titanium torque pressure '" DISPLAY"'fragile hernia muffler cartilage '" DISPLAY"'graphics deblurring headache eyestrain '" DISPLAY"'interlace bandwidth resolution '" DISPLAY"'determination steroids barrel oak wine '" DISPLAY"'ferment yeast brewing bock siphon '" DISPLAY"'clarity impurities SQL RBAC data '" DISPLAY"'warehouse security integrity feedback');" EXECSQLINSERTINTO CONTACTS VALUES ('Harry', 'Harry works in the Redundancy Automation Division ' 'of the Materials ' 'Blasting Laboratory in the National Cattle ' 'Acceleration Project of ' 'lower Michigan. His job is to document the ' 'trajectory of cattle and ' 'correlate the loft and acceleration versus the ' 'quality of materials ' 'used in the trebuchet. He served ten years ' 'as the vice-president in ' 'charge of marketing in the now defunct milk ' 'trust of the Pennsylvania ' 'Coalition of All Things Bovine. Prior to ' 'that he established himself ' 'as a world-class graffiti artist and source of ' 'all good bits related ' 'to channel dredging in poor weather. He is author ' 'of over ten thousand ' 'paperback novels, including such titles as "How ' 'Many Pumpkins will Fit ' 'on the Head of a Pin," "A Whole Bunch of Useless ' 'Things that you Don''t ' 'Want to Know," and "How to Lift Heavy Things Over ' 'your Head without ' 'Hurting Yourself or Dropping Them." He attends ' 'ANSI and ISO standards ' 'meetings in his copious free time and funds the ' 'development of test ' 'suites with his pocket change.', 'aardvark albatross nutmeg redundancy ' 'automation materials blasting ' 'cattle acceleration trebuchet catapult ' 'loft coffee java sendmail SMTP ' 'FTP HTTP censorship expletive senility ' 'extortion distortion conformity ' 'conformance nachos chicks goslings ' 'ducklings honk quack melatonin tie ' 'noose circulation column default ' 'ionic doric chlorine guanine Guam ' 'invasions rubicon helmet plastics ' 'recycle HDPE nylon ceramics plumbing ' 'parachute zeppelin carbon hydrogen ' 'vinegar sludge asphalt adhesives ' 'tensile magnetic Ellesmere Greenland ' 'Knud Rasmussen precession ' 'navigation positioning orbit altitude ' 'resistance radiation levitation ' 'yoga demiurge election violence ' 'collapsed fusion cryogenics gravity ' 'sincerity idiocy budget accounting ' 'auditing titanium torque pressure ' 'fragile hernia muffler cartilage ' 'graphics deblurring headache eyestrain ' 'interlace bandwidth resolution ' 'determination steroids barrel oak wine ' 'ferment yeast brewing bock siphon ' 'clarity impurities SQL RBAC data ' 'warehouse security integrity feedback') END-EXEC MOVE SQLCODE TO SQL-COD PERFORM CHCKOK DISPLAY" "
MOVE 0 TO int1 DISPLAY"SELECT COUNT(*) INTO :int1" DISPLAY" FROM CONTACTS" DISPLAY" WHERE DESCRIPTION =" DISPLAY"'Harry works in the Redundancy Automation Division
- " of the ' ||" DISPLAY"'Materials ' ||" DISPLAY"'Blasting Laboratory in the National Cattle
- " Acceleration ' ||" DISPLAY"'Project of ' ||" DISPLAY"'lower Michigan. His job is to document the
- " trajectory of ' ||" DISPLAY"'cattle and ' ||" DISPLAY"'correlate the loft and acceleration versus the
- " quality of ' ||" DISPLAY"'materials ' ||" DISPLAY"'used in the trebuchet. He served ten years as
- " the ' ||" DISPLAY"'vice-president in ' ||" DISPLAY"'charge of marketing in the now defunct milk trust
- " of the ' ||" DISPLAY"'Pennsylvania ' ||" DISPLAY"'Coalition of All Things Bovine. Prior to that he
- " ' ||" DISPLAY"'established himself ' ||" DISPLAY"'as a world-class graffiti artist and source of
- " all good ' ||" DISPLAY"'bits related ' ||" DISPLAY"'to channel dredging in poor weather. He is
- " author of over ' ||" DISPLAY"'ten thousand ' ||" DISPLAY"'paperback novels, including such titles as ""How
- " Many ' ||" DISPLAY"'Pumpkins will Fit ' ||" DISPLAY"'on the Head of a Pin,"" ""A Whole Bunch of
- " Useless Things ' ||" DISPLAY"'that you Don''t ' ||" DISPLAY"'Want to Know,"" and ""How to Lift Heavy Things
- " Over your ' ||" DISPLAY"'Head without ' ||" DISPLAY"'Hurting Yourself or Dropping Them."" He attends
- " ANSI and ' ||" DISPLAY"'ISO standards ' ||" DISPLAY"'meetings in his copious free time and funds the
- " development ' ||" DISPLAY"'of test ' ||" DISPLAY"'suites with his pocket change.'" DISPLAY" AND KEYWORDS =" DISPLAY"'aardvark albatross nutmeg redundancy ' ||" DISPLAY"'automation materials blasting ' ||" DISPLAY"'cattle acceleration trebuchet catapult ' ||" DISPLAY"'loft coffee java sendmail SMTP ' ||" DISPLAY"'FTP HTTP censorship expletive senility ' ||" DISPLAY"'extortion distortion conformity ' ||" DISPLAY"'conformance nachos chicks goslings ' ||" DISPLAY"'ducklings honk quack melatonin tie ' ||" DISPLAY"'noose circulation column default ' ||" DISPLAY"'ionic doric chlorine guanine Guam ' ||" DISPLAY"'invasions rubicon helmet plastics ' ||" DISPLAY"'recycle HDPE nylon ceramics plumbing ' ||" DISPLAY"'parachute zeppelin carbon hydrogen ' ||" DISPLAY"'vinegar sludge asphalt adhesives ' ||" DISPLAY"'tensile magnetic Ellesmere Greenland ' ||" DISPLAY"'Knud Rasmussen precession ' ||" DISPLAY"'navigation positioning orbit altitude ' ||" DISPLAY"'resistance radiation levitation ' ||" DISPLAY"'yoga demiurge election violence ' ||" DISPLAY"'collapsed fusion cryogenics gravity ' ||" DISPLAY"'sincerity idiocy budget accounting ' ||" DISPLAY"'auditing titanium torque pressure ' ||" DISPLAY"'fragile hernia muffler cartilage ' ||" DISPLAY"'graphics deblurring headache eyestrain ' ||" DISPLAY"'interlace bandwidth resolution ' ||" DISPLAY"'determination steroids barrel oak wine ' ||" DISPLAY"'ferment yeast brewing bock siphon ' ||" DISPLAY"'clarity impurities SQL RBAC data ' ||" DISPLAY"'warehouse security integrity feedback';" EXECSQLSELECTCOUNT(*) INTO :int1 FROM CONTACTS
WHERE DESCRIPTION = 'Harry works in the Redundancy Automation Division ' || 'of the Materials ' || 'Blasting Laboratory in the National Cattle ' || 'Acceleration Project of ' || 'lower Michigan. His job is to document the ' || 'trajectory of cattle and ' || 'correlate the loft and acceleration versus the ' || 'quality of materials ' || 'used in the trebuchet. He served ten years ' || 'as the vice-president in ' || 'charge of marketing in the now defunct milk trust ' || 'of the Pennsylvania ' || 'Coalition of All Things Bovine. Prior to that he ' || 'established himself ' || 'as a world-class graffiti artist and source of ' || 'all good bits related ' || 'to channel dredging in poor weather. He is author ' || 'of over ten thousand ' || 'paperback novels, including such titles as "How ' || 'Many Pumpkins will Fit ' || 'on the Head of a Pin," "A Whole Bunch of Useless ' || 'Things that you Don''t ' || 'Want to Know," and "How to Lift Heavy Things Over ' || 'your Head without ' || 'Hurting Yourself or Dropping Them." He attends ' || 'ANSI and ISO standards ' || 'meetings in his copious free time and funds the ' || 'development of test ' || 'suites with his pocket change.' AND KEYWORDS = 'aardvark albatross nutmeg redundancy ' || 'automation materials blasting ' || 'cattle acceleration trebuchet catapult ' || 'loft coffee java sendmail SMTP ' || 'FTP HTTP censorship expletive senility ' || 'extortion distortion conformity ' || 'conformance nachos chicks goslings ' || 'ducklings honk quack melatonin tie ' || 'noose circulation column default ' || 'ionic doric chlorine guanine Guam ' || 'invasions rubicon helmet plastics ' || 'recycle HDPE nylon ceramics plumbing ' || 'parachute zeppelin carbon hydrogen ' || 'vinegar sludge asphalt adhesives ' || 'tensile magnetic Ellesmere Greenland ' || 'Knud Rasmussen precession ' || 'navigation positioning orbit altitude ' || 'resistance radiation levitation ' || 'yoga demiurge election violence ' || 'collapsed fusion cryogenics gravity ' || 'sincerity idiocy budget accounting ' || 'auditing titanium torque pressure ' || 'fragile hernia muffler cartilage ' || 'graphics deblurring headache eyestrain ' || 'interlace bandwidth resolution ' || 'determination steroids barrel oak wine ' || 'ferment yeast brewing bock siphon ' || 'clarity impurities SQL RBAC data ' || 'warehouse security integrity feedback'END-EXEC MOVE SQLCODE TO SQL-COD PERFORM CHCKOK DISPLAY"int1 should be 1; its value is ", int1 if (int1 NOT = 1) then MOVE 0 TO flag END-IF
MOVE 99 TO int1 DISPLAY"SELECT COUNT(*) INTO :int1" DISPLAY" FROM CONTACTS" DISPLAY" WHERE DESCRIPTION LIKE '%change.'" DISPLAY" AND KEYWORDS LIKE '%feedback';" EXECSQLSELECTCOUNT(*) INTO :int1 FROM CONTACTS
WHERE DESCRIPTION LIKE '%change.' AND KEYWORDS LIKE '%feedback'END-EXEC MOVE SQLCODE TO SQL-COD PERFORM CHCKOK DISPLAY"int1 should be 1; its value is ", int1 if (int1 NOT = 1) then MOVE 0 TO flag END-IF
DISPLAY"COMMIT WORK;" EXECSQL COMMIT WORK END-EXEC MOVE SQLCODE TO SQL-COD PERFORM CHCKOK DISPLAY" "
DISPLAY"DROP TABLE CONTACTS CASCADE;" EXECSQL DROP TABLE CONTACTS CASCADE END-EXEC MOVE SQLCODE TO SQL-COD PERFORM CHCKOK DISPLAY" "
DISPLAY"COMMIT WORK;" EXECSQL COMMIT WORK END-EXEC MOVE SQLCODE TO SQL-COD PERFORM CHCKOK DISPLAY" "
if ( flag = 1 ) then DISPLAY" *** pass *** " EXECSQLINSERTINTO HU.TESTREPORT
VALUES('0886','pass','PCO') END-EXEC MOVE SQLCODE TO SQL-COD else DISPLAY" dml174.pco *** fail *** " EXECSQLINSERTINTO HU.TESTREPORT
VALUES('0886','fail','PCO') END-EXEC MOVE SQLCODE TO SQL-COD COMPUTE errcnt = errcnt + 1 END-IF
EXECSQL COMMIT WORK END-EXEC MOVE SQLCODE TO SQL-COD ******************** END TEST0886 ******************** **** 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
.
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.