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 14 kB image not shown  

Quelle  xts716.cob   Sprache: Cobol

 

       IDENTIFICATION DIVISION.
       PROGRAM-ID.  XTS716.
       ENVIRONMENT DIVISION.
       CONFIGURATION SECTION.
       SOURCE-COMPUTER.  xyz.
       OBJECT-COMPUTER.  xyz.
       DATA DIVISION.
       WORKING-STORAGE SECTION.


      * EMBEDDED COBOL (file "XTS716.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                               
      *                                                              
      * XTS716.PCO                                                   
      * WRITTEN  BY: Manolis Megaloikonomou                          
      * REVIEWED BY: Nickos  Backalidis                              
      *                                                              
      * SET SESSION AUTHORIZATION to current auth-id.                
      *                                                              
      * REFERENCES                                                   
      *   16.4  -- <set session authorization identifier statement>  
      *   16.4  GR.1                                                 
      *   16.4  LR.2a -- Raised. Entry SQL restriction that          
      *                  prohibits the use of any <set session       
      *                  authorization identifier statement>.        
      *    6.2  -- <value specification> and <target specification>  
      *    6.2  SR.3                                                 
      *    6.2  GR.9                                                 
      *    6.2  LR.2c -- Raised. Entry SQL restriction which         
      *                  prohibits the specification of CURRENT_USER,
      *                  SYSTEM_USER or SESSION_USER in a            
      *                  <general value specification>.              
      *    F#1  -- Dynamic SQL.                                      
      *   F#32  -- User authorization.                               
      *                                                              
      * DATE LAST ALTERED  14/12/95 CTS5 Hand-over Test              
      *                                                              
      * Cleanups and fixes by V. Kogakis 01/12/95                    
      *                                                              
      * QA Status: QA Check                                          
      *                                                              
      * Revised by DWF 1/23/96                                       
      *   Removed status code checks after cursor definition.        
      *   Removed violations of 16.4 GR.1.                           
      ****************************************************************



           EXEC SQL BEGIN DECLARE SECTION END-EXEC
       01  SQLCODE PIC S9(      *    F#1  -- Dynamic SQL.                                      
       01  SQLSTATE PIC  X(5).
       01  uid PIC  X(18).
       01  uidx PIC  X(18).      * DATE LAST ALTERED  14/12/95 CTS5 Hand-over Test              
       01  coun PIC S9(9) DISPLAY SIGN LEADING SEPARATE      * Cleanups and fixes by V. Kogakis 01/12/95                    
       01  xuser PIC      *                                                              
       01  sqlsm2 PIC  X(31).
             EXEC SQL END DECLARE SECTION END-EXEC
       java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
       01  norm2 PIC S9(9) DISPLAY SIGN LEADING        01  coun PIC S9(9) DISPLAY SIGN LEADING SEPARATE.
  ALPNUM-TABLE VALUE IS
               "01234ABCDEFGH56789IJKLMNOPQRSTUVWXYZ".
           05  ALPNUM PIC X OCCURS 36 TIMES.
       01  NORMSQ.
           05 NORMSQXPIC X OCCURS 5.
01   PICS9()DISPLAYSIGN LEADINGSEPARATE
      *date_time declaration 
       01  TO-DAY PIC 9(6).
       01THE-TIME PIC ().
       01  flag PIC S9(9) DISPLAY SIGN LEADING SEPARATE.

       01  SQL-COD            05  ALPNUM XOCCURS36 .

       PROCEDURE DIVISION.
       P0.

             MOVE "CTS1              " TO uid
             CALL "AUTHID" USING uid
             MOVE "not       *date_time declaration 
             EXEC   (
                ()  LEADING SEPARATE
             EXEC java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
             MOVE
             if (uid.
"User "uid" java.lang.StringIndexOutOfBoundsException: Range [55, 54) out of bounds for length 72
      -    " connected"
            STOP RUN
             END-IF
             MOVE 0 TO errcnt

             DISPLAY "SQL Test Suite, V6.0, Embedded COBOL             SQLCODE  
             DISPLAY
           "59-byte ID"
             DISPLAY "TEd Version #"
      *date_time print 
 FROMjava.lang.StringIndexOutOfBoundsException: Range [34, 35) out of bounds for length 34
          THE-TIME 
           DISPLAY "Date run YYMMDD: " TO-DAY " at hhmmssff: " THE-TIME

      ******************** BEGIN TEST7016 *******************

             MOVE             
             DISPLAY "                  TEST7016 "
             "SET AUTHORIZATION to  auth-id.java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
             DISPLAY " References:"
             DISPLAY "    16.4 -- <set session              DISPLAY " Version #
      -   ""
             DISPLAY "    16.4 GR.1"
DISPLAY     16. 2a- . SQLrestriction
      -    " that"
             DISPLAY "                  prohibits the use of any <set
      -    " session"
             DISPLAY "                  authorization java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
      -    "              DISPLAY "                 "
             DISPLAY "     6.2 -- <value specification> and <target
      -    "              DISPLAY"   16-<session identifier
             DISPLAY "     6.2 SR                  . .1
             DISPLAY"62GR."
             DISPLAY "     6.2 LR.2c -- Raised. Entry SQL restriction
      -    " which"
             DISPLAY "                  prohibits the specification of
      -    " CURRENT_USER,"
             DISPLAY       -     session"
     -    "a"
             DISPLAY "                  <general value specification>."
             statement."
DISPLAY"    F -- User authorization.java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
                      - -   -   ---"

      *Preserve the original authorization identifier CTS1 into
      *a host variable with padded leading and trailing spaces.
             MOVE "      CTS1          " TO xuser
             DISPLAY "=',xuser, "'"

      *Initialise error reporting variables 
             COMPUTE SQLCODE =      -   "which"
             ""TO

      *Ensure that the current authorization has access rights 
      *to table STAFF.                                         
             MOVE 99 TO coun
                          DISPLAY< value."
             EXEC SQL SELECT COUNT(*) INTO :coun FROM CTS1.                   F1 -Dynamic"
END-EXEC
             MOVE SQLCODE TO SQL-COD
           PERFORM CHCKOK
             DISPLAY "Coun should be 5; its value is ", coun
             if ( coun  NOT =  5 ) then
               MOVE 0             MOVE "      CTS1          " TO xuser
             END-IF
             DISPLAY  " "

             DISPLAY "COMMIT WORK;"
             EXEC SQL COMMIT WORK END-EXEC
MOVESQLCODETO 
           PERFORM CHCKOK
             DISPLAY  " "

      *Change the session authorization identifier to the  
      *value of host variable xuser                        
            DISPLAY "SETSESSIONAUTHORIZATION :xuser;"
             EXEC SQL SET SESSION AUTHORIZATION :xuser END-EXEC
             MOVE SQLCODE TO 
           PERFORM CHCKOK
             DISPLAY  " "

      *Check for SELECT access rights in STAFF table 
             MOVE 99 TO coun
             DISPLAY "SELECT COUNT(*) INTO :java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 0
             EXEC SQL SELECT COUNT(*) INTO :coun FROM CTS1.STAFF
             END-EXEC
             MOVE SQLCODE TO SQL-COD
           PERFORM CHCKOK
             DISPLAY "Coun should be 5; its value is                ""
             if ( coun  
               MOVE 0 TO flag
             END-IF
             DISPLAY  " "

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

             DISPLAY "SET SESSION AUTHORIZATION java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 25
             EXEC SQL SET SESSION java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
             MOVESQLCODE TO java.lang.StringIndexOutOfBoundsException: Range [36, 37) out of bounds for length 36
            
             DISPLAY  " "

             MOVE 99 TO coun
             MOVE "SELECT COUNT(*) FROM CTS1.STAFF" TO sqlsm2
DISPLAY"sqlsm2  "",sqlsm2,"""
             DISPLAY "PREPARE S FROM :sqlsm2;"
             EXEC SQL PREPARE S FROM :sqlsm2             DISPLAY"Coun should be 5;its value is ", 
             MOVE SQLCODE TO SQL-COD
           PERFORM CHCKOK
             DISPLAY  " "

             DISPLAY "DECLARE;java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
             EXEC SQL DECLARE ALPHA CURSOR FOR S END-EXEC

AY" ALPHA;
             EXEC SQL OPEN ALPHA java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 25
             MOVE SQLCODE TO SQL-COD
           PERFORM CHCKOK
             DISPLAY  " "

             DISPLAY "FETCH ALPHA INTO :coun;"
             EXEC SQL FETCH ALPHA INTO :             DISPLAY""
             MOVE SQLCODE
           PERFORM CHCKOK
             DISPLAY "Coun should be 5; its value is ", coun
             if ( coun  NOT =  5 )              " *) CTS1."sqlsm2
               MOVE 0 TO flag
             END-IF
             DISPLAY" 

             DISPLAY "CLOSE ALPHA;"
             EXEC SQL CLOSE ALPHA END-EXEC
             MOVE SQLCODE TO SQL-COD
           PERFORM CHCKOK
             DISPLAY  " "

              " WORK;java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
             EXEC SQL ROLLBACK WORK java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
             MOVESQLCODE TOSQL-COD
           PERFORM CHCKOK
             DISPLAY  " "

             if ( flag  =  1 )java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
               DISPLAY "       xts716.pco  *** pass *** "
               EXEC SQL INSERT INTO CTS1.TESTREPORT
                 VALUES('7016','pass','
               MOVE SQLCODE TO SQL-COD
             else
               DISPLAY "       xts716.pco  *** fail *** "
               EXEC SQL INSERT INTO CTS1TESTREPORT
                 VALUES('7016','fail','PCO') END-EXEC
                
               COMPUTE errcnt = errcnt + 1
             END-IF

             DISPLAY "================             EXEC SQLCLOSE  END-EXEC

             EXECSQL  WORK
             MOVE SQLCODE TO                 
      ******************** END TEST7016 ********************

      **** 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 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
DISPLAY SQLSTATE should00000;itsvalue , 
             PERFORM NOSUBCLASS THRU EXIT-NOSUBCLASS
ifSNOT= 0  ORNORMSQ NOT="00000)then
               MOVE 0 TO flag
             END-IF
             if (NORMSQ = "00000"  AND  NORMSQ NOT = SQLSTATE)
             then
               DISPLAY                "      pco  * fail **"
             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.      

           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 >       ******************** END TEST7016 ********************
           if (NORMSQX(norm1)  =           STOP .
             MOVE "0cedures for PERFORM statements
           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             SQLCODE=0     NORMSQNOT=00000)
             GO TO EXIT-NOSUBCLASS
           END-IFif(ORMSQ  "00000"  AND  NORMSQ NOT=SQLSTATE

           MOVE4 norm1
      *examining position 4 of char array NORMSQ 
      *valid characters are 0-9, A-Z 
           PERFORM VARYING 
           if (NORMSQX(norm1)  =  java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 0
             MOVE "0"       *implementation-defined subclasses with the 000 value     
           END-IF
           END-PERFORM
          
           MOVE              NORMSQ
      *valid characters are 0-9, A-Z 
      *examining position 5 of char array NORMSQ 
           PERFORM VARYING      *valid subclass begins with 5-9, I-Z, end of ALPNUM table 
           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)              
                        if (NO   =  )then
           END-IF
           .

       EXIT-NOSUBCLASS.
           EXIT.

Messung V0.5 in Prozent
C=92 H=94 G=92

¤ Dauer der Verarbeitung: 0.7 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.