Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Cobol/Test-Suite/SQL P/xts/   (NIST Cobol Test-Suite ©)  Datei vom 4.1.2008 mit Größe 16 kB image not shown  

Impressum xts726.cob   Sprache: Cobol

 

             *over the World Wide Web in order to promote SQL standards.    
       PROGRAM-ID.  XTS726.
       ENVIRONMENT DIVISION.
       CONFIGURATIONo the SQL standards.                             
       SOURCE-COMPUTER.  xyz.
       OBJECT-COMPUTER.  xyz.
       DATA DIVISION.
       WORKING-STORAGE SECTION.


      * EMBEDDED COBOL (file "XTS726.PCO")


      *Copyright 1995 National Computing Centre Limited               
      *and Computer Logic R&D S.A                                     
      *on behalf of the 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.                                                 


      * Flagging - Full SQL - cursor with FOR UPDATE and ORDER BY    
      *                                                              
      *                 COMMENT SECTION                              
      *                                                              
      * SQL VALIDATION TEST SUITE V6.0                               
      *                                                              
      * XTS726.PCO                                                   
      * WRITTEN BY: Nickos Backalidis                                
      * TRANSLATED AUTOMATICALLY FROM EMBEDDED C BY CHRIS SCHANZLE
      *                                                              
      * Flagging - Full SQL - cursor with FOR UPDATE and ORDER BY    
      *                                                              
      * REFERENCES                                                   
      *   13.1    -- <declare cursor>                                
      *   13.9    -- <update statement: positioned>                  
      *   13.10   -- <update statement: searched>                    
      *   13.9    SR.4                                               
      *   F#37    -- Intermediate SQL Flagging                       
      *                                                              
      * DATE LAST ALTERED  14/12/95 CTS5 Hand-over Test              
      *                                                              
      * Cleanups and fixes by V. Kogakis 04/12/95:                   
      *      Change values returned from table CL_STANDARD           
      *             (JIM > MORRIS)                                   
      *                                                              
      * QA Status: QA CHECK                                          
      *                                                              
      * Revised by DWF 1/31/96                                       
      *   Removed status checks after cursor definition              
      *   Fixed char string lengths                                  
      *   Fixed misinterpretations of SQL-92                         
      *   Harmonized printfs with executed statements                
      *   Corrected expected results                                 
      ****************************************************************



           EXEC SQL BEGIN DECLARE SECTION END-EXEC
       01  SQLCODE PIC S9(9) COMP.
       01  SQLSTATE PIC  X(5).
       01  uid PIC  01  norm2 PIC S9DISPLAYSEPARATEjava.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
       01  uidxPIC  X()java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
       01  c_num1 PIC S9(9) DISPLAY SIGN       NORMSQ.
       01  c_num2 PIC         errcntPIC(9DISPLAY SIGN  .
       01  c_ch1 PIC  X(10).
       01  c_ch2PIC ().
             SQL  DECLARE  
       01  norm1 PIC S9(9)        01  flag PIC S9(9) DISPLAY  (9 DISPLAY   java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
       01  norm2 PIC S9(9) DISPLAY SIGN LEADING SEPARATE.
       01                "                uid
"01234".
           05  ALPNUM PIC X OCCURS 36 TIMES.
       01NORMSQjava.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
           05  NORMSQX PIC X OCCURS 5 TIMES.
       01  errcnt PIC S9(9) DISPLAY SIGN LEADING SEPARATE.
      *date_time declaration 
         TO-DAY PIC 9().
       01  THE-TIME PIC 9(8).
       01  flag MOVE SQLCODE 

        PIC S9()  SIGN LEADING SEPARATEjava.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59

       PROCEDURE DIVISION.
java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 10

             MOVE "CTS1              END-IF
             CALL "AUTHID" USING java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 0
             MOVE "not logged in, not"             java.lang.StringIndexOutOfBoundsException: Range [20, 21) out of bounds for length 20
             EXEC      *date_time print 
             MOVE SQLCODE TO SQL-COD
EXECSQL ROLLBACKWORK
             MOVE SQLCODE TO SQL-COD
             if  " YYMMDD:"TO-DAY"athhmmssff:" 
               DISPLAY "ERROR: User "              1TOflag
      -    " connected"
            RUN
             END-IF
             MOVE 0 TO errcnt

                   -    BY
             DISPLAY
           "59-byte ID"
                          DISPLAY"131- declare cursor>"
      *date_time print 
           ACCEPT TO-DAY FROM DATE
           ACCEPT THE-TIME FROM TIME
           DISPLAY "Date run YYMMDD: " TO-DAY               "    . SR. java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38

      ***************** BEGIN TEST7026 *****************
             MOVE 1 TO flag

             DISPLAY "                 TEST7026 "
                          COMPUTE SQLCODE = -1
      -    " ORDER BY"
DISPLAY"eferences"
             DISPLAY "    13.1  -- <declare cursor>"
                   *Use Valid Intermediate SQL & declare a cursor  
             DISPLAY "    13.10 -- <update statement: searched> "
             DISPLAY "    13.9  SR.4 "
DISPLAY"   #37--Intermediate SQL  "
             DISPLAY "   - - - - - - - - - - - - - - - -              "C,java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47

      *Subtest 1 

      *Initialise error reporting variables 
             COMPUTE SQLCODE = -1
             MOVE""TO SQLSTATE

      *use table CL_STANDARD from the standard schema 
      *Use Valid Intermediate SQL & declare a cursor  
      *for UPDATE only                                
             DISPLAY "Valid Intermediate SQL syntax:"
             DISPLAY" ALPHA   SELECT COL_NUM1,java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
              "OL_CH1COL_NUM2,OL_CH2"
             DISPLAY "FROM CL_STANDARD "
             DISPLAY "WHERE COL_NUM1 = 1004 AND COL_CH1 = 'MORRIS'"
             DISPLAY "FOR  PERFORM java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
             EXEC      *initialise host variables 
               COL_CH1,COL_NUM2,COL_CH2 FROM CL_STANDARD 
               WHERE COL_NUM1 = 1004 AND COL_CH1 = 'MORRISMOVE TO c_num1
 OF COL_CH1 COL_NUM2END-EXEC

             DISPLAY "OPEN ALPHA;"
             EXEC QL END-EXEC
              SQLCODE  SQL-COD
           PERFORM CHCKOK
             DISPLAY  " "

      *initialise host variables 
             MOVE "xxxxxxxxxx" TO c_ch1
             MOVE "xxxxxxxxxx" TO c_ch2
             MOVE0c_num1
             MOVE 0 TO c_num2
             DISPLAY "FETCH ALPHA INTO :c_num1, :c_ch1, :c_num2,
      -    " :c_ch2;"
             EXEC SQL       *use an <update statement:positioned and modify row 
             END-EXEC
              SQLCODE TO SQL-COD
           PERFORM CHCKOK
             DISPLAY "Values of the columns BEFORE the UPDATE:"
             DISPLAY "COL_NUM1 = ", c_num1, " COL_CH1 = ", c_ch1
             DISPLAY "COL_NUM2 = ", c_num2, " COL_CH2 = ", c_ch2
             DISPLAY  " "

      *use an <update statement:positioned and modify row 
      *that satisfies the <search condition> of the query 
             DISPLAY "UPDATE CL_STANDARD"
             DISPLAY "SET COL_CH1 = 'ELLIE', COL_NUM2 = COL_NUM2 + 10"             MOVE   
             DISPLAY "WHERE CURRENT OF ALPHA;"
             EXEC SQL UPDATE CL_STANDARD CLOSE ;
               SET  'LLIE'COL_NUM2 =COL_NUM2 +10
               WHERE CURRENT OF ALPHA END-EXEC
             MOVE SQLCODE TO SQL-COD
           PERFORM CHCKOK
             DISPLAY  " "

      *close the cursor 
             DISPLAY "CLOSE              MOVE "xxxxxxxxxx" TO
             EXEC SQL CLOSE ALPHA END-EXEC
             MOVE SQLCODE TO                
           PERFORM CHCKOK
             DISPLAY  " "

      *initialise host variables 
             MOVE "xxxxxxxxxx" TO c_ch1
             MOVE "xxxxxxxxxx" TO c_ch2
             MOVE 0 TO c_num1
             MOVE 0 TO c_num2

      *use a <select statement: single row> and check that 
      *the row has been successfully modified 
             DISPLAY "SELECT COL_NUM1,COL_CH1,COL_NUM2,COL_CH2"
             DISPLAY"INTO :c_num1, c_ch1, c_num2, c_ch2"
             DISPLAY "FROM CL_STANDARD"
              "HERE   1004;"
             EXEC SQL SELECT COL_NUM1,COL_CH1,java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 36
               c_num1,c_ch1::
               FROM CL_STANDARD 
               WHERECOL_NUM1=1004END-EXEC
             MOVE SQLCODE TO SQL-COD
            CHCKOK
             DISPLAY "Values of the row after the UPDATE :"DISPLAY COL_NUM2be4014;is"   "
             DISPLAY "COL_NUM1 should be 1004;  it is ", c_num1, " "
             DISPLAY "COL_CH1  should be ELLIE; it is ", c_ch1, "  "
             DISPLAY "COL_NUM2 should be 4014;  it is ", c_num2, " "                0 flag
DISPLAY"  should PARGA;it "  " "
             if (c_num1  NOT =  1004  OR  c_ch1  NOT  =   "ELLIE"  OR 
             c_num2  NOT =             
               MOVE 0 TO flag
             END-IF
             if (c_ch2  NOT  =   "PARGA") then
               MOVE 0 TO flag
             END-IF
             DISPLAY  " "

      *restore CL_STANDARD in its original state 
             DISPLAY "ROLLBACK      *Subtest 2 
             EXEC SQL ROLLBACK WORK END-EXEC
             MOVE SQLCODE TO SQL-COD
            CHCKOK
             DISPLAY  " "

      *Subtest 2 
             DISPLAY "FULL SQL SYNTAX:"
             DISPLAY "DECLARE BETA CURSOR FOR SELECT"
             DISPLAY "COL_NUM1             EXEC SQL  BETACURSOR FOR SELECTjava.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
             java.lang.StringIndexOutOfBoundsException: Range [36, 20) out of bounds for length 44
             DISPLAY "ORDER BY COL_NUM2 DESC FOR UPDATE OF COL_CH1;               ORDER  COL_NUM2 DESC FORUPDATEOFCOL_CH1 END-EXEC
             EXEC SQL DECLARE BETA CURSOR FOR              DISPLAY " BETA;java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
               COL_NUM1,COL_CH1,COL_NUM2 FROM CL_STANDARD
               WHERE COL_NUM1 = 1001
               ORDER BY COL_NUM2 DESC FOR UPDATE OF COL_CH1 END-EXEC

                          MOVExxxxxxxxxx  c_ch1
             EXEC SQL OPEN BETA END-EXEC
             MOVE SQLCODE TO SQL-COD
           PERFORM CHCKOK
             DISPLAY  "              "ETCH  :_um1,: cn "

      *fetch the row 
      *initialise host variables 
             MOVE"" TO c_ch1
             MOVE "xxxxxxxxxx" TO c_ch2
             MOVE              COL_NUM1  1001it " ,""
             MOVE 0 TO c_num2

              "ETCH   :_,c_ch1,: ;java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
             ifc_num1   =1001OR      =   "MARIA"  OR 
             MOVE SQLCODE TO SQL-COD
           PERFORM CHCKOK
             DISPLAY "COL_NUM1 should be 1001   it is ", c_num1, "               " "
             DISPLAY "COL_CH1  should be MARIA  it is ", c_ch1, "  "
             DISPLAY "COL_NUM2 should be 4001   it is ", c_num2, " "
             if (c_num1  NOT                CL_STANDARD
             c_num2  NOT =  4001) then
               MOVE 0 TO flag
             END-IF
             ""

             DISPLAY "UPDATE CL_STANDARD "
             DISPLAY "SET COL_CH1 = 
             DISPLAY "WHERE java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
EXEC UPDATECL_STANDARD
               SET               SQLCODETO 
               WHERE java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 25
             MOVE SQLCODE TO SQL-COD
           PERFORM CHCKOK
             DISPLAY  ""

      *close cursor and record results 

             DISPLAY              SQLCODETO 
             EXEC SQL CLOSE BETADISPLAY   
              TOSQL-COD
           PERFORM CHCKOK
             DISPLAY  " "

      *restore CL_STANDARD in its original state 

             DISPLAY "ROLLBACK WORK;"
             EXEC SQL ROLLBACK WORK END-EXEC
              SQLCODE TO SQL-COD
           PERFORM CHCKOK
             DISPLAY  " "

             if ( flag  =  1 ) then
               DISPLAY "       xts726.pco                mustdemonstrate Flagger
               EXEC              else
                 VALUES('7026','pass','PCO') END-EXEC
               MOVE SQLCODE TO SQL-COD
DISPLAY"extension  FOR  ANDORDER BY"
               DISPLAY "has executed successfully"
               "  demonstrate Intermediate 
      -    " WARNING"
             else
               DISPLAY "       xts726.pco  *** NOGO *** "
               EXEC SQL INSERT INTO CTS1.TESTREPORT
                                DISPLAYSupport forWITH BY isnot
               MOVE SQLCODE TO SQL-COD
               DISPLAY "Vendor does not support fully "
               DISPLAY "Intermediate SQL extension "
               DISPLAY "Support for CURSOR WITH ORDER BY & UPDATE is not
      -    " required"
             END-IF

      *BAK : Check again in order to insert a third option for fail 
      *DWF: ??? 

             DISPLAY "============           STOP RUN.

             EXEC SQL       *    ****  Procedures for PERFORM statements
             MOVE SQLCODE TO SQL-COD

      ***************** END TEST7026 ******************

      **** 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 be 0; its value is ", SQL-COD
             DISPLAY "SQLSTATE             
PERFORMNOSUBCLASS THRU EXIT-NOSUBCLASS
             if (SQLCODE NOT =  0  OR   NORMSQ NOT = "00000") then
               MOVE 0 TO flag
             END-IF
             if (             .
             thenNOSUBCLASS.
               DISPLAY "Valid implementation-defined      *This routine replaces valid implementation-defined       
             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 NORMSQif(ORMSQX()=ALPNUMnorm2)then

           MOVE 3           END-IF
      *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       *so proceed to zero it out, if valid (0-9,A-Z)            
           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            if (NORMSQX(norm1)  =  ALPNUM(norm2)) then
           END-IF
           END-PERFORM           END-IF
          
           MOVE 5 TO norm1
      *valid characters are 0-9, A-Z 
      *examining position 5 of char array NORMSQ 
                 *implementation-defined subclasses are allowed for warnings 
           if (NORMSQX(norm1)  =  ALPNUM
             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
C=92 H=95 G=93

¤ 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.0.14Bemerkung:  ¤

*Bot Zugriff






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

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 und die Messung sind noch experimentell.