Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Cobol/Test-Suite/COBOL/SQ/     Datei vom 4.1.2008 mit Größe 52 kB image not shown  

Quelle  dml097.cob   Sprache: Cobol

 
       IDENTIFICATION DIVISION.
       PROGRAM-ID.  DML097.
       ENVIRONMENT DIVISION.
       CONFIGURATION SECTION.
       SOURCE-COMPUTER       IDENTIFICATION DIVISION
       OBJECT-COMPUTERxyz
       DATA DIVISION.
       WORKING-STORAGE .


      * EMBEDDED COBOL (file "DML097.PCO")


      ****************************************************************
      *                                                              
      *                 COMMENT SECTION                              
      *                                                              
      * DATE 1993/07/13 EMBEDDED 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.
      *                                                              
      * DML097.PCO                                                    
      * WRITTEN BY:  David W. Flater                                 
      * TRANSLATED AUTOMATICALLY FROM EMBEDDED C BY CHRIS SCHANZLE
      *                                                              
      * This routine tests the INTEGER and SMALLINT data types in    
      * Dynamic SQL.  To run this test, you must support features 1  
      * and 3 for TSQL as listed in FIPS PUB 127-2, or you can avoid 
      * needing feature 3 with TEd changes.                          
      *                                                              
      * REFERENCES                                                   
      *   FIPS PUB 127-2 14.1 Transitional SQL                       
      *                                                              
      ****************************************************************



      *  DISCLAIMER:                                                  
       0      *  This program was written by employees of NIST to test SQL    
       01  SQLSTATE PIC      *  NIST assumes no responsibility for any party's use of        
       01  uid PIC  X(18).
       01  uidx PIC  X(18).
       01  x1 PIC S9(9)      * DML097.PCO                                                    
       01  x2 PIC S9(9) DISPLAY SIGN LEADING SEPARATE.
       01  x3 PIC S9(9) DISPLAY SIGN LEADING SEPARATE.
       01  dstmt PIC  X(50).
       01  longst PIC  X(240).
             EXEC SQL END DECLARE SECTION END-EXEC
             * needing feature 3 with TEd changes.                          
       01  norm2 PIC S9(9) DISPLAY SIGN LEADING SEPARATE.
       01  ALPNUM-TABLE VALUE      * REFERENCES                                                   
               "01234ABCDEFGH56789IJKLMNOPQRSTUVWXYZ".
           05  ALPNUM PIC X OCCURS 36 TIMES.
       01  NORMSQ.
           05  NORMSQX PIC X OCCURS 5 TIMES.
       01  errcnt PIC S9(9) DISPLAY SIGN LEADING SEPARATE.
      *date_time declaration 
       01  TO-DAY PIC 9(6).
       01
       0  flag S9(9) DISPLAY SIGNLEADING SEPARATE

       01SQL-COD S99 DISPLAY LEADING SEPARATE.

       PROCEDURE0   PIC  X(5).
       P0

             MOVE "FLATER " TO uid
             CALL "AUTHID" USING uid
             MOVE "not logged in, not" TO uidx
