By Chris Malek | 03 April 2011
Problems with Component Interface and COBOL remotecalls
Unfortunately, Peoplesoft still uses COBOL throughout the application. Even worse there can be online components that call COBOLs from the component processor on pages (looking at you Student Admin). There are several different ways that REMOTECALLs may be initiated but we will focus on one here that can cause problems with Component Interfaces.
Lets say you have a page with a level 1 grid mocked up like this.
- The user enters values in Edit Boxes labeled “value 1” and “value 2.”
- The user then presses the push button labeled “calculate.”
- On FieldChange of the push button, a DoSaveNow is called to commit the data to the database
- Then after the save processing completes, the RemoteCall is fired with parameters pointing to the new database rows that were just committed
- The COBOL run and picks up those values and calculates a result and the result is display on the page.
This model works fine when the user is interacting with the component using a web browser. However, this structure can cause problems when you want to create a component interface based off that Component and want to mimic that same push button behavior in code.
So lets say you want to do the following:
- You have an application engine processing some batch results from a file.
- The application engine calls a component interface based on the logic described above.
- The Edit Box values for 1 and 2 are entered using the CI.
- Then the Application Engine “presses the button” by changing the value of the field tied to the push button in the CI.
There are two things that may happen here.
- You may get some kind of error
- You may get an unexpected or no result
Why is this? Well as documented in PeopleBooks section titled Understanding PeopleCode Behavior and Limitations, when a Component Interface is called from an application engine all the database commits are actually controlled by the application engine. So in the structure of the component, the logic assumes that the dosavenow will actually trigger a commit. However, in the case of the AE calling the CI the commit did not occur when the button was pushed.
For components like this you have to do some customization to get it to work. In a situation like this I would add a simple piece of code in the push button fieldChange peoplecode. This code basically says “if this code is being triggered by a component interface then do NOT run the remotecall.” It looks like this.
If %CompIntfcName <> "" Then /* Run the remotecall stuff */ End-If;
Then in the application engine I would actually trigger the remotecall passing in the same information but pulling the appropriate values out of the CI properties and passing them as parameters to the CI.