× 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.


  • Subject: RE: How to create my own built-in functions
  • From: Scott Klement <klemscot@xxxxxxxxxxxx>
  • Date: Fri, 14 Jul 2000 10:45:58 -0500 (CDT)


Here, I'll give you a quick, trivial example of implementing a service
program that is meant to be called from other programs...

At the bottom of this message will be 4 source members.  Have fun :)



On Fri, 14 Jul 2000, Stone, Joel wrote:

> Thanks for the info.  I was looking for info on how to do this and use the
> created functions IN ANY ILE Program  (Without copying the subprocedure
> source into the pgm).
> 
> So for your example, after creating a srvpgm containing the procedure
> "ShowMsg", how can I invoke the ShowMsg function in other programs?
> 
> 


      ** Source Member:  SILLYSRV_H
      **       Purpose:  Defines prototypes for use with SILLYSRV
      **
     D SillyProc       PR
     D   Message                     50A   const



      ** Source member:  SILLYSRV
      **       Purpose:  Source for module "SILLYSRV" which will be made
      **                     into a service program of the same name.
      **
      ** To compile:
      **     1) CRTRPGMOD SILLYSRV SRCFILE(xxx/QRPGLESRC) DBGVIEW(*LIST)
      **     2) CRTSRVPGM SILLYSRV MODULE(SILLYSRV) EXPORT(*ALL)
      **
     H NOMAIN

     D/COPY QRPGLESRC,SILLYSRV_H

     P SillyProc       B                   Export
     D SillyProc       PI
     D   Message                     50A   const
     c     Message       dsply                   Pause             1
     c                   return
     P                 E



      **   Source Member: COOLPGM
      **         Purpose: To demonstrate the use of SILLYSRV
      **
      **     to compile:
      **        1) First make sure SILLYSRV has been compiled.
      **        2) CRTRPGMOD COOLPGM SRCFILE(xxx/QRPGLESRC) DBGVIEW(*LIST)
      **        3) CRTPGM COOLPGM BNDSRVPGM(SILLYSRV)
      **
      **

     D/COPY QRPGLESRC,SILLYSRV_H

     C                   callp     SillyProc('Testing the SillySrv *SRVPGM')

     c                   eval      *inlr = *on



/**   Source Member:  COOLPGM2                                       +
 **         Purpose:  To demonstrate, once again, the use of the     +
 **                        SILLYSRV service program.                 +
 **                                                                  +
 **      to compile:                                                 +
 **         1) Make sure SILLYSRV has already been created.          +
 **         2) CRTCLMOD COOLPGM2 SRCFILE(xxx/QCLSRC) DBGVIEW(*LIST)  +
 **         3) CRTPGM COOLPGM2 BNDSRVPGM(SILLYSRV)                   +
 **                                                                 */
pgm

             DCL        VAR(&message) TYPE(*CHAR) LEN(50)

             CHGVAR     VAR(&message) VALUE('Its not that easy being +
                          greenscreen!')

             CALLPRC    PRC(SillyProc) PARM(&message)

endpgm


+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-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 thread ...

Replies:

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.