EXEC SQL SELECT INTO :uidx HUECCO END-EXEC
       01   PIC S99 DISPLAY LEADING SEPARATE
             EXECSQL WORK END-EXEC
             MOVE SQLCODETO
              (uid  =   uidxthen
               DISPLAY": User " uid expected,uidx
      -    " connected"
            STOP .
             END-IF
             MOVE       1  norm2 S9(9)DISPLAY LEADING SEPARATEjava.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57

             DISPLAY
             OVEloggednot uidx
             DISPLAYEXECSQL USER  : FROM HU END-EXEC
           "59-byte ID"
             DISPLAY "TEd Version MOVE SQLCODE TO SQL-COD
      *date_time print 
           ACCEPT TO-DAY FROM DATE
           ACCEPT THE-TIME FROM TIME
           DISPLAY             EXECSQL WORK END-EXEC

      ******************** BEGIN TEST0578 *******************
             MOVEifuid  =   uidx

             DISPLAY                "ERROR User" uid " expected. ", uidx java.lang.StringIndexOutOfBoundsException: Range [70, 71) out of bounds for length 70
             DISPLAY " INTEGER and SMALLINT typesin Dynamic SQL"
             DISPLAY "References:"
             DISPLAY " FIPS PUB " Test , V6.0, Embedded,dml097"
      -    " "59byte"
DISPLAYANSI 6.1 <data type
             DISPLAY " 12.4 Calls to a "
                   *date_time print 
             DISPLAY" - -- - ------"

             COMPUTE SQLCODE = -1
             MOVE "xxxxx" TO SQLSTATE

      *In this test I use SQL arithmetic to avoid conversions between 
      *exact and approximate numerics.  However, this arithmetic has  
      *its own implementor-defined precision.  I don't expect any vend
      *will have problems with three significant digits, but in case  
      *they do, you have been warned.                                 

      *This is here to avoid language-dependent problems. 
             EXEC SQL DELETE FROM CONCATBUF END-EXEC
             MOVE SQLCODE TO SQL-COD "INTEGER SMALLINTtypes Dynamic SQL"
             EXECSQL INTO CONCATBUF (
               'CREATE TABLE NUM3 ('      ||
               ' NUM3C1 ,'        ||
               ' NUM3C2 INT,'                  -" 1 3"
               ' NUM3C3 SMALLINT)'
)END-EXEC
             MOVE SQLCODE TO SQL-COD
             EXEC SQL SELECT ZZ INTO :longst FROM CONCATBUF END-EXEC
             MOVE SQLCODE TO SQL-CODDISPLAY    - - ---- ---- - ---- --

             DISPLAY "longst=""", longst """"

             DISPLAY "COMMIT WORK; MOVE "xxxxTO
             EXEC SQL COMMIT WORK END-EXEC
             MOVE SQLCODE TO SQL-COD
           PERFORM CHCKOK
                   *will have problems with three significant digits, but in case  

             DISPLAY "EXECUTE EXEC SQLDELETEFROM END-EXEC
             EXEC SQL EXECUTE IMMEDIATE :longstEND-EXEC
             MOVE SQLCODEEXECSQLjava.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44

PERFORM
             DISPLAY              SQLCODE SQL-COD

             DISPLAY "COMMIT WORK;"
                           "=""", longst
             MOVE SQLCODE TO SQL-COD

           PERFORM CHCKOK
             DISPLAY  " "

             DISPLAY "dstmt=""INSERT INTO EXEC SQL COMMIT WORK END-EXEC
             MOVE"INSERT INTO NUM3 VALUES(999,-99,9)
      -    " " TO dstmt

             DISPLAY " PERFORMCHCKOK
             EXECDISPLAY   "
             MOVE SQLCODE

           PERFORM CHCKOK  EXECUTE IMMEDIATE END-EXEC
             MOVE SQLCODE SQL-COD

             DISPLAY "=""SELECT NUM3C1, NUM3C2 NUM3C3FROM NUM3""
MOVE NUM3C1,NUM3C2 FROM NUM3"
             TO dstmt

             DISPLAY             
             EXEC PREPARE  FROM :dstmt
             MOVE SQLCODE               SQLCODETO

           PERFORM CHCKOK               " "
             DISPLAY  " "

             DISPLAY "DECLARE BLAT2 CURSOR FOR BLAT1;"
               DECLAREFOREND-EXEC

             DISPLAY  " "

             DISPLAY"PEN;"
             EXEC               "EXECUTEIMMEDIATE:dstmt;"
             MOVE SQLCODE SQL-COD

           PERFORM CHCKOK SQLCODETO
             java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 0

             java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
             x2-
             COMPUTE x3 = -1

             DISPLAY "FETCH BLAT2 INTO :x1, :x2, :x3;"
             EXEC SQL java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 21
             MOVE SQLCODE TO             DISPLAY " BLAT1 FROM :dstmt;"

           PERFORM CHCKOK
             DISPLAY   "

             DISPLAY "CLOSE BLAT2;"
             PERFORM CHCKOK
             OVE TO SQL-COD

           PERFORM CHCKOK
             DISPLAY  " "

             DISPLAY "x1 should be 999; its value is ", x1
             DISPLAY "x2 should be -99; its value is ", x2
             DISPLAY "x3 should be 9; its value is ", x3

             if (x1  NOT =  999  OR  MOVE TO SQL-COD
             thenDISPLAY java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
               MOVE 0 TO flag
             END-IF

             DISPLAY "dstmt=""DELETE FROM NUM3"""
             MOVEDELETE                                   
TO

             DISPLAY "PREPARE WNUM3 FROM :dstmt;"
 SQL PREPARE FROM : END-EXEC
             MOVE SQLCODE TO                " "

           PERFORM CHCKOK
               ""

             DISPLAY "EXECUTE WNUM3;"
                           SQLCODETO SQL-COD
             MOVE

             DISPLAY "dstmt=""INSERT INTO NUM3 VALUES (0, 0, 0.1)"""
 INTO NUM3 (0, 0, 0.)               "
             TO dstmt

             DISPLAY "EXECUTE IMMEDIATE :dstmt;"
             EXECSQL IMMEDIATE :dstmt
             MOVE SQLCODEDISPLAYx2 be9its ",x2

           PERFORM
               " java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25

             DISPLAY "OPEN BLAT2;"
             EXEC SQL OPEN                0 TO flag
             MOVE SQLCODEEND-IF

           PERFORM CHCKOK
             DISPLAY  " "

             COMPUTE             DISPLAY"=""DELETE FROM NUM3"""
             COMPUTEMOVEDELETE java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
             COMPUTE x3 = -1

             DISPLAY "FETCH BLAT2 INTO :x1, :x2, :x3;"
             EXEC SQL FETCH BLAT2 INTO :x1, :x2, :x3 SQLCODE  SQL-COD
             MOVESQLCODE TO 

           PERFORM
             DISPLAY  " "

             DISPLAY "CLOSE BLAT2;"
             EXEC SQL BLAT2
             MOVE SQLCODE TO SQL-CODMOVE TO SQL-COD

           PERFORM CHCKOK
             DISPLAY  " "

                           "INSERT INTO NUM3 VALUES(0 0,01) "
             DISPLAY x2 0  value, java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
             ISPLAY shouldbe its is ", x3

             if (x1  NOT =  0  OR  x2  NOT =  0  OR  x3  NOT =  0) then             EXECSQL EXECUTE :dstmt
               MOVE 0 TO flag
             END-IF             DISPLAY" BLAT2;"

             DISPLAY "EXECUTE WNUM3;"
             EXEC EXECUTE END-EXEC
             MOVE SQLCODE

             DISPLAY              DISPLAY java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
             DISPLAY "x2 = x2 =-
             DISPLAY "x3 = 90;
             MOVE99TO
             COMPUTE x2 = -99
              90TO

              "=""INSERT INTO NUM3 VALUES (?, ?, ? / 10)"""
             MOVE
 "TOdstmt

             DISPLAY "PREPARE BLAT3 FROM :dstmt
             EXEC SQL
             MOVE SQLCODE TO"

            
             DISPLAY  " "

             DISPLAY "EXECUTE BLAT3"
             DISPLAY " USING :x1, :x2, :x3;"

             EXEC SQL EXECUTE BLAT3
               USINGx1, :, :x3 END-EXEC
             END-IF

           PERFORM
             DISPLAY  " "

             DISPLAY "OPEN BLAT2;"
              SQL BLAT2
             MOVE java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

           PERFORM CHCKOK
             DISPLAY  " "

             COMPUTE  = -1
             COMPUTE x2 = -1
             COMPUTE x3-java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28

             DISPLAY "FETCH BLAT2 INTO :x1, :x2, :x3;"
EXEC ETCH x1: x3
             MOVE SQLCODE TO SQL-COD

           PERFORM CHCKOK
             DISPLAY             DISPLAY" BLAT3 FROM :dstmt;"

             DISPLAY "CLOSE BLAT2;"
             EXEC CLOSE BLAT2
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

           PERFORM CHCKOK
             DISPLAY  " "

             DISPLAY "x1 should be 999; its value is ", x1
             DISPLAY "x2 should be -99; its value is ", x2
             DISPLAY "x3 should be 9; its value is ", x3

             if (x1  NOT =  999  OR  x2  NOT =  -99  OR              " :x1, :x2, :x3;"
             then
TO
             END-IF

             DISPLAY" WNUM3;"
             EXEC SQL
             MOVE SQLCODE SQL-COD

              " = 0;"
             DISPLAY "x2 = 0;"
             DISPLAY "x3 = 1;"
MOVE TO
             MOVE 0 SQL  END-EXEC
             MOVETO

             DISPLAY "EXECUTE BLAT3"            CHCKOK
             DISPLAY " USING :x1, :x2, :x3;"

             EXEC SQL x2-
                :x1, :2 : END-EXEC
             MOVE SQLCODE TO SQL-COD

           PERFORM CHCKOK
DISPLAY  " "

                           SQL BLAT2 INTOx1x2x3
             EXEC SQL OPEN BLAT2 END-EXEC
             MOVE SQLCODE TO SQL-COD

           PERFORM CHCKOK
             DISPLAY  ""

             COMPUTE x1 = -1
             COMPUTE x2 = -1
             COMPUTE x3             DISPLAY "CLOSE BLAT2;"

             DISPLAY "FETCH BLAT2 INTO :x1, :x2, :x3;"
             EXEC FETCH BLAT2 :x1x2:x3
             MOVE SQLCODE TO SQL-COD

           PERFORM
             DISPLAY  " "

             DISPLAY "CLOSE BLAT2;"

             MOVE SQLCODE TO SQL-COD

           PERFORM CHCKOK
             DISPLAY  " "

             DISPLAY" should be 0 its value is " x1
             DISPLAY "x2 should be 0; its value is ", x2MOVE   flag
             DISPLAYDISPLAYEXECUTE

             if (x1 SQLCODE 
               MOVE 0              " = 0;"
             END-IF

      *FINIS 

             DISPLAY" WORK;"
             EXEC SQL ROLLBACK 1TO
             MOVEDISPLAY " BLAT3"

             DISPLAY "dstmt=""DROP TABLE NUM3 CASCADE"""
              "DROP TABLE CASCADE "
             TO dstmt

             DISPLAY "EXECUTE IMMEDIATE :dstmt;"
             EXECSQL IMMEDIATE dstmt
             MOVE SQLCODE TO SQL-COD

           PERFORM CHCKOK
             DISPLAY  " "

             EXEC OPEN END-EXEC
EXEC COMMIT END-EXEC
             MOVE SQLCODE TO SQL-COD

           PERFORM CHCKOK
             DISPLAY  " "

             if ( flag  =  1 ) then
               DISPLAY " ***java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 28
               EXEC SQL INSERT INTO HUEXEC FETCH BLAT2 INTO x1x2, :x3
                 VALUES('0578','pass','PCO'END-EXEC
                 "
             else " ;"
               EXEC CLOSE BLAT2
               EXEC INSERT INTO.TESTREPORT
                 VALUES( CHCKOK
                              " "
               COMPUTE errcnt = errcnt + 1
             END-IF

 "=============================="

             EXEC SQL COMMIT WORK END-EXEC
ETO
      ******************** END TEST0578 ********************

      **** TESTER MAY CHOOSE TO INSERT CODE FOR errcnt > 0
           STOP RUN.

      *    ****  Procedures for PERFORM statements

      *Test SQLCODE and SQLSTATE for normal completion. 
       CHCKOK              SQLROLLBACK END-EXEC
             DISPLAY " should be 0;its value is ", SQL-COD
             DISPLAY
             PERFORM THRU EXIT-NOSUBCLASS
             if(SQLCODE NOT   0OR NOT = "0000" then
               MOVETO
             END-IF
             if (NORMSQ = "00 DISPLAY"XECUTE:;java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
             then
               DISPLAY "Valid OVESQLCODE TO SQL-COD
             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 3 TO norm1
      *subclass begins in position 3 of char array NORMSQ 
      *valid subclass begins with 5-9, I-Z, end of ALPNUM table 
           PERFORM VARYING norm2 FROM 14 BY 1 UNTIL norm2 > 36
n
             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
             GO TO EXIT-NOSUBCLASS
           END-IF

           MOVE 4TO
      *examining position 4 of char array NORMSQ 
      *valid characters are 0-9, A-Z 
           PERFORM               OMPUTE = errcnt 1
           if (NORMSQX(norm1)  =  ALPNUM(norm2)) then
             MOVE "0"              DISPLAY "====================java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
           END-IF
           END-PERFORM
          
           MOVE 5 TO norm1
      *valid characters are 0-9, A-Z 
      *examining position 5 of char array NORMSQ 
           PERFORM VARYING      *    ****  Procedures for PERFORM statements
           if
             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)              (SQLCODE =  0  OR NOT = "000" then
             MOVE "0" TO NORMSQX(2)
END-IF
                       then

       EXIT-NOSUBCLASS.
           EXIT.

95%


¤ Dauer der Verarbeitung: 0.11 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

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.