This step is the same regardless of whether you will ultimately use the Run Control page with an SQR or App Engine program. Do the following in Application Designer:
Creating the Run Control Record
- Open Record definition PRCSRUNCNTL and make a copy by using "Save As" and giving the Record a new name (for example, "MY_PRCS_RC").
- When prompted to save a copy of the PeopleCode associated with PRCSRUNCNTL, choose "Yes".
- Create a new Page definition and save it with a new name (for example, "MY_PRCS_RC").
- Insert a Subpage onto your page, and choose "PRCSRUNCNTL_SBP".
- On the Insert Subpage dialog, change the "Subpage Record Name Substitution" value to your custom Run Control Record (i.e., "MY_PRCS_RC").
- Note: You do not need to add the default Run Control fields onto the page (OPRID, RUN_CNTL_ID, etc). These values will be populated automatically through PeopleCode.
- Create a new Component definition.
- Set the Component Search Record to your custom Run Control Record (i.e., "MY_PRCS_RC").
- Save the Component with a new name (for example, "My PRCS_RC").
- Register your Component using the Registration Wizard (Tools > Register Component).
- In the PIA, navigate to: PeopleTools, Process Scheduler, Processes
- Click the "Add a New Value" tab and enter the Process Type and Process Name.
- Note: The Process Name must exactly match the name of your App Engine program, or in the case of an SQR, must exactly match the file name of your SQR file (without the ".sqr" extension suffix).
- Add your custom Run Control Component under the "Component" grid area on the bottom left of the page.
- Add whichever Process Groups are appropriate to grant process security to the appropriate persons.
- A requirement in naming State Records is that they must have "_AET" as their suffix. Make a copy of your Run Control record, giving it a new name (for example, "MY_PRCS_AET").
- When prompted to save a copy of the PeopleCode associated with the original Record, choose "No".
- Change the Record Type from "SQL Table" to "Derived/Work". A Derived/Work Record doesn't persist any data to the database. Instead, it acts as an in-memory data structure while the program is running on the Process Scheduler.
- Open your App Engine program, and navigate to: File, Definition Properties
- On the "State Records" tab search for your State Record definition, and click the "Add" button to move the definition from the left-hand panel to the right-hand panel.
- Add an SQL step as the first step in the App Engine program. To
populate the State Record with values from the Run Control Record, we
use the Meta-SQL %Select function. For example:
%Select(OPRID, RUN_CNTL_ID, LANGUAGE_CD, LANGUAGE_OPTION, STRM)
WHERE OPRID = %OperatorId
AND RUN_CNTL_ID = %RunControl
MessageBox(0, "", 0 , 0, "STRM=" | MY_PRCS_AET.STRM);
HAPPY LEARNING :)