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



Joe Pluta wrote:
> 
> AGGHHHHHHHHHHH!
> 
> This is all sooooo cool and I don't quite get it.  Whenever you folks talk
> about this stuff, I ALMOST understand it.  It's like when you ALMOST have to
> sneeze... incredibly frustrating!
> 
> Does anyone have a SIMPLE, real example that I can compile on my machine to
> exemplify the pros and cons of this?  Or if something from one of the
> manuals is best, just point me at it.  I have to be able to touch something
> (and break it <grin>) in order to understand it.  (Hence the piles of
> lawnmower parts in my backyard when I was growing up.)
> 

I know what you mean - I don't really learn something until I get my
hands dirty.  Here's a bnddir example.  (It's as simple as I can make
it, but I don't know about real ... real would make this post WAY WAY
too long instead of just too long :-)

Step 1:

Create 5 source members in qrpglesrc: junkprotos, junksrv, junkpgm,
junkbndsig, junkbndcur

 * This is junkprotos
D proc1           pr                       
D   parm                        10a   const

 * This is junksrv
H nomain                                                    
 /copy junkprotos                                           
D msg             s             52a                         
P proc1           b                   export                
D                 pi                                        
D   parm                        10a   const                 
C                   eval      msg = 'Caller called ' + parm 
C                                 + ' and this is proc1.'   
C     msg           dsply                                   
P                 e                                         

 * This is junkpgm:
 /copy junkprotos                             
C                   callp     proc1 ('proc1') 
C                   eval      *inlr = '1'     

 /* This is junkbndsig */
STRPGMEXP PGMLVL( *CURRENT ) SIGNATURE('JUNK')
  EXPORT SYMBOL( "PROC1"         )           
ENDPGMEXP                                         

 /* This is junkbndcur */
STRPGMEXP PGMLVL( *CURRENT ) SIGNATURE(*GEN)
  EXPORT SYMBOL( "PROC1"         )           
ENDPGMEXP                                         


Step 2: 
===> crtrpgmod junksrv
===> crtrpgmod junkpgm

===> crtsrvpgm junksrvall module(junksrv) export(*all)
===> crtsrvpgm junksrvsig module(junksrv) srcfile(qrpglesrc)
srcmbr(junkbndsig)
===> crtsrvpgm junksrvcur module(junksrv) srcfile(qrpglesrc)
srcmbr(junkbndcur)

===> crtpgm junkpgmall module(junkpgm) bndsrvpgm(junksrvall)
===> crtpgm junkpgmsig module(junkpgm) bndsrvpgm(junksrvsig)
===> crtpgm junkpgmcur module(junkpgm) bndsrvpgm(junksrvcur)

===> call junkpgmall
===> call junkpgmsig
===> call junkpgmcur

All should run successfully and display something like "Caller called
proc1, this is proc1"

Step 3:
- Edit the junkprotos member and add proc2, identical to proc1
- Edit the junksrv member and add proc2, identical to proc2 (don't 
  forget to change the DSPLY line)
- Edit the junkbndsig and junkbndcur files as follows.  (In junkbndsig,
  add a line; in junkbndcur, add a new signature block based on the 
  previous one, and change the previous one to have *PRV.)

 /* This is junkbndsig */
STRPGMEXP PGMLVL( *CURRENT ) SIGNATURE('JUNK')
  EXPORT SYMBOL( "PROC1"         )           
  EXPORT SYMBOL( "PROC2"         )           
ENDPGMEXP                                         

 /* This is junkbndcur */
STRPGMEXP PGMLVL( *CURRENT ) SIGNATURE(*GEN)
  EXPORT SYMBOL( "PROC1"         )          
  EXPORT SYMBOL( "PROC2"         )           
ENDPGMEXP                                         
STRPGMEXP PGMLVL( *PRV ) SIGNATURE(*GEN)
  EXPORT SYMBOL( "PROC1"         )           
ENDPGMEXP                               

Step 4:
This will illustrate that export(*all) is hopeless, and that both the
other methods work fine to allow existing programs to run after a
service program has more procedures added.
- Recreate the junksrv module
- Recreate the three service programs the same way as before (but don't
recreate the programs)
- Call the three programs
  - junkall will fail with a signature violation
  - the other two will run fine (both methods allow existing programs to
run without
    being recreated)

Step 5:
This will illustrate that you have to keep the procedures in the
original order with both binder source styles.
- Edit the junkpgm source and add a line to callp proc2('proc2')
- Recreate the junkpgm module
- Recreate the two junkpgmsig and junkpgmcur the same way as before
- Call these two programs (they should work fine, displaying the correct
call info)
- Now edit junkprotos and junksrv and add proc3 same as the other two
- Edit the binder source as follows, adding the PROC3 before PROC2
instead of after:

 /* This is junkbndsig */
STRPGMEXP PGMLVL( *CURRENT ) SIGNATURE('JUNK')
  EXPORT SYMBOL( "PROC1"         )           
  EXPORT SYMBOL( "PROC3"         )      /* out of order */
  EXPORT SYMBOL( "PROC2"         )           
ENDPGMEXP                                         

 /* This is junkbndcur */
STRPGMEXP PGMLVL( *CURRENT ) SIGNATURE(*GEN)
  EXPORT SYMBOL( "PROC1"         )          
  EXPORT SYMBOL( "PROC3"         )      /* out of order */
  EXPORT SYMBOL( "PROC2"         )           
ENDPGMEXP                                         
STRPGMEXP PGMLVL( *PRV ) SIGNATURE(*GEN)
  EXPORT SYMBOL( "PROC1"         )          
  EXPORT SYMBOL( "PROC2"         )           
ENDPGMEXP                                         
STRPGMEXP PGMLVL( *PRV ) SIGNATURE(*GEN)
  EXPORT SYMBOL( "PROC1"         )           
ENDPGMEXP                               

- recreate the two junksrvcur and junksrvsig service programs as before 
  (but don't recreate the programs)
- call junkpgmcur and junkpgmsig
- the dsply's will show that the programs think they are calling proc2
but 
  they will actually call proc3.
- correct both binder source members to move proc3 after proc2
- recreate the service programs (but not the programs)
- call the programs again - they should be correct

My conclusions:
1. Don't use EXPORT(*ALL).
2. You can't change the order of the exports with either style of binder 
   source, so you might as well use the simple form with the single 
   list of exports.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.