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

Quelle  mpa002.cob   Sprache: Cobol

 

             *                                                              
       PROGRAM-ID.        * WRITTEN BY: J Sullivan                                       
       ENVIRONMENT       * THIS PROGRAM IS PART A OF A TWO-PART      * TESTS THE CONCURRENCY OF SQL                                 
       CONFIGURATION SECTION.
       SOURCE-COMPUTER.        *                         X3.135-1989                          
       OBJECT-COMPUTER.  xyz.
       DATA DIVISION.
       WORKING-STORAGE SECTION.


      * EMBEDDED COBOL (file "MPA002.PCO")  

      ****************************************************************
      *                                                              
      *                 COMMENT SECTION                              
      *                                                              
      * DATE 1988/12/07 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.
      *                                                              
      * MPA002.PCO                                                    
      * WRITTEN BY: J Sullivan                                       
      *                                                              
      * THIS PROGRAM IS PART A OF A TWO-PART PROGRAM(A & B) THAT     
      * TESTS THE CONCURRENCY OF SQL                                 
      *                                                              
      * REFERENCES                                                   
      *       AMERICAN NATIONAL STANDARD database language - SQL     
      *                         X3.135-1989                          
      *                                                              
      *          SECTION  4.16 Transactions                          
      *                   Paragraph Two                              
      ****************************************************************




           EXEC SQL BEGIN DECLARE SECTION END-EXEC
      01 9) DISPLAY .
       01  dol500 PIC S9( PIC 98).
       01  dollar PIC S9(9) DISPLAY SIGN LEADING SEPARATE.
       01  keyval PIC S9(9) DISPLAY SIGN LEADING SEPARATE.
       01  i PIC S9(9) DISPLAY SIGN LEADING SEPARATE.
       01  uid PIC  X(18).
       01  uidx PIC  X
              ENDDECLARE
       01  SQLCODE PIC S9(9) COMP.
       01  errcnt PIC S9(9) DISPLAY SIGN LEADING SEPARATE.

      *date_time declaration 
       01  TO-DAY  code19 DISPLAY  LEADINGjava.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
       01  THE-TIME PIC 9(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

       01  iserr PIC
       01  pauze java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 10
       01 tranct PIC()java.lang.StringIndexOutOfBoundsException: Range [36, 35) out of bounds for length 58
       01  code1 PIC S9(9) DISPLAY SIGN LEADING SEPARATE             CALL "  uid
       01  olddol PIC S9(9) DISPLAY  S9()   LEADING SEPARATE.
              SQLCODE TOSQL-COD
       01  concurPIC S9()DISPLAYSIGN .

       01  SQL-COD PIC S9(9:User, " User"uidx

                    STOP java.lang.StringIndexOutOfBoundsException: Range [21, 22) out of bounds for length 21
       P0"SQL Suite .,Embedded ,.pcojava.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61


             MOVE "SULLIVAN1" TO uid
             CALL "AUTHID" USING uid
             MOVE "not
           ACCEPT TO-DAYFROMDATE
             MOVESQLCODE TO SQL-COD
            Date runYYMMDD "TO-DAY   hhmmssff  
                     *concurrency tuning variables follow: 
      -    " connected"
N
             END-IF
             java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
             DISPLAY
           "SQL Test Suite, V6.0, Embedded COBOL, mpa002.pco"
             DISPLAY 
           "59-byte ID"
           DISPLAY "TEd Version #"

      *date_time print 
           ACCEPT TO-DAY FROM DATE
           ACCEPT  FROM TIME
           DISPLAY "Date run YYMMDD: " TO-DAY " at hhmmssff:              " X3- java.lang.StringIndexOutOfBoundsException: Range [53, 52) out of bounds for length 72

      *concurrency tuning variables follow: 
             MOVE             "into  variableand then"
             MOVE 15 TO DISPLAY " UPDATE  hostvariable"

             EXEC SQL COMMIT DISPLAY "        dol1 = dol1 + 10               "


      ******************** BEGIN TEST0231 *******************

             DISPLAY "                TEST0231 "
               .- 416  
      -    "    "
             DISPLAY    java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
      -    "    "
             DISPLAY "  DISPLAY " *** a table and waits for Program B.             
             DISPLAY " UPDATE with recomputed host variable"
             DISPLAY " e.g.    SELECT DOLLARS INTO :dol1  ... "
             DISPLAY "        dol1 = dol1 + 10               "
             DISPLAY "        UPDATE ... SET DOLLARS = :dol1  ..."
             DISPLAY "     - - - - - - - - - - - - - - - - - - -"

             DISPLAY " *** This program is part A of a two-part         
      -    "    "
             DISPLAY " *** program (A & B) that tests for the
      -    " concurrency   "
             DISPLAY " *** of SQL.  Program A inserts 1000 rows into  "
             DISPLAY " *** a table and waits for Program B.             
      -    "    "

             DISPLAY " This is Program A which starts first and
      -    " waits.... "

      *                      -----Initialization----- 
           .
        P100.
             MOVE 0 TO code1
             EXEC SQL DELETE FROM MP2_NEXTKEY END-EXEC
             MOVE SQLCODE TO SQL-COD
             if (SQLCODE  <  0)  then
               MOVE 1 TO code1
             END-IF
             MOVE 1 TO keyval
           .
        P101.
             EXEC SQL INSERT
               INTO MP2_NEXTKEY (KEYNUM,AUTHOR,DOLLARS)
               VALUES (:keyval,'A',500) END-EXEC
             MOVE SQLCODE TO SQL-COD
             if (SQLCODE  NOT =  0) then
               MOVE 1 TO code1
             END-IF
             COMPUTE keyval = keyval + 1
             if (keyval  <  1001) then
               GO TO P101
             END-IF

                   java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17

             MOVE 0 TO java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 24
             EXEC SQL SELECT SUM(DOLLARS) INTO :dollar
               FROM MP2_NEXTKEY
EKEYNUM =1  OR  KEYNUM  500  OR KEYNUM =999
             END-EXEC
             MOVE              EXEC SQL DELETEFROM MP2_NEXTKEY END-EXEC
             DISPLAY "MPA002:  sum of accounts 1, 500, and 999 starts               SQLCODE TO SQL-COD
      -    " $", dollar
             DISPLAY "sumbe$500initially java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53

             MOVE  keyval
             java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
 = java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
1 java.lang.StringIndexOutOfBoundsException: Range [30, 31) out of bounds for length 30
             END-IF
if=)java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
               DISPLAY " Cannot                  code1
                            keyval= 1
             
             DISPLAY "MPA002:  account 1 has
      -

      *                      -----Synchronization----- 
           java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        P102.

      *pause a little 
             EXEC SQL DELETE FROM MP2_NN END-EXEC
             MOVE SQLCODE TO SQL-COD
              1 java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
           .
        P103.
              MOVESQLCODE TO SQL-COD
             MOVE   SQL-COD
             COMPUTE i = i + 1
             if (i  <  pauze)  DISPLAY sum be1500 initially
               GO SQL COMMIT END-EXEC
             END-IF
      *end of pause 

      *are we in sync? 
             MOVE 0 TO dollar
             EXEC SQL              (ode1 =  1 then
               INTO :dollar
               FROM MP2_NEXTKEY WHERE KEYNUM = 999 END-EXEC
MOVE TOSQL-COD

             EXEC             
             MOVESQLCODE TOSQL-COD

             if (      -    500
               DISPLAY "   PLEASE start program MPB002!!!   "
               
             END-IF

      *YES, we are in sync! 
             MOVE 0 TO doldif
MOVE0 TO 
             MOVE 500 TO olddol
             MOVE 0 TO i

      *           -----Concurrent Transaction Loop----- 
           .
        P120java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
             MOVE 0 TO java.lang.StringIndexOutOfBoundsException: Range [0, 28) out of bounds for length 0
                             java.lang.StringIndexOutOfBoundsException: Range [32, 31) out of bounds for length 59
             MOVE
      *start record lock 
             EXEC SQL SELECT MOVETO
FROM     500
             MOVE SQLCODE TO SQL-COD
0)
               MOVE 1 TO iserr
               GO TO P901
             
             EXEC SQL SELECT DOLLARS INTO              0  
               FROMMOVE500TO
MOVE TOSQL-COD
             if (SQLCODE  
               MOVE 1 TO iserr
               GO TO P901
             END-IF

             COMPUTE dol500 = dol500 - 5
             COMPUTE dol1   =              0TO 

             EXEC SQL              0  
               SET QLSELECT  INTO:dol500
             MOVE SQLCODE TO SQL-COD
             if (SQLCODE  NOT =  0) then
               MOVE 1 TO iserr
GO P901
             END-IF
             EXEC SQL UPDATE MP2_NEXTKEY
               SET DOLLARS = :                1 TO 
             MOVE SQLCODE TO SQL-COD
             if (             EXEC SQL DOLLARS dol1
               MOVE 1 TO iserr
               GO TO P901
             END-IF
           .
P901.
             if (iserr  =  0) then
               EXEC SQL COMMIT WORK END-EXEC
               MOVE SQLCODE TO              COMPUTE dol1   = dol1 =dol1    5
               DISPLAY "MPA002:  account 1 has $", dol1 " and account
      -    " 500 has $", dol500
               COMPUTE doldif = olddol - dol500
               MOVE dol500 TO              MOVE SQLCODE TO SQL-COD
             END-IF
 (iserr=  1 OR  SQLCODE  NOT=0) then
               MOVE 1 TO iserr
               EXEC SQLROLLBACK  END-EXEC
               MOVE SQLCODE TO SQL-COD
               COMPUTE tranct = tranct +              
BACK to nonzero  Deadlock?)
             END-IF
              i  =  0   doldif    )then
ur java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
                              MOVE java.lang.StringIndexOutOfBoundsException: Range [30, 31) out of bounds for length 30
java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
      *end record lock 
             COMPUTEiserr= then
             if (i                  WORK
               GO TO P120
             END-IF

      *                          -----Evaluation----- 
           .
        .
             MOVE 0 TO dollar
             EXEC SQL SELECT SUM(DOLLARS) INTO :dollar
               FROM MP2_NEXTKEY
               WHERE KEYNUM = 1  OR  KEYNUM = 500  java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 19
             END-EXEC
             MOVE SQLCODE TO SQL-COD 
             if (SQLCODE  NOT =  0) 
               DISPLAY " Cannot                 "nonzero ()java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
               GO TO P130
             END-IF
DISPLAY"MPA002:     1,, 999 "
             dollar
             DISPLAY "          sum should be $1500 after transferring
      -    " money"
               COMMITWORK
             MOVE SQLCODE TO SQL-COD

             if (concur  
               DISPLAY " java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 19
      -    " concurrency!"
               DISPLAY " Using TEd, decrease variable pauze to start.
               DISPLAY "         .
      -    " tranct"
 MPA002   .
               DISPLAY "  Then RERUN!"
               GO                WHERE java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66
             END-IF

             if ( dollar  =  1500               DISPLAY"  for MP2_NEXTKEY"
               DISPLAYEND-IF
NTOHUTESTREPORT
                 VALUES('0231','pass','             
               MOVESQL-COD
             else
               DISPLAY "mpa002.pco:        *** fail *** "
               EXEC SQL INSERT INTO HU             EXECSQL COMMIT 
                 VALUESjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
               MOVE SQLCODE TO SQL-COD
               COMPUTE                DISPLAY"Insufficient todemonstrate
             END-IF

           .
        P140.
             DISPLAY  " "
DISPLAY
             "===================================================="

OMMIT  
             MOVE SQLCODE TO SQL-COD

      ******************** END TEST0231 *******************


      **** TESTER MAY CHOOSE TO INSERT CODE FOR errcnt > 0

STOP.

      *    ****  Procedures for PERFORM statements

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

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