• Subject: RE:execute SQL statements
  • From: John Carr <74711.77@xxxxxxxxxxxxxx>
  • Date: Tue, 12 May 1998 10:31:15 -0400



------
RE:     execute SQL statements through a CL program

>     Hello,
>     A question on the AS/400 query facility. 
>     We need to execute SQL statements through a CL program. When we run 
>     the CL, it gives a journalling error. any idea how to accomplish this?
>     Also, we want to be able to execute multiple SQL statements from the 
>     same SQL source. Is this possible? How can we do this?
>     Best regards,
>     Phani


Phani

Write this simple RPG program, Then call it from your CL program.
It will do UPDATE or DELETE type SQL statements.
Create the SQL statement in your CL program like;

UPDATE  FILEX   SET FIELDA = 'A' WHERE whatever blah blah blah
or
DELETE FROM FILEX WHERE FIELDA = 'something'  
ETC.

In your case, read the source(SQL stuff) with one program and call the 
below program repeatedly,  once for each source statement.


John Carr
EdgeTech
804-739-7689 Ph
804-739-7689 Fax

------------------------------------------------
   ISQLCMD      DS              1024
   I*

   C*                                   |-----------------
   C    *ENTRY  PLIST                   | Input parameter 
   C            PARM    SQLCMD          | See D/S SQLCMD
   C            PARM    ERROR      1    | Error Flag 
   C*                                   |------------------
   C/EXEC    SQL
   C+           EXECUTE IMMEDIATE: SQLCMD
   C/END-EXEC
   C*
   C*                                   |---------------------
   C    SQLCOD  IFNE    0               |If SQL return code = Error
   C            MOVE    YES     ERROR   |  Set Error Flag
   C            ENDIF                   |
   C*                                   |


+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available here. If you have questions about this, please contact [javascript protected email address].