Workbench User Guide : Adding Other Components to Your Application : Procedures : Create a 4GL Procedure
 
Share this page          
Create a 4GL Procedure
A 4GL procedure is a set of 4GL statements that you can call by name in an application. 4GL procedures are written in fourth-generation languages such as Java. You can create, edit, and delete 4GL procedures on the Develop tab.
To create a 4GL procedure
1. In the Applications portlet of the Develop tab, select the application in which you want to create, edit, or delete a component, and then select the header bar of the Components portlet to make it active.
2. Click File, New, 4GL Procedure.
The Create Procedure dialog appears.
3. Enter a name for the procedure in the Name field (for example, My_4GL_Procedure).
4. (Optional) Enter a comment for the component in the Remark field.
5. Specify the properties for the procedure.
For descriptions of each property, see 4GL Procedure Properties.
6. Click Create.
Workbench displays the 4GL Procedure Editor. Workbench also calls the Script Editor (or your system editor) and displays a script template containing the keywords required for a 4GL procedure for you to write the procedure code:
7. Write the script for the procedure.
For more information about using the Script Editor to write procedures, see Adding Other Components to Your Application.
8. Click File, Close in the Script Editor.
9. (Optional) Click Tools, Compile in the 4GL Procedure Editor to compile the procedure.
Note:  This step is not required because OpenROAD automatically compiles the procedure the next time you run the procedure. For more information, see How You Can Compile 4GL Procedures.
10. Click Debug, Go in the 4GL Procedure Editor to test the procedure.
To stop running the procedure, click Debug, Stop.
Note:  You also can use the Workbench's Run toolbar button to test the current application, thus ensuring that the procedure receives any parameters it needs from the frame or procedure that calls it. For more detailed information, see Running an Application.
11. Save the 4GL procedure by selecting the appropriate command on the File menu.
4GL Procedure Properties
You can set the following properties for 4GL procedures:
Return Value
Specifies the data type of the return value:
None
Simple
Reference
Array
Length
Specifies the maximum number of characters for the return value for simple varchar data types.
You can enter the name of the class directly, or access the class by clicking the control button to the right of the entry field and selecting it from the Select a Class dialog. For more information about this dialog, see Set a Return Value.
SCP Generation
Selects one of the following options:
No SCP
Specifies that SCPs should not be generated
Generate SCP
Specifies that SCPs should be generated
Include in SCP MetaData
Specifies that both SCPs and SCP meta data should be generated
SCP Name
If you selected the Generate SCP option, specifies a name for the generated SCP. Workbench provides a default name, which you can change.
How You Can Compile 4GL Procedures
After you have written a 4GL procedure, you can compile it by clicking Tools, Compile in the 4GL Procedure Editor. While it is compiling the procedure, Workbench provides status messages at the bottom of the 4GL Procedure Editor window. For example:
If it finds any errors, Workbench opens the Compilation Errors window. For more information about this window, see the How You Can View Compilation Errors.