Before you begin, you must complete Exercise 3.5: Open a source member for edit and if you were unfamiliar with the editing features of the Remote Systems LPEX Editor then you must complete Exercise 3.6: Reviewing Remote System LPEX Editor features.
To make it easier for you most of the RPG source is already prepared for you. You have already opened the correct source member GETDATAS in a previous exercise using the Remote Systems view. Read through the source. It contains an F spec to access file CUSTOML3 which contains the customer data keyed by customer number. The D specs define the data structure CSTRUC that gets passed back to your Web page and the CUSTNOI variable that gets passed from the Web page to this program. Also variable FEEDBACK is defined as 20 characters, to return message id and customer number in case the customer record was not found.
The prototype for procedure getrecord with the parameters is defined as the:
The procedure interface defines the parameters in the same way as the prototype. Inside the procedure after the procedure interface you need to add the RPG code.
Adding RPG code
To add the RPG code:
Your coding is complete, so let's create the service program module.
Creating the service program module
To create the service program module:
Be careful, don't click the X on the workbench window title bar.
The Create RPG Module (CRTRPGMOD) dialog opens.
After the compile the iSeries Error List view is shown, listing all compile
errors. You may only see information and warning messages that means
your compile was completed and the program module was created.
Fixing errors
In the iSeries Error List view, check the errors:
This positions the cursor in the Editor window on the statement that is wrong.
Creating a service program
To create a service program:
The Create Service Program (CRTSRVPGM) dialog opens.
You should see a message that the Service program was created.
You have edited an RPG source member and created a service program object.
Module recap
You have completed Module 3. Creating the RPG service program for your Web application (optional). You have learned how to:
Now that you have created a RPG service program, you can continue to Module 4. Creating a Web project.
(C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.