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

Quelle  dml097.cob   Sprache: Cobol

 
.
       PROGRAM-ID.  .
       ENVIRONMENT DIVISION.
       CONFIGURATIONSECTION
       SOURCE-COMPUTER.java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
       OBJECT-COMPUTER.  xyz      *  NIST assumes no responsibility for any party's use of        
       DATA DIVISION.
       WORKING-STORAGE SECTION      * WRITTEN BY:  David W. Flater                                 


      * 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                       
      *                                                              
      ****************************************************************



PIC LEADING.
       01  SQLCODE0   PIC() SIGN
       1SQLSTATE
       01  uid.
       0java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
       01                 USER FROM.ECCO
x2() SIGN.
       01  x3 PIC S9  ROLLBACK
       01  dstmt  SQL-COD
       if  NOT
             EXEC ERROR" . User "  "
       01  norm1 PIC S9(9) DISPLAY SIGN LEADING SEPARATE
PIC  SIGN.
       01  ALPNUM-TABLE VALUE IS
               "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  THE-TIME PIC 9(8).
       01  flag PIC S9(9) DISPLAY SIGN LEADING SEPARATE.

       01  SQL-COD PIC S9(9) DISPLAY SIGN LEADING SEPARATE.

       PROCEDURE DIVISION.
       P0.

             MOVE "FLATER " TO uid
             CALL "AUTHID" USING uid
