1. Home
  2. Knowledge Base
  3. Deprecated Documentation
  4. Validating via an RPG External Object

Validating via an RPG External Object

mrc recommends using the Workflow Designer to validate user input going forward.


This document will explain how to call an external object RPG program for validity checking. For basic information regarding validity checking please see this document.

The source code for this RPG can be found here. For the sake of this documentation, the RPG code will be located in MRCWORKLIB/RPGLESRC and the file will be named VALIDDATES.

First, we will define this external object to our data dictionary.

Click “Admin” -> “External Objects” -> “Create New.”

Be sure that the Program and Object name match.

Now that your external object has been created, we need to map the matching parameters to the object.

Since this object contains three parameters, we must map the same parameters, in the correct order, to this object that are listed in the RPG code.

The first parameter must be the error message, and is noted as such:

The “Selected Field Required” option is set to “No” because this parameter must not be mapped at runtime.

*VALID must be included in the Object Parameter Description.

Click “Accept”. Create the remainder of your parameters.

After all the parameters are created, create a Stored Procedure by clicking the “Create” button for the specific object on the “Manage External Objects” screen.

This will pull up the Create Stored Procedure screen where you can view the code used to create the stored procedure, or actually create the stored procedure.

In this case, we want to click the Create button to create the stored procedure for this object. After clicking the Create button, you will see a confirmation that the stored procedure was created successfully.

Now that the external object has been created, all that is left to do is to include this object into your maintenance application.

Create your Maintenance application as you normally would. After including all of your specifications within Application Menu, click the “External Objects” button from the “2. Additional Options” tab.

Select the newly created object off of the “Select an Object” drop-down. Select the *FLDVALID location. Map all parameters, except for the Error Message Parameter (as it must be left blank, i.e. no field mapped to it).

Click “Accept”. Build your application.

Based upon the RPG logic provided, if a user forgets to enter a starting and ending date, forgets either the starting or ending date, or enters an ending date that is before the starting date, the external object will stop the record from being written to the database:

The text of the error message is controlled within your RPG logic.


There are a few specific rules that must be followed for this methodology to work correctly.

  • The first parameter must be specified for the error message, and must not be mapped to any field within your application.
  • The first parameter must contain the text *VALID in the description.
  • As a general rule for external objects, if you are chaining out to any tables, in your RPG you must include their libraries within the mrc-spring-context.xml file on the “libraries=” line to specify the run-time library list.
Updated on June 20, 2023

Was this article helpful?

Related Articles

Need Support?
Can’t find the answer you’re looking for? Don’t worry we’re here to help!
Contact Support