|
>http://faq.midrange.com/data/cache/240.html > >Is this the one you were referring to, Buck? Alas, >Rick never appended to it. I can't recall what I was thinking this morning; forget last June! This looks like the place to start though. If you are just fishing, may I suggest that you find any subprocedure on your system, or on the internet and make it into a service program. All you need to do is use h nomain and you are good to go. I put the PR specs in a separate source member called QPROTOSRC (Thanks David Morris!) so that all my source members have the same name. So: QRPGLESRC SRVPGM h nomain /copy qprotosrc,srvpgm p b export d procname pi 10i 0 d parm1 d parm2 ... p e QPROTOSRC SRVPGM d procname pr 10i 0 d parm1 d parm2 Compile the service program with PDM option 15 (CRTRPGMOD) and then CRTSRVPGM export(*all) Do a RTVBNDSRC and put it into QSRVSRC member SRVPGM. Edit that source member to make your own signature. Something like this: "STRPGMEXP PGMLVL(*CURRENT) SIGNATURE(' 1.00 15 Aug 03')" Re-create the service program with CRTSRVPGM but use EXPORT(*SRCFILE). You should have 3 source members, all named the same as the service program: QRPGLESRC (the actual PI part of the code) QPROTOSRC (the PR part of the code) QSRVSRC (the signature of each version of the code) Now create a binding directory which reflects this service program. To make your life simple, call it SRVPGM. Then do an ADDBNDDIRE for service program SRVPGM. Use *LIBL for now. You are now ready to compile a program that uses this service program. Edit up some source. Specify these as a minimum: h bnddir('SRVPGM') dftactgrp(*no) actgrp(*new) d/copy qprotosrc,srvpgm c eval int=procname(thisParm: thatParm) c int dsply Make sure that the service program SRVPGM is in your library list. Compile with PDM option 14 and run it. You have just created and used a service program. Now let's add a second procedure to it. Since this is just an exercise, it doesn't matter if the procedures are related or not, just find another one and start editing. QPROTOSRC gets the new PR. Put it after the existing PR. QSRVSRC gets a new section. Copy all the specs and place the copy after the existing set. Change the *CURRENT on the copied specs to *PRV. Change the version of the original specs to 1.01. In the *CURRENT set (the ones on top) copy the export for procname after the procname line and change it to procname2. You'll get something like what's in the FAQ. QRPGLESRC gets the new PI. Put it after the existing PI. Compile QRPGLESRC with PDM option 15 and then either CRTSRVPGM or UPDSRVPGM to put the newly compiled code into the service program. Now create a NEW RPG program to test out both procedures. Do NOT modify the first one you used; we need it. Compile and test to make sure that this program works with both procedures. Now call the first program; the one with the old signature. It still works. Now start poking around with DSPPGM and DSPSRVPGM and pay attention to the signatures. You'll see that old programs that match any old signature will still run, and that newly compiled programs will always get the *CURRENT signature. Record the signatures. Now, re-create the service program with EXPORT(*ALL) DSPSRVPGM and look at the signature. Run your two programs. They don't work, do they? Now create a third program to test the procs. Compile and run it; no problem because it uses the new system-generated procedure. Record the signature. Add a third procedure to the service program and CRTSRVPGM EXPORT(*ALL). Record the signature. You can tell even before you try that none of your 3 test programs will run because none of them match the new system-generated signature. So you can see that managing your own signatures is far better than EXPORT(*ALL). You can still use binder language and *PRV support if you leave off the SIGNATURE keyword, but I prefer being able to see the version/date as the signature to the system-generated one. I hope this helps some. --buck
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.