Creating an RPG procedure in the Remote Systems LPEX editor

Before you begin

You can create an RPG main procedure or subprocedure while editing any RPGLE member in the Remote Systems LPEX editor. A procedure is any piece of code that can be called with a bound call, in essence, the CALLP operation code.

About this task

To create the procedure:

Procedure

  1. Expand your connection until you find the file in which you want to create the RPG procedure.
  2. Double-click the file to open it in the Remote Systems LPEX editor.
  3. With your cursor inside the editor view, right-click and select New > Procedure. Or, from the workbench menu, click Source > New > Procedure.
  4. In the RPG Procedure wizard, select the procedure type from the Procedure type drop-down menu.
  5. Enter a valid ILE RPG name in the Procedure name field.
  6. In the External Name (EXTPROC) field, you can enter one of the following:
    1. Program (EXTPGM)
    2. Main procedure (EXTPROC)
    3. Subprocedure (EXTPROC)
    4. Subprocedure with CLLE calling conventions (EXTPROC(*CL))
    5. Subprocedure with C calling conventions and parameter widening (EXTPROC(*CWIDEN))
    6. Subprocedure with C calling conventions and no parameter widening (EXTPROC(*CNOWIDEN))
  7. (Optional) Enter a descriptive purpose for the procedure. This description will appear in the code's header comments.
  8. Select the Exportable for use with other code (EXPORT) check box if this procedure is exportable for use with other code. Note, however, that if you select this check box, the wizard places both the prototype and procedure code into the current file. After you finish the wizard, you need to manually move the prototype into a COPY file, so that procedures can call this prototype. You also need to enter a COPY statement into the procedure code, at the place where you removed the prototype code.
  9. Select the Generate free-form calculations check box if you want the calculations section of your RPG procedure to be in free-form code, rather than fixed-form. The rest of the generated source (D and P specifications) will be fixed-form code. See Converting ILE RPG code from fixed-form to free-form for more information.
  10. Click Add to add a parameter to your procedure. Complete the dialog box to define the parameter and click OK.
  11. (Optional) Select the Return a value check box if you want to define a Return value. This action enables the Next button. Otherwise, click Finish.

What to do next

If you selected Return a value:
  1. Click Next to go to the Return Value page of the RPG Procedure wizard.
  2. If you do not need to specify the type and length of the value, you can select the Defined like field and enter the name of a field, data structure, or record format that you want to use as a model for the returned value. If you want to specify all of this information yourself, do not check the Return Value check box and see the next step.
  3. Select a return value type from the Type drop-down list. The type that you select automatically completes a number of the other fields in this page of the wizard, and keeps some of the fields disabled if they are not applicable for the type of value you selected. You can modify any of the values in the enabled fields if you want. Make sure to check the F1 help in the various fields of this wizard if you are not sure what to enter.
    Note: If the type you selected is date or time, the format label will be set to DATFMT (for date) or TIMFMT (for time). Then you can select the format and separator for your date or time label. If the type you selected is data, a Class Entry field is enabled where you can specify a valid Java™ class.
  4. (Optional) Enter a description for the return value. This description will appear in the code's header comments.
  5. Click Finish.

Feedback