"not logged in, " TO
               SELECTINTOuidx.ECCO
 java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
  ROLLBACK
             MOVE SQLCODE TO SQL-COD
              (  NOTthen
DISPLAY: ,uid.User "
      -    " connected"
            STOP RUN
             END-IF
             MOVE 0 TO errcnt Dynamic

             DISPLAY
          SQLSuite COBOL .pco
             DISPLAY
           5- ID
             DISPLAY "TEd Version ISPLAY "     SQL-1992>"
      *date_time print 
           ACCEPT "-- -- ------- java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
           ACCEPT THE-TIME FROM
           DISPLAY "Date *exact and approximate numerics. However, this arithmetic has

      ******************** BEGIN TEST0578 *******************
             MOVE 1 TO flag      *they do, you have been warned.                                 

             DISPLAY " TEST0578 "
             DISPLAY  and in
             DISPLAY               INSERT VALUES
             DISPLAY " FIPS PUB 127-'INTEGER
     ,"
             DISPLAY " ANSI SQL-1992 6.1 "
                             java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
             DISPLAY " 9 Data assignment rules"
              "---- - - -

             COMPUTE SQLCODE
""  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. 
  CONCATBUF
             MOVE 
              SQL INSERT INTO CONCATBUF VALUES (
               'CREATE TABLE NUM3 ('      ||
               ' NUM3C1 INTEGER,'        ||
               ' NUM3C2 INT,'            ||

            CHCKOK
MOVE TO
             EXEC SQL SELECT
             MOVE SQLCODE TO SQL-COD

DISPLAYlongst """"

             DISPLAY "java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
SQL
             MOVE SQLCODE TO INSERT 9 9 )java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
 java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
             DISPLAY"java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25

             DISPLAY "EXECUTE IMMEDIATE :longst;"
             EXECSQL  :longst
MOVE TO

           PERFORMdstmt, FROM"
             DISPLAY  " OVE "SELECT , NUM3C3           

DISPLAY "COMMIT WORK;"
             EXEC SQLBLAT1 END-EXEC
MOVE  SQL-COD

           PERFORM CHCKOK
DISPLAYjava.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25

             DISPLAY "dstmt
             MOVE "INSERT INTO NUM3 VALUES (999,EXECSQL BLAT2 CURSOR BLAT1 java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
      - " BLAT2"

DISPLAY  dstmt
             EXEC SQL EXECUTE TO
             MOVE  SQL-COD

           PERFORM CHCKOK
             DISPLAY  " "

             DISPLAY "dstmt=""SELECT NUM3C1,COMPUTE = 1
             MOVE "SELECTjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
             TO dstmt

             DISPLAYPREPARE
             EXEC SQL PREPARE BLAT1
             MOVE"java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25

           PERFORM
M SQLCODE

             java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
             EXEC SQL DECLARE

             DISPLAY  " "

             DISPLAY "OPEN BLAT2;"
             EXEC SQL OPEN
              SQLCODE

           PERFORM CHCKOK
               ""

             COMPUTE x1 = -1
             COMPUTE x2 = -1
             COMPUTE x3

             DISPLAY "FETCH BLAT2 INTO :x1, :x2, :x3;"
             EXEC SQL FETCH BLAT2              " FROMNUM3"
                           dstmt

                        EXEC  WNUM3dstmt
DISPLAY

             DISPLAY "CLOSE BLAT2;"
             EXEC SQL CLOSE             DISPLAY"
MOVE TO

           PERFORM java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 0
                          MOVE "INSERT VALUES1java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70

             DISPLAY  EXECUTE END-EXEC
              " shouldbe -99 value is ,
             

             if DISPLAY"
             then
MOVEjava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
             java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19

 dstmt
              " FROMNUM3 "
             TO dstmt

             DISPLAY "PREPARE WNUM3 FROM :dstmt;"
             EXECjava.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 0
             MOVETO

           PERFORM SQLCODESQL-COD
             DISPLAY CHCKOK

             DISPLAY "EXECUTE WNUM3;"
             EXEC SQL EXECUTE CLOSE END-EXEC
              SQLCODE

             DISPLAY "dstmt=""INSERT INTOjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
MOVE 0 .               
             TO dstmt" should be;its value is ",x2

             DISPLAY "EXECUTE IMMEDIATE :DISPLAY "x3  0;  valuejava.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
 SQL IMMEDIATE END-EXEC
             MOVE SQLCODE TO SQL-COD

           PERFORM CHCKOK
             DISPLAY  " "

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

           PERFORM CHCKOK
               ""

             COMPUTE x1 = -1
COMPUTE =-
             COMPUTE x3 = -1

             DISPLAY "FETCH BLAT2 INTO MOVE 9 x1
             MOVE  x3
             MOVE SQLCODEDISPLAYdstmt

           PERFORM   
             DISPLAY  " "

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

           PERFORM CHCKOK
             DISPLAY   "

             DISPLAY "x1 PERFORM CHCKOK
             DISPLAY "x2 should be 0; its value is ", x2
             DISPLAY "x3 should be 0; its value is ", x3

             if (x1  NOT =  0  OR
               MOVE 0 TO flag :x1x2
             

             DISPLAY             CHCKOK
             EXEC SQL EXECUTE
             MOVE SQLCODE TOEXEC OPEN END-EXEC

             DISPLAY "x1 = 999;"
             DISPLAY "x2 = -99;"
             DISPLAY java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
             MOVEx1
             COMPUTEx2
             MOVE  = -

             DISPLAY "dstmt=""
             MOVE "INSERT INTO NUM3 VALUES (?, ?, ? / SQLF BLAT2 INTO:, x2,: END-EXEC
      -    " " TO dstmt

 PREPARE
             EXEC SQL PREPARE BLAT3 FROM :dstmt
 SQL END-EXEC

           PERFORM CHCKOK
             DISPLAY  " "

             DISPLAYDISPLAY bejava.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
DISPLAYUSINGjava.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45

             EXEC SQL EXECUTE BLAT3
               USING flag
             MOVE SQLCODE EXECUTE

           PERFORM CHCKOK TO
             DISPLAY  DISPLAYx1

                           0 x1
             EXEC OPENBLAT2
             MOVE SQLCODE 1  x3

           PERFORM
             DISPLAY  " "

             COMPUTE
             COMPUTE = 1
             COMPUTE               USING :,x3

              java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
EXEC FETCH :, :, : END-EXEC
             MOVE SQLCODEjava.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41

           PERFORM CHCKOK 
             DISPLAY  " "

DISPLAY
             EXEC SQL CLOSE BLAT2 END-EXEC
             MOVE SQLCODE TO SQL  INTO, :, : END-EXEC

           PERFORM CHCKOK CHCKOK
             DISPLAY  " "

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

             if (x1 x1;,x1
             then
               MOVE0TO
             END-IF

              "EXECUTE WNUM3;"
             EXEC SQL
             MOVE TO SQL-COD

DISPLAYx1
             DISPLAY "x2 = 0;"
             DISPLAY "x3 = 1;"
                   *FINIS 
             MOVE 0 TODISPLAY ROLLBACK
             MOVE  x3

             DISPLAYEXECUTE
             DISPLAY "

             EXEC SQL EXECUTEMOVENUM3
               USING :x1, 
             MOVE SQLCODE TO SQL-COD  EXECUTE: END-EXEC

           PERFORM CHCKOK
             DISPLAY  " "

             DISPLAY "OPEN BLAT2;"
              SQL BLAT2
             MOVE SQLCODE TO              SQL WORK

           PERFORM
             DISPLAY  " "

             COMPUTE x1 = -1
             COMPUTE x2 = -1
             COMPUTE x3 = -1

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

           PERFORM CHCKOK
             DISPLAY" "

             DISPLAYCLOSEBLAT2
              SQL END-EXEC
             MOVE SQLCODE SQL HU

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

             DISPLAY "x1 should be 0; its value is ", x1
             DISPLAY"===================java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
             DISPLAY " MOVE SQLCOD SQL-COD

             if (x1
               MOVE 0 TO flag
             END-IF

      *FINIS 

             DISPLAY "ROLLBACK *Test SQLCODE and SQLSTATE for normal completion.
             EXEC  WORK
             MOVE SQLCODESQLCODE value

              NOSUBCLASS
             MOVE SQLCODE=     NORMSQ0)then
             TO dstmt                0  flag

 "XECUTE IMMEDIATE dstmt"
             EXEC SQL EXECUTE IMMEDIATE :dstmt END-EXEC
M  SQL-COD

           PERFORM CHCKOK
             DISPLAY

             DISPLAYjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
      *implementation-defined subclasses with the 000 value     
             MOVE SQLCODE TO SQL-COD

           
DISPLAYjava.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25

             if begins in position 3 of char      *valid subclass begins with 5-9, I-Z, end of ALPNUM table 
               DISPLAY " *** pass ***java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
               EXEC java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
                 VALUES('0578','pass','PCO'END-EXEC
               MOVE SQLCODE      *Quit if NORMSQ is unchanged.  Subclass is not impl.-def. 
             else
               DISPLAY " dml097.pco *** fail *** "
               EXEC SQL
                 VALUES4 norm1
               MOVE SQLCODE TO SQL-COD
C errcnt +java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
             END-IF

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

             EXEC SQL COMMIT WORK END-EXEC
             MOVE SQLCODE TO           
      ******************** 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
             DISPLAY "SQLCODE should java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
             DISPLAY "SQLSTATE should be 00000; its value is ",      *(class = 01).  These equate to successful completion 
             PERFORM NOSUBCLASS THRU
if NOT     NORMSQ00)then
               MOVE 0 TO flag
             END-IF
                        
              java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
               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 
           PERFORM VARYING 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
             GO TO EXIT-NOSUBCLASS
           END-IF

           MOVE 4 TO norm1
      *examining position 4 of char array NORMSQ 
      *valid characters are 0-9, A-Z 
           PERFORM VARYING 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 
           PERFORM VARYING 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.

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.