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

 

.
       PROGRAM-ID.  XTS726.
ENVIRONMENT DIVISION
       CONFIGURATIONDIVISION.
       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.                                                 


      ****************************************************************
      *                                                              
      *                 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      * Revised by DWF 1/31/96                                       
       01  SQLSTATE PIC  X(5).
       01  uid PIC  X      *   Fixed misinterpretations of SQL-92                         
       01 Corrected expected results                                 
       01  c_num1 PIC S9(
       01  c_num2 PIC S9(9) DISPLAY SIGN LEADING SEPARATE.
       01  c_ch1 PIC  X(10).
       01  c_ch2 PIC  X(10).
EXEC END DECLARE SECTION 
       01  norm1 PIC S9(9) DISPLAY SIGN LEADING SEPARATE.
        PIC () DISPLAY  LEADING SEPARATE.
       01  ALPNUM-TABLEVALUE 
               "0123401 uidx PICX().
           05    XOCCURS36TIMES
01NORMSQ.
           05  NORMSQX PIC X OCCURS       01  PIC  (10.
01  errcnt PIC S9(9 DISPLAYSIGN  .
      *date_time declaration 
       01   PIC96)
       01  THE-TIME PIC 9(8         PIC (9) DISPLAYSIGN LEADING .
       E.

       01  SQL-COD PIC S9(9) DISPLAY  05  ALPNUM XOCCURS36TIMESjava.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44

       PROCEDURE DIVISION.
       P0.

             MOVE "CTS1              " TO uid
             CALL "AUTHID" USING uid
             MOVE"not logged in,not TO uidx
             EXEC SQL SELECT USER INTO :uidx FROM CTS1.ECCO END-EXEC
              SQLCODE TO SQL-COD
             EXEC SQL ROLLBACK WORK END-EXEC
             MOVE SQLCODE TO SQL-COD
             if (uid  NOT  =   uidx) java.lang.StringIndexOutOfBoundsException: Range [0, 41) out of bounds for length 10
               CALL "AUTHID uid
      -    "              "  ,java.lang.StringIndexOutOfBoundsException: Range [38, 37) out of bounds for length 46
            STOP RUN
             END-IF
             MOVE 0 TO errcnt

                          EXEC SQ WORKEND-EXEC
             DISPLAY
           "59-yte IDjava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
              TEd "
      *date_time print 
           ACCEPT TO-DAY FROM DATE
           ACCEPT THE-TIME RUN
           DISPLAY "Date run YYMMDD               errcnt

      ***************** BEGIN TEST7026 *****************
g

             DISPLAY "                 DISPLAY
              "  #java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
      -   " ORDER BY"
             DISPLAY "References"
             DISPLAY "    13.1  -- <declare           ACCEPT THE-TIME FROM TIME
              "   .9  - <update statement: positioned> "
             DISPLAY "    13.10 -- <update statement: searched> "
             DISPLAY "    13.9  SR.4             MOVE 
     37- IntermediateFlagging"
             DISPLAY "   - - - - - - - - - - - - - - - - - - -"

      *Subtest 1 

      *Initialise error reporting variables 
             COMPUTE SQLCODE = -1
             MOVE              "131 -<eclare cursor>java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52

      *use table CL_STANDARD from the standard schema 
      *Use Valid Intermediate SQL & declare a cursor  
      *for UPDATE only                                
             DISPLAY "Valid Intermediate SQL syntax:"
             DISPLAY "DECLARE ALPHADISPLAY "     -  -       -  - -
             DISPLAY       *Initialise error reporting variables 
             DISPLAY "FROM CL_STANDARD "
             "  =1004AND  =''java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
             DISPLAY "FOR UPDATE OF COL_CH1, COL_NUM2java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 0
             EXEC SQL DECLARE      *for UPDATE only                                
               COL_CH1,             DISPLAY "DECLARE   SELECTCOL_NUM1"
               WHERE   1004AND  '
               FOR UPDATE               "FROM CL_STANDARD "

             DISPLAY "OPEN ALPHA;"
             EXEC SQL OPEN ALPHA              DISPLAY "FOR UPDATE OF COL_C
             MOVE SQLCODE TO SQL-COD
           PERFORM CHCKOK
             DISPLAY  " "

      *initialise host variables 
             MOVE "xxxxxxxxxx" TO c_ch1
              "xxxxxxxxxx" Oc_ch2
             MOVE 0 TO c_num1
             MOVE 0 TO c_num2
             DISPLAY             DISPLAY "OPEN ALPHA;"
      -" :_ch2"
             EXEC SQL FETCH ALPHA             MOVE SQLCODE TO SQL-COD
             END-EXEC
              SQLCODE TO SQL-COD
           PERFORM CHCKOK
             DISPLAY "Values of the columns BEFORE java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 39
             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  MOVE SQLCODE TOSQL-COD
             DISPLAY "WHERE               Values  columnsBEFORE the UPDATE:java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
              CL_STANDARD
               SET COL_CH1 =                "java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
               WHERE CURRENT OF ALPHA END-EXEC
             MOVE SQLCODE TO SQL-COD
           PERFORM CHCKOK
             DISPLAY  ""

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

      *initialise host variables 
              xxxxxxxxxx  c_ch1
             MOVE "xxxxxxxxxx" TO c_ch2
             MOVE 0  
             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"
             DISPLAY "WHERE COL_NUM1 = 1004;"
             EXEC SQL SELECT COL_NUM1,COL_CH1,COL_NUM2,java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 39
               INTO :c_num1,:c_ch1,:c_num2,:c_ch2
                CL_STANDARD 
               WHERE COL_NUM1 = 1004 END-EXEC
             MOVE SQLCODE TO SQL-COD      *use a <select statement: single row> and check that 
           PERFORMCHCKOK
             DISPLAY "Values of the row after the UPDATE :"
             DISPLAY "COL_NUM1 should be 1004;  it is ",              " CL_STANDARD"
DISPLAY C  shouldbeELLIE is" ,"java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
             DISPLAY "COL_NUM2 should be 4014;  it is               CL_STANDARD 
             DISPLAY "COL_CH2  MOVE SQLCODE TO 
             if (c_num1  NOT =               
             c_num2  NOT =  4014) then
               MOVE 0 TO flag
             END-IF
             if (c_ch2  NOT  =   "PARGA") then
                0TOjava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
             END-IF
             DISPLAY  " "

      *restore CL_STANDARD in its original state 
             DISPLAY "ROLLBACK WORK;"
             SQL WORKEND-EXEC
             MOVE SQLCODE TO SQL-COD
            
             DISPLAY  "  OVE 0TO java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29

      *Subtest 2 
             DISPLAY "FULL SQL SYNTAX:"
             DISPLAY "DECLARE BETA CURSOR FOR SELECT"
             DISPLAY "COL_NUM1                 
             DISPLAY WHERECOL_NUM1 =1001
                        PERFORMCHCKOK
             EXEC  DECLAREBETA  FORSELECT 
               COL_NUM1,COL_CH1,COL_NUM2 FROM CL_STANDARD
               WHERE COL_NUM1 = 1001
               ORDER BY COL_NUM2 DESC FOR UPDATE              " SQL SYNTAX:"

             DISPLAY "OPEN BETA;"
             EXEC SQL OPEN BETA END-EXEC
             MOVE SQLCODE TO SQL-COD

             DISPLAY  " "

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

             DISPLAY "FETCH             EXEC SQLOPEN BETA END-EXEC
             EXEC SQL FETCH BETAINTO:,c_ch1c_num2END-EXEC
             MOVE SQLCODE TO SQL-COD
               "java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
                   *initialise host variables 
             DISPLAY "OL_CH1   beMARIA  it is " ,"  "
             DISPLAY "COL_NUM2 should be 4001   it is ", c_num2, " "
             if (c_num1  NOT =  1001  OR                0 TOc_num1
             c_num2  NOT =  4001)then
               MOVE              EXECSQLFETCHBETA  cnum1:,c_num2 
             END-IF
             DISPLAY  " "

             DISPLAY "UPDATE CL_STANDARD "
             DISPLAY SET = TAKIS"
             DISPLAY "WHERE CURRENT OF BETA;"
             EXEC SQL UPDATE CL_STANDARD
               SET COL_CH1 = 'TAKIS'
               WHERE CURRENT OF BETA END-EXEC
             MOVE SQLCODE TO SQL-COD
           PERFORM CHCKOK
                          if (c_num1NOT=1001  OR  c_ch1  NOT  =   "ARIA  OR 

      *close cursor and record results 

             java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 19
             EXEC SQL CLOSE BETA END-EXEC
             MOVE SQLCODE TO SQL-COD
           PERFORM CHCKOK
             DISPLAY""

      *restore CL_STANDARD in its original state 

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

             if ( flag  =      *close cursor and record results 
DISPLAY "      xts726.  ** pass * "
               EXEC SQL INSERT INTO CTS1.TESTREPORT
VALUES'7026'p,P' java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
               MOVE SQLCODE 
               DISPLAY SQLextensionCURSORFORUPDATEANDORDERBY
               DISPLAY "has executed successfully"
               DISPLAY "Vendor must demonstrate Intermediate Flagger
      -    " WARNING"
             else
                       xts726.pco  *** NOGO *** "
               EXEC SQL INSERT INTO CTS1.TESTREPORT
                 VALUES('7026','NOGO','PCO') END-EXEC
               MOVE SQLCODE TO SQL-COD
               DISPLAY "Vendor does not supportjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
               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 "=============================                has executedsuccessfully"

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

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

      **** TESTER MAY CHOOSE TO INSERT CODE FOR errcnt > 0
           STOPjava.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20

      *    ****  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( = 00000    NORMSQ  = SQLSTATEjava.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
             then
               DISPLAY "Valid implementation-defined SQLSTATE accepted."
             END-IF
             .

             .

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

               0TO

MOVE3 norm1
      *subclass begins in position 3 of char array NORMSQ 
      *valid subclass begins with 5-9, I-Z, end of ALPNUM table 
 VARYING   1 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           MOVE  TONORMSQ
           END-IF

           MOVE 4 TO norm1
      *examining position 4 of char array NORMSQ 
      *valid characters are 0-9, A-Z 
           if (NORMSQX  =()then
orm1    java.lang.StringIndexOutOfBoundsException: Range [41, 40) out of bounds for length 53
                        
           END-IF
           END-PERFORM
          
           MOVE 5 TO norm1
      *valid characters are 0-9, A-Z 
      *examining position 5 of char array NORMSQ 
           PERFORM VARYING java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 0
           if (NORMSQX(norm1)  =  ALPNUM(norm2))       *valid characters are 0-9, A-Z 
             MOVE "0" TO NORMSQX(norm1)
                       (n) )

   
      *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()   ""AND2=1)then
             MOVE "0" TO NORMSQX(2)
           END-IF
           .

       EXIT-NOSUBCLASS.
           EXIT.

Messung V0.5 in Prozent
C=93 H=95 G=93

¤ Dauer der Verarbeitung: 0.14 Sekunden  ¤

*© Formatika GbR, Deutschland






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.