|
First question: In SQL, stored procedures can't call entry points in service programs (which is I think what you're after), unfortunately. There may be another way of doing it from VB not using SQL - anyone else have any ideas? However, if your design can be manipulated to use them, SQL *functions* can call entry points in service programs. Second question: Here's a couple of examples of RPGIII programs (SQLRPG) that return result sets. It works fine in ILE RPG too but I haven't got an example handy. ****** RPG code for program TEST01QA (compiled using CRTSQLRPG on a box with the licensed program 5769ST1 DB2 Query Mgr and SQL DevKit for AS/400 loaded - this is not required at run time). ****** IV99999 DS 4 I 1 1 OUT1 I 2 9 OUT2 I B 10 130OUT3 C MOVE 4 ROW 10 C 1 OCUR V99999 C MOVE 'A' OUT1 C MOVEL'SHAWM 'OUT2 C Z-ADD99 OUT3 C 2 OCUR V99999 C MOVE 'B' OUT1 C MOVEL'WARRM 'OUT2 C Z-ADD100 OUT3 C 3 OCUR V99999 C MOVE 'C' OUT1 C MOVEL'ENRIGHTR'OUT2 C Z-ADD101 OUT3 C 4 OCUR V99999 C MOVE 'D' OUT1 C MOVEL'DAVIESG 'OUT2 C Z-ADD29876 OUT3 C/EXEC SQL SET RESULT SETS ARRAY :V99999 FOR :ROW ROWS C/END-EXEC C* MOVEL*ON *INLR C RETRN ****** SQL CREATE PROCEDURE: CREATE PROCEDURE QGPL/TEST4 RESULT SETS 1 LANGUAGE RPG SPECIFIC QGPL/TEST4 NOT DETERMINISTIC CONTAINS SQL EXTERNAL NAME SHAWM/TEST01QA PARAMETER STYLE GENERAL ****** Slightly more complex result set processing This one has an externally described data structure so that the columns in the result set automatically match those in the file that provides the external description. I have used the physical file QCUSTCDT shipped by IBM in library QIWS (I copied it into QGPL to avoid library list problems). We read the first five records of this same file to produce our result set. You will observe that this stored procedure does exactly the same thing (but only reading 5 rows) as the SQL command "select * from qcustcdt" so is almost completely pointless - but obviously a real one would probably have some business logic in it! RPG program TEST01QD (compiled using CRTSQLRPG as above): ****** FQCUSTCDTIF E DISK IV99999 E DSQCUSTCDT 5 C Z-ADD5 ROW 10 C 1 DO 5 I 30 C I OCUR V99999 C READ QCUSTCDT 99 C END C/EXEC SQL SET RESULT SETS ARRAY :V99999 FOR :ROW ROWS C/END-EXEC C* MOVEL*ON *INLR C RETRN ****** SQL CREATE PROCEDURE: CREATE PROCEDURE QGPL/TEST5 RESULT SETS 1 LANGUAGE RPG SPECIFIC QGPL/TEST5 NOT DETERMINISTIC CONTAINS SQL EXTERNAL NAME SHAWM/TEST01Qd PARAMETER STYLE GENERAL ****** "Schenck, Don" <Don.Schenck@pfizer.com> on 14/03/2001 12:44:40 Please respond to MIDRANGE-L@midrange.com To: "'MIDRANGE-L@midrange.com'" <MIDRANGE-L@midrange.com> cc: (bcc: Mandy Shaw/Pacific/UK) Subject: RE: RE: Visual Basic and AS/400 QUESTION: It's possible to call an RPG program from within a VB program, right? And it's possible to create an ILE RPG program with multiple entry points, right?? An "object", if you will. So my question is: Can't you write all the data access routines in ILE RPG, and simple call them from the VB programs?? 'Nother question: HOW does one return a SET of records from the ILE RPG program to VB?? -- Don Schenck Schenck Technical Consulting DonS@SchenckTech.com / www.SchenckTech.com > -----Original Message----- > From: Andy Leisk [mailto:ALeisk@banta.com] > Sent: March 13, 2001 6:37 PM > To: midrange-l@midrange.com > Subject: Re: RE: Visual Basic and AS/400 > > > yes the AS/400 is just another data server, but does any one > have any examples > of how to use an MS ADO Data Control 6.0 OLDEB for accessing > an AS/400 data > object (a physical or logical file). > > > Andy Leisk > Stratagem Inc., I.T. Consultant at Banta Corp. > (Rent-a-programmer and AS/400 computer janitor) > 920-751-4434 > > >>> owner-midrange-l@midrange.com 03/13 8:29 AM >>> > Alan -- > > Don't think about the AS/400 ... just learn VB. The AS/400 is > just another > database server. > > > -- Don Schenck > Schenck Technical Consulting > DonS@SchenckTech.com / www.SchenckTech.com > > > > -----Original Message----- > From: Alan Novick [mailto:mida@pressmantoy.com] > Sent: March 13, 2001 8:53 AM > To: MidRange-L > Subject: Visual Basic and AS/400 > > > What are some good resources for learning about using Visual > Basic with the > AS/400? > > Thanks, > > Alan Novick > Pressman Toy Corp > New Brunswick, NJ > > +--- > | This is the Midrange System Mailing List! > | To submit a new message, send your mail to MIDRANGE-L@midrange.com. > | To subscribe to this list send email to MIDRANGE-L-SUB@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 is the Midrange System Mailing List! > | To submit a new message, send your mail to MIDRANGE-L@midrange.com. > | To subscribe to this list send email to MIDRANGE-L-SUB@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 is the Midrange System Mailing List! | To submit a new message, send your mail to MIDRANGE-L@midrange.com. | To subscribe to this list send email to MIDRANGE-L-SUB@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 +--- Regards, Mandy Shaw Catalyst Solutions plc Kingfisher House Frimley Business Park Camberley Surrey GU16 5SG UK http://www.catalyst-solutions.com Email: Mandy.Shaw@uk.catalyst-solutions.com Telephone: +44 (0)870 166 1000 DDI: +44 870 166 1324 Facsimile: +44 870 168 3920 Mobile: +44 410 447966 ---------------------------------------------------------------------- ---------------------------------------------------------------------- Catalyst Solutions plc. Registered No 2918101. Registered @ Kingfisher House, Frimley Business Park, Frimley, Surrey. GU16 5SG U.K. NOTICE: This message is intended only for the named addressee(s) and may contain confidential and/or privileged information. If you are not the named addressee you should not disseminate, copy or take any action or place any reliance on it. If you have received this message in error please notify postmaster@catalyst-solutions.com and delete the message and any attachments accompanying it immediately. ---------------------------------------------------------------------- +--- | This is the Midrange System Mailing List! | To submit a new message, send your mail to MIDRANGE-L@midrange.com. | To subscribe to this list send email to MIDRANGE-L-SUB@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 +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 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 on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.