KB Article 7103
2007/12/13

Close
X
Contact Tech Support

 Email Tech Support
 (250) 655-1766
 [7:30 - 5:00 PST]
Your Meeting ID will be Provided by a Rep.
Tech Support
Tech Support Home
Software Updates
Knowledge Base Search
Recent KB Articles
Product FAQs
Code Samples
Documentation
Tech Blog
System Requirements
Installation Instructions
Support Testimonials
Contact us to...
Create a Ticket
Request a Free Demo
Suggest a New Feature
Submit Feedback
Upload a Large File
Other Services
Software Training
Professional Services

How to call a subprocedure in PML

Product: WebSmart ILE Type: Frequently Asked Question

Suppose you have a service program which exports some subprocedures, and you want to call one of those subprocedures in your PML. For example, suppose you have a subprocedure called "getprice" (exported from service program "MYSRVPGM") which accepts a product number and customer number, and returns a price. You want to call this subprocedure in the PML like this:
 
price = getprice(prod_num, cust_num);
 
Here is what you should do:
  1. In file XL_WEBLIB/PW_USRC, create a member called UINDEX if it does not already exist.
  2. We need to tell the WebSmart generator where to find the prototypes. In member UINDEX, add a line like this:
    SUBPROT: USUBPROTOS
  3. We need to tell the WebSmart generator what the prototypes for the subprocedures look like. In file XL_WEBLIB/PW_USRC, create a member called USUBPROTOS. This is where you should put the prototypes of the subprocedures you wish to make available. For example (the exported subprocedure name may be case sensitive):

    D getprice PR 9P 2 extproc('GETPRICE')
    D product 7P 0 value
    D customer 7P 0 value

  4. We need to make the subprocedure 'getprice' available in the PML. In file XL_WEBLIB/PW_USRC member UPARSER, add this:

    FUNC='getprice'
    {
    PROT='NUM getprice(NUM &product, NUM &customer)';
    SRC='
    getprice(~&product!:~&customer!)';
    RTYPE='NUM';
    }

  5. Add the service program or module to binding directory XL_WEBLIB/ESPTBNDD
  6. Update the generator files in the IDE. If you are at version 6.8+, go to tools >> options >> ILE >> generator files, and choose 'Download Files'.
  7. If using a service program, it will need to be in the web job's library list at run time. A convenient way to ensure this is to use a Library List Object.
  
For additional information, please see Chapter 9 "Extending the PML", section "Customizing PW_USRC".

Rate This Article

Did this example help you to achieve your goal?
 Yes  No  Don't Know

Enter additional comments below.   If you want to hear back from us, include your contact information.

Email Address:
Comments:
Please enable JavaScript in order to rate this page.