× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



>I try to figure out what you mean by "a
>generic stored procedure" but I can't
>come up with a strategy. Could you explain
>this a little bit?

Sure, Bruce!
  You write a stored procedure in an HLL like RPG:

h debug dftactgrp(*no) actgrp(*caller)
 * dbgview(*list)

 * Generic driver program
 * to register:

 * CREATE PROCEDURE BUCK/SQPSP(IN pgmName CHAR (10 ),
 *                             IN pgmType INT ,
 *                             INOUT returnValue CHAR (50 ))
 *                  LANGUAGE RPGLE NOT DETERMINISTIC
 *                  NO SQL CALLED ON NULL INPUT
 *                  EXTERNAL NAME BUCK/SQLSP PARAMETER STYLE
 *                  PARAMETER STYLE GENERAL

d pgmName         s             10
d pgmType         s             10i 0
d returnValue     s             50

 * parameters for called programs
d char8           s              8

c     *entry        plist
c                   parm                    pgmName
c                   parm                    returnValue

c                   select
c                   when      pgmType = 1
c                   call      pgmName
c                   parm                    char8
c                   eval      returnValue = char8
c                   other
c                   eval      returnValue = 'Unknown pgmType'
c                   endsl

c                   eval      *inlr = *on

All this program does is direct traffic - it calls the program passed to it
in parameter one.  The second parameter is there to help with various
parameter lists that the called program might have.  While this is a
simplistic case, you probably get the idea.  The third parameter is for
returning data back to the original caller of the procedure.

This is all messy, but if you have SPs that don't take variables
(PrintCreditReport) or take a single variable (relieveInventory 12345) then
this technique could reduce your need to have one SP created for each HLL
program.

As for the parameter type, you could easily build a table of program
name/parameter type that will provide that to the caller of the SP.

I hope I made some sense.  Reading it back makes me wonder about my sanity.
  --buck


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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

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.