15 Understand Additional PDL Operations

This chapter contains these topics:

15.1 Editing

The Data Item Formula is one long continuous field. If there is an error, the entire field displays in reverse image, and the system places the cursor in the field following the error. You can display the error messages by choosing Display Error Message (F7).

15.2 Parsing

The system stores the Data Item Formula in the File Specifications database in two forms:

  • The generator stores the unparsed form in the User Defined Procedures file (F93109), with one record for one formula.

  • The generator stores the parsed form in the User Defined Procedures Detail file (F93110), with multiple records for each formula. Each record corresponds to an RPG operation code.

15.3 Source Code Generation

The generator merges the PDL code into the program based on the field you enter in the Detailed Programming Facility.

Read From Write To Affected
1) QXXIT VDXIT S004 (moves database fields to video fields)
2) VDXIT QXXIT S005 (moves video fields to data base fields

The generator places the PDL code before the standard code Program Generator code for the field in the Write To field. If you want the code the PDL generates to replace the standard code, then enter *PROC in the Read From field.

Note:

Use caution when performing this as the system performs no editing or formatting of the field, except what you enter in the Data Item Formula.

If you want the code the PDL generates to come after the standard code the Program Generator generates for the field in the Write To field, then you must place the Data Item Formula on the field immediately following the Write To field in the Detailed Programming Facility.

The generator lists the fields in the Detailed Programming Facility in alphabetical order, and you cannot change the order.

15.3.1 Data Item Formula Examples

Two examples illustrate the PDL statements and syntax. Both are from an inquiry program with a subfile.

15.3.1.1 Example User Defined PDL

The example illustrates a data item formula for a user defined PDL entry point in subroutine S004. The purpose of the formula is to determine if the database record meets the search criteria for order number ($SEL = 0 to omit). The program work fields $doco1 and $doco2 contain the lower and upper values for the inquiry search fields with a subfile.

Figure 15-1 Data Item Formula Revisions (User Defined PDL) screen

Description of Figure 15-1 follows
Description of "Figure 15-1 Data Item Formula Revisions (User Defined PDL) screen"

This example also illustrates the following types of PDL statements:

Type of PDL Statement Description
Assignment $sel := '0'
Blocks begin...end
Comment \ Test order number for inclusion. \
Condition If q1doco < $doco1 Then $sel := '0';

Additionally, this example illustrates the nesting of conditions:

If vddoco = ' ' Then

If q1doco < $doco1 Then

??$sel := '0';

The statement separator, the semicolon, is not necessary until the outermost If...Then statement is complete.

15.3.1.2 Example Subfile Field

This example illustrates a data item formula for a subfile field that is a computed field. The program is locating sales order header records. The computed field is the order total and is based on the sales order detail records in F59422.

Figure 15-2 Data Item Formula Revisions (Subfile Field) screen

Description of Figure 15-2 follows
Description of "Figure 15-2 Data Item Formula Revisions (Subfile Field) screen"

This example illustrates the following types of PDL statements:

Type of PDL Statement Description
Assignment $#ami := 0; $#xtp := 0;

q2doco := gldoco;

Blocks Notice the begin...end nested within the while...do
Comment Notice the embedded comments as well as the heading comment
Database poseq f59422;

reade f59422;

Loops while in98 = '0' do

begin...end


You can separate statement separators in the loop statements within the Begin...End block, and then follow the end statement with a separator.

15.4 Add PDL to a Field

To work with Data Item Formula Revisions

  1. On Software Versions Repository, locate a program and then access Define General Specifications.

  2. On Define General Specifications, enter 1 the Option field to access Detailed Programming Facility.

  3. On Detailed Programming Facility, enter 6 in the Option field next to the field for which you want to add PDL.

    Figure 15-3 Detailed Programming Facility (Revisions) screen

    Description of Figure 15-3 follows
    Description of "Figure 15-3 Detailed Programming Facility (Revisions) screen"

    The Data Item Formula Revisions screen displays.

    Figure 15-4 Data Item Formula Revisions (Add PDL) screen

    Description of Figure 15-4 follows
    Description of "Figure 15-4 Data Item Formula Revisions (Add PDL) screen"

  4. Enter the PDL statements for the field in the Data Item Formula area.

Field Descriptions
Program ID The RPG program name defined in the Software Versions Repository Master table.
File ID The member ID of the file used by the program.
Field Name This specifies the field name as it is identified in the file.
Data Item Formula A set of Program Design Language (PDL) statements, which are then translated into RPG code.

15.5 Function Exits

Display Variable Definitions (F5)

Choose Display Variable Definitions (F5) to access a screen with a list of variable definitions.

Repository Services (F6)

Choose Repository Services (F6) to access a screen with a list of JD Edwards World technical functions or repositories.