Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/PVS/trig_fnd/   (Beweissystem der NASA Version 6.0.9©)  Datei vom 28.9.2014 mit Größe 38 kB image not shown  

Quellcode-Bibliothek storedproc.pli   Sprache: Pl1

 
/*
 * PLI Stored Procedure SAMPLE.PLISAMP
 * @param Action
 * @param City
 * @param Country
 * @param Response
 */


PLISAMP : Procedure ( Action   ,
                       City     ,
                       Country  ,
                       Response ) options (main);

 dcl Action   CHAR  (8) VAR;
 dcl City     CHAR (32) VAR;
 dcl Country  CHAR (32) VAR;
 dcl Response CHAR (80) VAR;

 dcl Sqlcode_Pic PIC'SSS999';

 EXEC SQL INCLUDE SQLCA;

 Action=TRANSLATE(Action,'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
                         'abcdefghijklmnopqrstuvwxyz');

 select (Action);
   when ('S','SELECT'do;
     Select;
       When (City='' & Country=''do;
         EXEC SQL
           DECLARE C1 CURSOR WITH RETURN WITH HOLD FOR
             SELECT * FROM SAMPLE.CITYTABLE
         ;
         EXEC SQL
           OPEN C1
         ;
       end;
       When (City=''do;
         EXEC SQL
           DECLARE C2 CURSOR WITH RETURN WITH HOLD FOR
             SELECT * FROM SAMPLE.CITYTABLE
               WHERE COUNTRY=:COUNTRY
         ;
         EXEC SQL
           OPEN C2
         ;
       end;
       When (Country=''do;
         EXEC SQL
           DECLARE C3 CURSOR WITH RETURN WITH HOLD FOR
             SELECT * FROM SAMPLE.CITYTABLE
               WHERE CITY=:CITY
         ;
         EXEC SQL
           OPEN C3
         ;
       end;
       Otherwise do;
         EXEC SQL
           DECLARE C4 CURSOR WITH RETURN WITH HOLD FOR
             SELECT * FROM SAMPLE.CITYTABLE
               WHERE CITY=:CITY AND COUNTRY=:COUNTRY
         ;
         EXEC SQL
           OPEN C4
         ;
       end;
     end;
     if Sqlcode=0 then Response='Select successful';
     else do;
       Sqlcode_Pic = Sqlcode;
       Response='Select unsuccessful: Sqlcode '||Sqlcode_Pic;
     end;
   end;
   when ('I','INSERT'do;
     Select;
       When (City='' & Country='')
         Response='Insert unsuccessful: City and Country not specified';
       When (City='')
         Response='Insert unsuccessful: City not specified';
       When (Country='')
         Response='Insert unsuccessful: Country not specified';
       Otherwise do;
         EXEC SQL
           INSERT INTO SAMPLE.CITYTABLE
             (CITY, COUNTRY) VALUES (:CITY, :COUNTRY)
         ;
         if Sqlcode=0 then Response='Insert successful';
         else do;
           Sqlcode_Pic = Sqlcode;
           Response='Insert unsuccessful: Sqlcode '||Sqlcode_Pic;
         end;
       end;
     end;
   end;
   when ('D','DELETE'do;
     Select;
       When (City='' & Country='')
         Response='Delete unsuccessful: City and Country not specified';
       When (City='')
         Response='Delete unsuccessful: City not specified';
       When (Country='')
         Response='Delete unsuccessful: Country not specified';
       Otherwise do;
         EXEC SQL
           DELETE FROM SAMPLE.CITYTABLE
             WHERE CITY=:CITY AND COUNTRY=:COUNTRY
         ;
         if Sqlcode=0 then Response='Delete successful';
         else do;
           Sqlcode_Pic = Sqlcode;
           Response='Delete unsuccessful: Sqlcode '||Sqlcode_Pic;
         end;
       end;
     end;
   end;
   otherwise Response='Action "'||Action||'" not supported';
 end;

 END PLISAMP;

57%


¤ 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.12Bemerkung:  (vorverarbeitet)  ¤

*Bot Zugriff






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

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 ist noch experimentell.