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

Quelle  dml142.cob   Sprache: Cobol

 

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


      * EMBEDDED COBOL (file "DML142.PCO")


      ****************************************************************
      *                                                              
      *                 COMMENT SECTION                              
      *                                                              
      * DATE 1994/11/1 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.
      *                                                              
      * DML142.PCO                                                    
      * WRITTEN BY: David Flater                                     
      * TRANSLATED AUTOMATICALLY FROM EMBEDDED C BY CHRIS SCHANZLE
      *                                                              
      * This routine tests privilege violations by user HU and       
      * cursor operations on tables with duplicate rows.             
      *                                                              
      * REFERENCES                                                   
      *   ANSI SQL-1992                                              
      *                                                              
      ****************************************************************



           EXEC SQL            (.
       01  SQLCODE PIC S9(9) COMP.
       01  SQLSTATE PIC  X(5).
       01  uid PIC  X(18).
       01  uidx PIC  X(18).
       01  int1 PIC S9(       01 uid PICX18.
       01  c10 PIC S9(9) DISPLAY SIGN LEADING SEPARATE.
       01  c12 PIC S9(9) DISPLAY SIGN LEADING SEPARATE.
       01  c13 PIC S9(9) DISPLAY SIGN LEADING SEPARATE.
01cxx  () SIGN  SEPARATE.
             EXEC SQL END DECLARE SECTION END-EXEC
01norm1 PIC     SEPARATE
       01  norm2 PIC S9(9)           PIC()SIGN  java.lang.StringIndexOutOfBoundsException: Range [55, 54) out of bounds for length 55
        ALPNUM-TABLE IS
               "01234ABCDEFGH56789IJKLMNOPQRSTUVWXYZ".
           05   36 .
       01  NORMSQ.
05  PIC X5 java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
01errcntPICS9(9) DISPLAY SIGN LEADING SEPARATE.
      *date_time declaration 
).
       01  THE-TIME PIC 9(8).
       01  flag PIC S9(9) DISPLAY SIGN         java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18

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

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

             MOVE               SELECT :  HU
             CALL "AUTHID" USING uid
             MOVE "not logged in             java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 36
EXEC  USER uidxFROMECCOjava.lang.StringIndexOutOfBoundsException: Range [66, 67) out of bounds for length 66
             MOVE SQLCODE 
             EXEC SQL java.lang.StringIndexOutOfBoundsException: Range [13, 1) out of bounds for length 19
                          
if u       
               DISPLAY "ERRORjava.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
      -    " connected"
            STOP 
             END-IF
             MOVE 0 TO errcnt

             DISPLAY
           "SQL*********** BEGIN TEST0527 *MOVE   
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
           "59-byte ID"
             DISPLAY"Priv java.lang.StringIndexOutOfBoundsException: Range [51, 50) out of bounds for length 56
      *date_time print 
           ACCEPT TO-DAY FROM DATE

           DISPLAY "Date run YYMMDD: "              DISPLAY "     - - - - - - - - - -  "

      ******************** BEGIN TEST0527 *******************
             MOVE 1 TO flag

             DISPLAY "                  TEST0527 "
          Priv.:HU"
             DISPLAY "References:"
 --"
             DISPLAY "     - - - - - - - - - - - - - - - - - - -"

             COMPUTE SQLCODE = -1
             MOVE "xxxxx" TO SQLSTATE

      *Select 

             COMPUTE int1 = -1
             DISPLAY "SELECT COUNT(*) INTO               " should  <0;itsvalueis ",SQL-COD
             EXEC SQL SELECT COUNT           THRU
             
             MOVE SQLCODE TO SQL-COD
             DISPLAY "SQLCODE should be < 0; its value is 
DISPLAY"java.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 72
           PERFORM NOSUBCLASS THRU EXIT-NOSUBCLASS
             if (SQLCODE                 DISPLAY "Validjava.lang.StringIndexOutOfBoundsException: Range [53, 52) out of bounds for length 72
               MOVE 0 TO flag
             END-IF
             if (               MOVE 0 TO0 java.lang.StringIndexOutOfBoundsException: Range [29, 30) out of bounds for length 29
             then
                ""
             END-IF
             DISPLAY "int1 should NOT be 2; its value java.lang.StringIndexOutOfBoundsException: Range [36, 56) out of bounds for length 36
             if (             DISPLAY"java.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 72
               MOVE 0 TO flag
             END-IF

      *Insert 

             DISPLAY   =java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
             
             MOVE SQLCODEDISPLAY" .
             DISPLAY java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
Sjava.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 72
           PERFORM NOSUBCLASS THRU EXIT-NOSUBCLASS
              (QLCODE   <0OR NORMSQ  NOT =  "42000" then
               MOVE 0 TO              SQLCODETO SQL-COD
             END-IF
              N      42000      =SQLSTATE
             then
               DISPLAY "Valid implementation-defined java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 50
                          if (SQ  NOT   0    NORMSQ    ="" then
             DISPLAY  " "

      *Update 

             DISPLAY "UPDATE FLATER.USIG SET C1 = 0;"
             SQL SETC1= 
             MOVE SQLCODE TO SQL-COD
             DISPLAY "SQLCODE should be <
             DISPLAY"
           EXECSQL  FROMFLATER.USIG
             if (              SQLCODETO
               MOVE 0 TO flag
             END-IF
             if (NORMSQ   =   "42000"  java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50

               DISPLAY "Valid java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 29
             END-IF
             DISPLAY  " "

      *Delete 

            " java.lang.StringIndexOutOfBoundsException: Range [41, 40) out of bounds for length 47
             EXEC SQL DELETE FROM FLATER             EXEC SQL    
             MOVE SQLCODE TO SQL-COD
                    01  norm2S9(9)DISPLAY SIGN LEADING .
             DISPLAY "SQLSTATE should be 42000; its value is          ALPNUM-TABLE VALUEIS
             THRU 
             if (SQLCODE  NOT <           NORMSQjava.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
               MOVE0 TO flag
             END-IF
             if (ORMSQ="42000    java.lang.StringIndexOutOfBoundsException: Range [52, 50) out of bounds for length 70
             then
                "  .
             END-IF
DISPLAY  ""

             DISPLAY "ROLLBACK WORK;"
       
             MOVE SQLCODE TO SQL-COD
           
             DISPLAY  " "

             (    )
               DISPLAY "                *** pass *** "
               SQL INTOuidxHU 
                 VALUESTO
                
             else
               DISPLAY "       dml142.pco  *** failif (   = java.lang.StringIndexOutOfBoundsException: Range [41, 42) out of bounds for length 41
               EXEC SQL java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 23
                 VALUES('0527','fail','PCO') END-EXEC
               MOVE SQLCODE TO SQL-COD
               COMPUTE errcnt = errcnt + 1
             END-IF
             EXEC SQL COMMIT WORK END-EXEC
             MOVE SQLCODE TO SQL-COD
             DISPLAY "================================================"

      ******************** END TEST0527 ********************
      ******************** BEGIN TEST0528 *******************
             MOVE 1 TO flag

             DISPLAY "                  TEST0528 "
             DISPLAY "  Tables are multi-sets:  cursor operations"
             DISPLAY "References:"
             DISPLAY "    4.9 PP.1 -- A table is a multiset of rows"
             DISPLAY "     - - - - - - - - - - - - - - - - - - -"

             COMPUTE SQLCODE = -1
             MOVE "xxxxx" TO SQLSTATE

             DISPLAY "DELETE FROM TEMP_S;"
             EXEC SQL DELETE FROM TEMP_S END-EXEC
             MOVE SQLCODE TO SQL-COD

             DISPLAY "INSERT INTO TEMP_S"
             DISPLAY "  SELECT EMPNUM, GRADE, CITY FROM STAFF;"
             EXEC SQL INSERT INTO TEMP_S
               SELECT EMPNUM, GRADE, CITY FROM STAFF END-EXEC
             MOVE SQLCODE TO SQL-COD
           PERFORM CHCKOK
             DISPLAY  " "

             DISPLAY "INSERT INTO TEMP_S"
             DISPLAY "  SELECT EMPNUM, GRADE, CITY FROM STAFF"
             DISPLAY "  WHERE GRADE = 12;"
             EXEC SQL INSERT INTO TEMP_S
               SELECT EMPNUM, GRADE, CITY FROM STAFF
               WHERE GRADE = 12 END-EXEC
             MOVE SQLCODE TO SQL-COD
           PERFORM CHCKOK
             DISPLAY  " "

             DISPLAY "DECLARE C14221 CURSOR FOR"
             DISPLAY "  SELECT GRADE FROM TEMP_S;"
             EXEC SQL DECLARE C14221 CURSOR FOR
               SELECT GRADE FROM TEMP_S END-EXEC

             DISPLAY "OPEN C14221;"
             EXEC SQL OPEN C14221 END-EXEC
             MOVE SQLCODE TO SQL-COD
           PERFORM CHCKOK
             DISPLAY  " "

             MOVE 0 TO c10
             MOVE 0 TO c12
             MOVE 0 TO c13
             MOVE 0 TO cxx

           .
        P101.
             COMPUTE int1 = -1
             DISPLAY "FETCH C14221 INTO :int1;"
             EXEC SQL FETCH C14221 INTO :int1 END-EXEC
             MOVE SQLCODE TO SQL-COD
             if (SQLCODE  NOT =  0) then
               GO TO P102
             END-IF
             DISPLAY "int1 is ", int1
             if (int1  =  10) then
               COMPUTE c10 = c10 + 1
             END-IF
             if (int1  =  12) then
               COMPUTE c12 = c12 + 1
             END-IF
             if (int1  =  13) then
               COMPUTE c13 = c13 + 1
             END-IF
             if (int1  NOT =  10  AND  int1  NOT =  12  AND  int1  NOT =
              13) then
               COMPUTE cxx = cxx + 1
             END-IF
             GO TO P101

           .
        P102.
             DISPLAY "SQLCODE should be 100; its value is ", SQL-COD
             DISPLAY "SQLSTATE should be 02000; its value is ", SQLSTATE
           PERFORM NOSUBCLASS THRU EXIT-NOSUBCLASS
             if (SQLCODE  NOT =  100  OR  NORMSQ  NOT  =   "02000") then
               MOVE 0 TO flag
             END-IF
             if (NORMSQ   =   "02000"  AND  NORMSQ  NOT  =   SQLSTATE)
             then
               DISPLAY "Valid implementation-defined SQLSTATE accepted."
             END-IF
             DISPLAY "Count of 10s should be 1; its value is ", c10
             DISPLAY "Count of 12s should be 4; its value is ", c12
             DISPLAY "Count of 13s should be 2; its value is ", c13
             DISPLAY "Count of others should be 0; its value is ", cxx
             if (c10  NOT =  1  OR  c12  NOT =  4) then
               MOVE 0 TO flag
             END-IF
             if (c13  NOT =  2  OR  cxx  NOT =  0) then
               MOVE 0 TO flag
             END-IF

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

             DISPLAY "DECLARE C14222 CURSOR FOR"
             DISPLAY "  SELECT GRADE FROM TEMP_S ORDER BY GRADE;"
             EXEC SQL DECLARE C14222 CURSOR FOR
               SELECT GRADE FROM TEMP_S ORDER BY GRADE END-EXEC

             DISPLAY "OPEN C14222;"
             EXEC SQL OPEN C14222 END-EXEC
             MOVE SQLCODE TO SQL-COD
           PERFORM CHCKOK
             DISPLAY  " "

             COMPUTE int1 = -1
             DISPLAY "FETCH C14222 INTO :int1;"
             EXEC SQL FETCH C14222 INTO :int1 END-EXEC
             MOVE SQLCODE TO SQL-COD
           PERFORM CHCKOK
             DISPLAY "int1 should be 10; its value is ", int1
             if (int1  NOT =  10) then
               MOVE 0 TO flag
             END-IF

             COMPUTE int1 = -1
             DISPLAY "FETCH C14222 INTO :int1;"
             EXEC SQL FETCH C14222 INTO :int1 END-EXEC
             MOVE SQLCODE TO SQL-COD
           PERFORM CHCKOK
             DISPLAY "int1 should be 12; its value is ", int1
             if (int1  NOT =  12) then
               MOVE 0 TO flag
             END-IF

             COMPUTE int1 = -1
             DISPLAY "FETCH C14222 INTO :int1;"
             EXEC SQL FETCH C14222 INTO :int1 END-EXEC
             MOVE SQLCODE TO SQL-COD
           PERFORM CHCKOK
             DISPLAY "int1 should be 12; its value is ", int1
             if (int1  NOT =  12) then
               MOVE 0 TO flag
             END-IF

             COMPUTE int1 = -1
             DISPLAY "FETCH C14222 INTO :int1;"
             EXEC SQL FETCH C14222 INTO :int1 END-EXEC
             MOVE SQLCODE TO SQL-COD
           PERFORM CHCKOK
             DISPLAY "int1 should be 12; its value is ", int1
             if (int1  NOT =  12) then
               MOVE 0 TO flag
             END-IF

             COMPUTE int1 = -1
             DISPLAY "FETCH C14222 INTO :int1;"
             EXEC SQL FETCH C14222 INTO :int1 END-EXEC
             MOVE SQLCODE TO SQL-COD
           PERFORM CHCKOK
             DISPLAY "int1 should be 12; its value is ", int1
             if (int1  NOT =  12) then
               MOVE 0 TO flag
             END-IF

             COMPUTE int1 = -1
             DISPLAY "FETCH C14222 INTO :int1;"
             EXEC SQL FETCH C14222 INTO :int1 END-EXEC
             MOVE SQLCODE TO SQL-COD
           PERFORM CHCKOK
             DISPLAY "int1 should be 13; its value is ", int1
             if (int1  NOT =  13) then
               MOVE 0 TO flag
             END-IF

             COMPUTE int1 = -1
             DISPLAY "FETCH C14222 INTO :int1;"
             EXEC SQL FETCH C14222 INTO :int1 END-EXEC
             MOVE SQLCODE TO SQL-COD
           PERFORM CHCKOK
             DISPLAY "int1 should be 13; its value is ", int1
             if (int1  NOT =  13) then
               MOVE 0 TO flag
             END-IF

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

             DISPLAY "OPEN C14221;"
             EXEC SQL OPEN C14221 END-EXEC
             MOVE SQLCODE TO SQL-COD
           PERFORM CHCKOK
             DISPLAY  " "

             MOVE 4 TO cxx
           .
        P103.
             COMPUTE int1 = -1
             DISPLAY "FETCH C14221 INTO :int1;"
             EXEC SQL FETCH C14221 INTO :int1 END-EXEC
             MOVE SQLCODE TO SQL-COD
             if (SQLCODE  NOT =  0) then
           PERFORM CHCKOK
               DISPLAY "Skipping remainder of subtest."
               GO TO P104
             END-IF
             DISPLAY "int1 is ", int1
             if (int1  =  12) then
               GO TO P105
             END-IF
             COMPUTE cxx = cxx - 1
             if (cxx  >  0) then
               GO TO P103
             END-IF
             DISPLAY "Error -- should have run into a grade 12 by now."
             DISPLAY "Skipping remainder of subtest."
             GO TO P104

           .
        P105.
             DISPLAY "DELETE FROM TEMP_S WHERE CURRENT OF C14221;"
             EXEC SQL DELETE FROM TEMP_S WHERE CURRENT OF C14221
             END-EXEC
             MOVE SQLCODE TO SQL-COD
           PERFORM CHCKOK
             DISPLAY  " "

           .
        P104.
             DISPLAY "CLOSE C14221;"
             EXEC SQL CLOSE C14221 END-EXEC
             MOVE SQLCODE TO SQL-COD
           PERFORM CHCKOK
             DISPLAY  " "

             DISPLAY "OPEN C14221;"
             EXEC SQL OPEN C14221 END-EXEC
             MOVE SQLCODE TO SQL-COD
           PERFORM CHCKOK
             DISPLAY  " "

             MOVE 0 TO c10
             MOVE 0 TO c12
             MOVE 0 TO c13
             MOVE 0 TO cxx

           .
        P106.
             COMPUTE int1 = -1
             DISPLAY "FETCH C14221 INTO :int1;"
             EXEC SQL FETCH C14221 INTO :int1 END-EXEC
             MOVE SQLCODE TO SQL-COD
             if (SQLCODE  NOT =  0) then
               GO TO P107
             END-IF
             DISPLAY "int1 is ", int1
             if (int1  =  10) then
               COMPUTE c10 = c10 + 1
             END-IF
             if (int1  =  12) then
               COMPUTE c12 = c12 + 1
             END-IF
             if (int1  =  13) then
               COMPUTE c13 = c13 + 1
             END-IF
             if (int1  NOT =  10  AND  int1  NOT =  12  AND  int1  NOT =
              13) then
               COMPUTE cxx = cxx + 1
             END-IF
             GO TO P106

           .
        P107.
             DISPLAY "SQLCODE should be 100; its value is ", SQL-COD
             DISPLAY "SQLSTATE should be 02000; its value is ", SQLSTATE
           PERFORM NOSUBCLASS THRU EXIT-NOSUBCLASS
             if (SQLCODE  NOT =  100  OR  NORMSQ  NOT  =   "02000") then
               MOVE 0 TO flag
             END-IF
             if (NORMSQ   =   "02000"  AND  NORMSQ  NOT  =   SQLSTATE)
             then
               DISPLAY "Valid implementation-defined SQLSTATE accepted."
             END-IF
             DISPLAY "Count of 10s should be 1; its value is ", c10
             DISPLAY "Count of 12s should be 3; its value is ", c12
             DISPLAY "Count of 13s should be 2; its value is ", c13
             DISPLAY "Count of others should be 0; its value is ", cxx
             if (c10  NOT =  1  OR  c12  NOT =  3) then
               MOVE 0 TO flag
             END-IF
             if (c13  NOT =  2  OR  cxx  NOT =  0) then
               MOVE 0 TO flag
             END-IF

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

             DISPLAY "OPEN C14222;"
             EXEC SQL OPEN C14222 END-EXEC
             MOVE SQLCODE TO SQL-COD
           PERFORM CHCKOK
             DISPLAY  " "

             COMPUTE int1 = -1
             DISPLAY "FETCH C14222 INTO :int1;"
             EXEC SQL FETCH C14222 INTO :int1 END-EXEC
             MOVE SQLCODE TO SQL-COD
           PERFORM CHCKOK
             DISPLAY "int1 should be 10; its value is ", int1
             if (int1  NOT =  10) then
               MOVE 0 TO flag
             END-IF

             COMPUTE int1 = -1
             DISPLAY "FETCH C14222 INTO :int1;"
             EXEC SQL FETCH C14222 INTO :int1 END-EXEC
             MOVE SQLCODE TO SQL-COD
           PERFORM CHCKOK
             DISPLAY "int1 should be 12; its value is ", int1
             if (int1  NOT =  12) then
               MOVE 0 TO flag
             END-IF

             COMPUTE int1 = -1
             DISPLAY "FETCH C14222 INTO :int1;"
             EXEC SQL FETCH C14222 INTO :int1 END-EXEC
             MOVE SQLCODE TO SQL-COD
           PERFORM CHCKOK
             DISPLAY "int1 should be 12; its value is ", int1
             if (int1  NOT =  12) then
               MOVE 0 TO flag
             END-IF

             COMPUTE int1 = -1
             DISPLAY "FETCH C14222 INTO :int1;"
             EXEC SQL FETCH C14222 INTO :int1 END-EXEC
             MOVE SQLCODE TO SQL-COD
           PERFORM CHCKOK
             DISPLAY "int1 should be 12; its value is ", int1
             if (int1  NOT =  12) then
               MOVE 0 TO flag
             END-IF

             COMPUTE int1 = -1
             DISPLAY "FETCH C14222 INTO :int1;"
             EXEC SQL FETCH C14222 INTO :int1 END-EXEC
             MOVE SQLCODE TO SQL-COD
           PERFORM CHCKOK
             DISPLAY "int1 should be 13; its value is ", int1
             if (int1  NOT =  13) then
               MOVE 0 TO flag
             END-IF

             COMPUTE int1 = -1
             DISPLAY "FETCH C14222 INTO :int1;"
             EXEC SQL FETCH C14222 INTO :int1 END-EXEC
             MOVE SQLCODE TO SQL-COD
           PERFORM CHCKOK
             DISPLAY "int1 should be 13; its value is ", int1
             if (int1  NOT =  13) then
               MOVE 0 TO flag
             END-IF

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

             DISPLAY "OPEN C14221;"
             EXEC SQL OPEN C14221 END-EXEC
             MOVE SQLCODE TO SQL-COD
           PERFORM CHCKOK
             DISPLAY  " "

             MOVE 4 TO cxx
           .
        P108.
             COMPUTE int1 = -1
             DISPLAY "FETCH C14221 INTO :int1;"
             EXEC SQL FETCH C14221 INTO :int1 END-EXEC
             MOVE SQLCODE TO SQL-COD
             if (SQLCODE  NOT =  0) then
           PERFORM CHCKOK
               DISPLAY "Skipping remainder of subtest."
               GO TO P109
             END-IF
             DISPLAY "int1 is ", int1
             if (int1  =  12) then
               GO TO P110
             END-IF
             COMPUTE cxx = cxx - 1
             if (cxx  >  0) then
               GO TO P108
             END-IF
             DISPLAY "Error -- should have run into a grade 12 by now."
             DISPLAY "Skipping remainder of subtest."
             GO TO P109

           .
        P110.
             DISPLAY "UPDATE TEMP_S SET GRADE = 13 WHERE CURRENT OF
      -    " C14221;"
             EXEC SQL UPDATE TEMP_S SET GRADE = 13 WHERE CURRENT OF
             C14221 END-EXEC
             MOVE SQLCODE TO SQL-COD
           PERFORM CHCKOK
             DISPLAY  " "

           .
        P109.
             DISPLAY "CLOSE C14221;"
             EXEC SQL CLOSE C14221 END-EXEC
             MOVE SQLCODE TO SQL-COD
           PERFORM CHCKOK
             DISPLAY  " "

             DISPLAY "OPEN C14221;"
             EXEC SQL OPEN C14221 END-EXEC
             MOVE SQLCODE TO SQL-COD
           PERFORM CHCKOK
             DISPLAY  " "

             MOVE 0 TO c10
             MOVE 0 TO c12
             MOVE 0 TO c13
             MOVE 0 TO cxx

           .
        P111.
             COMPUTE int1 = -1
             DISPLAY "FETCH C14221 INTO :int1;"
             EXEC SQL FETCH C14221 INTO :int1 END-EXEC
             MOVE SQLCODE TO SQL-COD
             if (SQLCODE  NOT =  0) then
               GO TO P112
             END-IF
             DISPLAY "int1 is ", int1
             if (int1  =  10) then
               COMPUTE c10 = c10 + 1
             END-IF
             if (int1  =  12) then
               COMPUTE c12 = c12 + 1
             END-IF
             if (int1  =  13) then
               COMPUTE c13 = c13 + 1
             END-IF
             if (int1  NOT =  10  AND  int1  NOT =  12  AND  int1  NOT =
              13) then
               COMPUTE cxx = cxx + 1
             END-IF
             GO TO P111

           .
        P112.
             DISPLAY "SQLCODE should be 100; its value is ", SQL-COD
             DISPLAY "SQLSTATE should be 02000; its value is ", SQLSTATE
           PERFORM NOSUBCLASS THRU EXIT-NOSUBCLASS
             if (SQLCODE  NOT =  100  OR  NORMSQ  NOT  =   "02000") then
               MOVE 0 TO flag
             END-IF
             if (NORMSQ   =   "02000"  AND  NORMSQ  NOT  =   SQLSTATE)
             then
               DISPLAY "Valid implementation-defined SQLSTATE accepted."
             END-IF
             DISPLAY "Count of 10s should be 1; its value is ", c10
             DISPLAY "Count of 12s should be 2; its value is ", c12
             DISPLAY "Count of 13s should be 3; its value is ", c13
             DISPLAY "Count of others should be 0; its value is ", cxx
             if (c10  NOT =  1  OR  c12  NOT =  2) then
               MOVE 0 TO flag
             END-IF
             if (c13  NOT =  3  OR  cxx  NOT =  0) then
               MOVE 0 TO flag
             END-IF

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

             DISPLAY "OPEN C14222;"
             EXEC SQL OPEN C14222 END-EXEC
             MOVE SQLCODE TO SQL-COD
           PERFORM CHCKOK
             DISPLAY  " "

             COMPUTE int1 = -1
             DISPLAY "FETCH C14222 INTO :int1;"
             EXEC SQL FETCH C14222 INTO :int1 END-EXEC
             MOVE SQLCODE TO SQL-COD
           PERFORM CHCKOK
             DISPLAY "int1 should be 10; its value is ", int1
             if (int1  NOT =  10) then
               MOVE 0 TO flag
             END-IF

             COMPUTE int1 = -1
             DISPLAY "FETCH C14222 INTO :int1;"
             EXEC SQL FETCH C14222 INTO :int1 END-EXEC
             MOVE SQLCODE TO SQL-COD
           PERFORM CHCKOK
             DISPLAY "int1 should be 12; its value is ", int1
             if (int1  NOT =  12) then
               MOVE 0 TO flag
             END-IF

             COMPUTE int1 = -1
             DISPLAY "FETCH C14222 INTO :int1;"
             EXEC SQL FETCH C14222 INTO :int1 END-EXEC
             MOVE SQLCODE TO SQL-COD
           PERFORM CHCKOK
             DISPLAY "int1 should be 12; its value is ", int1
             if (int1  NOT =  12) then
               MOVE 0 TO flag
             END-IF

             COMPUTE int1 = -1
             DISPLAY "FETCH C14222 INTO :int1;"
             EXEC SQL FETCH C14222 INTO :int1 END-EXEC
             MOVE SQLCODE TO SQL-COD
           PERFORM CHCKOK
             DISPLAY "int1 should be 13; its value is ", int1
             if (int1  NOT =  13) then
               MOVE 0 TO flag
             END-IF

             COMPUTE int1 = -1
             DISPLAY "FETCH C14222 INTO :int1;"
             EXEC SQL FETCH C14222 INTO :int1 END-EXEC
             MOVE SQLCODE TO SQL-COD
           PERFORM CHCKOK
             DISPLAY "int1 should be 13; its value is ", int1
             if (int1  NOT =  13) then
               MOVE 0 TO flag
             END-IF

             COMPUTE int1 = -1
             DISPLAY "FETCH C14222 INTO :int1;"
             EXEC SQL FETCH C14222 INTO :int1 END-EXEC
             MOVE SQLCODE TO SQL-COD
           PERFORM CHCKOK
             DISPLAY "int1 should be 13; its value is ", int1
             if (int1  NOT =  13) then
               MOVE 0 TO flag
             END-IF

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

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

             if (flag  =  1) then
               DISPLAY "                *** pass *** "
               EXEC SQL INSERT INTO HU.TESTREPORT
                 VALUES('0528','pass','PCO') END-EXEC
               MOVE SQLCODE TO SQL-COD
             else
               DISPLAY "       dml142.pco  *** fail *** "
               EXEC SQL INSERT INTO HU.TESTREPORT
                 VALUES('0528','fail','PCO') END-EXEC
               MOVE SQLCODE TO SQL-COD
               COMPUTE errcnt = errcnt + 1
             END-IF
             EXEC SQL COMMIT WORK END-EXEC
             MOVE SQLCODE TO SQL-COD
             DISPLAY "================================================"

      ******************** END TEST0528 ********************
      **** 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 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 (NORMSQ = "00000"  AND  NORMSQ NOT = SQLSTATE)
             then
               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.

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

¤ Diese beiden folgenden Angebotsgruppen bietet das Unternehmen0.35Angebot  ¤

*Eine klare Vorstellung vom Zielzustand






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.