Creating a Procedure Frame
After selecting Procedure from the Create a Frame or Procedure pop-up of the Edit an Application frame, you see a menu of procedure types. Any type you select leads to the pop-up Create a Proceduretype Procedure Frame. The name of the procedure you choose takes the place of proceduretype in the title.
The following figure shows the Create a Procedure frame for the 4GL procedure type:
The Create a Procedure frame has the same four fields for each of the procedure types:
Name
Specifies the name of the procedure
Owner, frame Type, and Date
Indicate read-only defaults, as shown in the preceding figure
The following menu operations are available from the Create a Procedure Frame:
OK
Creates the frame
Cancel, ListChoices, Help
Perform standard operations
Create a Procedure
To create a procedure
1. From the Edit an Application frame, choose Create. The pop-up Create a Frame or Procedure frame appears.
2. Highlight Procedure and choose Select. This displays a pop-up frame with the types of available procedures, as shown in the Create a Procedure pop-up figure.
3. Select the type of procedure by highlighting the correct type and choosing Select. If you select the OtherLanguages menu operation from the menu line, the pop-up frame displays a list of all callable non-embedded languages supported by your site, from which you can select.
4. The Create a Proceduretype Procedure pop-up appears for the type of procedure you selected. The Create a 4GL Procedure frame is shown in the Create a 4GL Procedure pop-up figure.
5. In the Name field, enter the name of this procedure. The other fields are display only.
6. Choose OK. ABF creates the procedure and displays the Edit a Procedure Definition frame for this procedure type.
IMPORTANT! Avoid giving a procedure the same name as a system function or built-in frame or procedure, as this overrides the system component. A pop-up message warns you if you use a system name.
Edit a Procedure Definition Frame
After you create a procedure using the Create a Proceduretype Procedure frame, you see the Edit a Proceduretype Procedure Definition frame for the type of procedure you have chosen. The following figure shows the Edit a Procedure frame for the type 4GL:
The Edit a Proceduretype Procedure frames have similar fields. The following list shows the fields as they appear on the frame (some fields do not appear for all procedure types, as indicated in the list).
Procedure Name
Specifies the name of procedure you entered in the Create a Procedure frame
Short Remark
(Optional) Specifies a brief description
Source Language
Specifies either 4GL, SQL (for database procedures), or the name of a 3GL supported in your installation
Symbol field
(For 3GL procedures only) Specifies the link symbol ABF uses to link to the procedure. The default is the procedure name. The name is case sensitive on systems whose linkers are case sensitive.
UNIX: On some UNIX systems, you must add an underscore (_) after the symbol name. Check your operating system documentation for more information on specifying symbol names.
Library field
(For 3GL procedures only) Indicates whether this is a library procedure. A library procedure is not compiled by ABF, but must be defined to ABF. If you enter yes, the Edit and Compile menu operations are not active.
Source File field
(For 3GL and 4GL procedures only) Specifies the file name with the extension of the selected language, as shown in the table "File Extensions". This field is case sensitive and can contain up to 48 characters. Do not enter a value in this field for library procedures, including database procedures.
Return Type
Specifies the default value is integer. You can enter none, integer, float or any Ingres string type. The decimal data type is supported for 4GL procedures only.
Nullable
Determines whether the field can hold a null value. The Nullable field is display only with a value of "No" for all 3GL procedures, because these do not support nullable return values.
Pass Decimal Values As field
(For COBOL procedures only) Specifies whether the procedure passes return values with decimal data types as float data type or decimal data type.
All procedure types have the Created and Last Modified fields. The Last Modified field indicates when the procedure's definition frame was last modified.
The Edit a Proceduretype Procedure frames have the following menu operations:
NewEdit
Edits or creates the definition of a different component. Prompts for the name and type of component to define.
Go
Runs the procedure. For 3GL procedures, you cannot use Go if the procedure receives parameters from the calling frame. ABF warns you that attempting to run a procedure that expects a parameter can have unpredictable results. To test a 3GL procedure that requires parameters, run the procedure from the calling frame.
Edit
Uses the system editor to create or edit the file containing the source code for the current procedure. (Does not appear for database procedures.)
Compile
Checks the source code syntax for the current procedure, displays errors (if any), and adds the object code for the procedure to the database if free of errors. (Does not appear for database procedures.)
LongRemark
Displays or enters more information about the current procedure on the LongRemark pop-up frame
Print
Prints the definition and source code file for the procedure
ListChoices, Cancel, Help, End
Perform standard operations
Define a 4GL Procedure
To use the Edit a 4GL Procedure Definition frame to define a procedure
1. The Procedure Name field contains the procedure name you entered in the Create Frame.
2. (Optional) Enter a Short Remark.
3. In the Source File field, either leave the default file name, made up of the procedure name and the extension .osq, or enter another file name.
4. The Return Type field contains the default value integer. Enter the data type of data you intend to return from this procedure to the calling frame or procedure, or none if no data is to be returned.
To select the return type from a list, choose ListChoices.
5. Enter Yes or No in the Nullable field to indicate whether or not NULL can be returned. The default value is "Yes."
6. Optionally choose LongRemark to enter more detailed information about the procedure. Select Save and End to return to the Edit a 4GL Procedure Definition frame.
Enter Source Code
To enter the source code for a 4GL procedure
1. Choose Edit from the Edit a 4GL Procedure Definition frame menu to call up the system editor's opening display.
2. Enter the source code for the procedure.
3. When you finish, save your file as you exit the editor.
4. You return to the Edit a 4GL Procedure Definition frame. Choose Compile to compile the code and check for syntax errors.
If the file contains compilation errors, ABF displays a frame that lists the errors and prompts you to correct them. It is the same frame that you see if errors occur during creation of a user frame. Enter y (yes) to see the 4GL Error Listing frame.
5. Test the procedure by running the frame that calls it.