32 Understand Directives

This chapter contains these topics:

Directives are in the logic modules and instruct the program generator what type of action to take when constructing source code. They use the first five columns of the RPG statement.

There are several types of directives, including:

JD Edwards World supplies all directives and you cannot create your own directives.

32.1 Functional Directives

Functional directives:

  • Control major functions within a program.

  • Provide the initiation point for creating database specific logic and screen or report file control logic.

  • Initiate the inclusion of copy modules into the source code.

  • Seize detail logic modules for inclusion.

Functional directives are only found within primary logic modules and cannot reside in a detail logic module.

Following are the functional directives JD Edwards World includes with the software:

Directive Code Detail Logic Module Source Created Functional Directive
*ACTN None S999 Load action code lock out array
*ATOT XADDTOT1 S010 Accumulate report total logic
AUTHR None F spec Program author
*AUTOI X*ENTRYI S999 Automatic inquiry at execution test logic
*CLRN None S001 Clear user requested fields
CLRY None S001 Clear all data fields for next transaction
CLSFL None S003 Clear all subfile fields
COPY XCOPY-SUB Various RPGIII copy function for common subroutines
CTOT XCLRTOT1 S010 Clear report totals
*DATES XDSDATE I Spec Data structures for Gregorian dates (not using record buffer)
*DATER None I Spec Data structures for Gregorian dates in the record buffer #BUFIN
DESC None F Spec File or program description
*DPARM XFIELDVAL S998 Retrieve all Data Dictionary values for videos
*DPRMS XFIELDVL2 S998 Retrieve Data Dictionary values for detail subheading reports
*DPRMR XFIELDVAL S998 Retrieve Data Dictionary values for total subheading reports
DSPF None Various Variable name substitution for display file(s) fields
DSP1

XDSPFLD1

XDSPFLD2

XDSPFLD3

XDSPFLD4

XDSPFLD5

XDSPFLD6

XDSPFLD7

XDSPFLD8

S

004

S004

S004

S004

S004

S004

S004

S004

Display logic for primary video fields

Format Alpha field for output

Format Gregorian Date for output

Format Julian Date for output

Format VC0 field from VTX

Format VC0 field from designated description

file (field details)

Format VC0 field from F0005

Format Alpha 3 or 28

Repeat of XDSPFLD1

DSP2

XDSPFLD1

XDSPFLD2

XDSPFLD3

XDSPFLD4

XDSPFLD5

XDSPFLD6

XDSPFLD7

XDSPFLD8

S004

S004

S004

S004

S004

S004

S004

S004

Display logic for primary video fields

Format Alpha field for output

Format Gregorian Date for output

Format Julian Date for output

Format VC0 field from VTX

Format VC0 field from designated description

file (field details)

Format VC0 field from F0005

Format Alpha 3 or 28

Repeat of XDSPFLD1

*EMK XLOADEMK S999 Load user defined error messages
ENTRY X*ENTRYP

X*ENTRYM

Various Load program execution passed parameters
*EXITC XEXIT-CMD0

XEXIT-CMD1

S00EX Function key exit execution logic
*EXITS XEXIT-SEL0 S00OP Selection exit execution logic
*EXITW XEXIT-SEL0 S000P Selection exit execution logic
*FIELD

XFIELDEDT1

XFIELDEDT2

XFIELDEDT3

XFIELDEDT4

XFIELDEDT5

XFIELDEDT6

XFIELDEDT7

XFIELDEDT8

XFIELDEDT9

XFIELDEDTA

XFIELDEDTC

XFIELDEDTE

XFIELDEDTR

XFIELDEDTS

XFIELDEDTT

XFIELDEDTU

S005

S005

S005

S005

S005

S005

S005

S005

S005

S005

S005

S005

S005

S005

S005

S005

Active Data Dictionary field validation logic

Data Dictionary alpha edit

Validation n=Master - Alpha

Gregorian edit

Julian edit

Data Dictionary numeric edit

Alpha field size 10

User defined code edit

No dictionary

Validation n = Master - Numeric

Account ID

Cost center edit

Numeric field size 7

Right adjust

Validation = Master - Alpha

Validation = Master - Alpha Rt Adj

Validation = Master - Numeric

FILES None F spec Program file descriptions
*FLDxx

XFIELDEDT1

XFIELDEDT2

XFIELDEDT3

XFIELDEDT4

XFIELDEDT5

XFIELDEDT6

XFIELDEDT7

XFIELDEDT8

XFIELDEDT9

XFIELDEDTA

XFIELDEDTC

XFIELDEDTE

XFIELDEDTR

XFIELDEDTS

XFIELDEDTT

XFIELDEDTU

S005

S005

S005

S005

S005

S005

S005

S005

S005

S005

S005

S005

S005

S005

S005

S005

Active Data Dictionary field validation for primary data

Data Dictionary alpha edit

Validation n=Master - Alpha

Gregorian edit

Julian edit

Data Dictionary numeric edit

Alpha field size 10

User defined code edit

No dictionary

Validation n = Master - Numeric

Account ID

Cost center edit

Numeric field size 7

Right adjust

Validation = Master - Alpha

Validation = Master - Alpha Rt Adj

Validation = Master - Numeric

INFDS

XINFDS1

XINFDS2

Ispec

I spec

File information data structures, if specified

Standard database file information data structure. The field prefix is incremented from $1 to $x where x = number of files

OBSOLETE. Use SRVFDS.

KEYI

XFIELDLD1

XFIELDLD2

XFIELDLD3

XFIELDLD4

XFIELDLD5

S003

S003

S003

S003

S003

Load master file key fields for inquiry programs.

Load video input - Alpha

Load video input - Numeric

Load video input - Cost Center

Load video input - Julian Date

Load video input - Gregorian Date

KEYS

XFIELDLD1

XFIELDLD2

XFIELDLD3

XFIELDLD4

XFIELDLD5

XNEXT-NBR

S003

S003

S003

S003

S003

S003

Load master file key fields in subfile format.

Load video input - Alpha

Load video input - Numeric

Load video input - Cost Center

Load video input - Julian Date

Load video input - Gregorian Date

Load video input - Next Numbering

KEYS2

XFIELDLD1

XFIELDLD2

XFIELDLD3

XFIELDLD4

XFIELDLD5

XNEXT-NBR

S005

S005

S005

S005

S005

S005

Load master file key fields in primary video format

Load video input - Alpha

Load video input - Numeric

Load video input - Cost Center

Load video input - Julian Date

Load video input - Gregorian Date

Load video input - Next Numbering

KLIST XKEYLIST S999 Create data file key list
*LVLS XSAVVAL1 Save report level break data  
MF None Various Variable name substitution for master database files
*MCUxx None S003

S004

S00EX

Business Unit security logic where xx = master field designation 1 thru 9
*OPEN XFILEOPN1 S999 Open report program data files
OPTE None S005 Subfile processing condition test based on mandatory entry fields in subfile format
*OTOT XPRTTOT1 S010 Print all report level totals
PDL None Various User defined entry point
*RKYxx None S999 Load softcoding record key for reports where xx = master file designation 1 thru 9
RPTD

XDSPFLD1

XDSPFLD2

XDSPFLD3

XDSPFLD4

XDSPFLD5

XDSPFLD6

XDSPFLD7

XDSPFLD8

S004

S004

S004

S004

S004

S004

S004

S004

Format data for report detail format

Format Alpha field for output

Format Gregorian Date for output

Format Julian Date for output

Format VC0 field from VTX

Format VC0 field from description file (field details)

Format VC0 field from F0005

Format Alpha 3 or 28

Repeat of XDSPFLD1

RPTH

XDSPFLD1

XDSPFLD2

XDSPFLD3

XDSPFLD4

XDSPFLD5

XDSPFLD6

XDSPFLD7

XDSPFLD8

S004

S004

S004

S004

S004

S004

S004

S004

Format data for report heading format

Format Alpha field for output

Format Gregorian Date for output

Format Julian Date for output

Format VC0 field from VTX

Format VC0 field from description file (field details)

Format VC0 field from F0005

Format Alpha 3 or 28

Repeat of XDSPFLD1

*RPTT

XDSPFLD1

XDSPFLD2

XDSPFLD3

XDSPFLD4

XDSPFLD5

XDSPFLD6

XDSPFLD7

XDSPFLD8

S004

S004

S004

S004

S004

S004

S004

S004

Format data for report total format

Format Alpha field for output

Format Gregorian Date for output

Format Julian Date for output

Format VC0 field from VTX

Format VC0 field from description file (field details)

Format VC0 field from F0005

Format Alpha 3 or 28

Repeat of XDSPFLD1

*RTA XTOTARRY E spec Load totaling arrays
*RTS None I spec Report softcoding array
*RTX None I spec Report softcoding text fields
*RTXI XVTIDX S999 Set maximum VTX index to use
*SFFLD

XFIELDEDT1

XFIELDEDT2

XFIELDEDT3

XFIELDEDT4

XFIELDEDT5

XFIELDEDT6

XFIELDEDT7

XFIELDEDT8

XFIELDEDT9

XFIELDEDTA

XFIELDEDTC

XFIELDEDTE

XFIELDEDTR

XFIELDEDTS

XFIELDEDTT

XFIELDEDTU

S005

S005

S005

S005

S005

S005

S005

S005

S005

S005

S005

S005

S005

S005

S005

S005

Active Data Dictionary data field validation

for subfile fields.

Data Dictionary alpha edit

Validation n = Master - Alpha

Gregorian edit

Julian edit

Data Dictionary numeric edit

Alpha field size 10

User defined code edit

No dictionary

Validation n = Master - Numeric

Account ID

Cost center edit

Numeric field size 7

Right adjust

Validation = Master - Alpha

Validation = Master - Alpha Rt Adj

Validation = Master- Numeric

SLDxx

XFIELDEDT1

XFIELDEDT2

XFIELDEDT3

XFIELDEDT4

XFIELDEDT5

XFIELDEDT6

XFIELDEDT7

XFIELDEDT8

XFIELDEDT9

XFIELDEDTA

XFIELDEDTC

XFIELDEDTC

XFIELDEDTR

XFIELDEDTS

XFIELDEDTT

XFIELDEDTU

S005

S005

S005

S005

S005

S005

S005

S005

S005

S005

S005

S005

S005

S005

S005

S005

Active Data Dictionary data field validation

for subfile data fields. Where xx = specified

master file 1 thru 9.

Data Dictionary alpha edit

Validation n = Master - Alpha

Gregorian edit

Julian edit

Data Dictionary numeric edit

Alpha field size 10

User defined code edit

No dictionary

Validation n = Master - Numeric

Account ID

Cost center edit

Numeric field size 7

Right adjust

Validation = Master - Alpha

Validation = Master - Alpha Rt Adj

Validation = Master- Numeric

*S00VL None I spec Cursor Control, F1
TITLE None H spec Program title
*VKYxx None S999 Load softcoding record key for display files where xx=display file designation 1 - 9.
*VTS None I spec Display file softcoding array
*VTX None I spec Update softcoding text field ending positions based upon size definition in display file
*VTXI XVTXIDX S999 Set maximum VTX index used

* Automatically include JD Edwards World standards, which are beyond normal requirements.

32.2 Substitution Directives

Substitution directives:

  • Control the translation of symbolic names to the actual data field names the system requires for an individual line of source code.

  • Substitute information within a line of code.

    • If the system replaces a field, the field it replaces begins with an & (ampersand).

    • If the substitution is positional, this directive informs the program generator where to position the substitution on a line of code.

Figure 32-1 Substitution Directives, Columns 1 to 5

Description of Figure 32-1 follows
Description of "Figure 32-1 Substitution Directives, Columns 1 to 5"

Following are the substitution directives JD Edwards World includes with the software:

Directive Column Allowed Column Allowed Column Allowed Column Allowed Function
  1 2 3 45  
@ x x x x Four character Data Dictionary name
# x       Primary parameter that passes for *ENTRY
A x x x   Highest VTX field.
B         Unused at this time.
C x       Function key exit indicator test
D x     x Descriptions for fields, files, and copy modules
E   x     Error message key
F   x     Validation file name
G   x     User defined calculation logic result field name
H   x     Descriptive display file name
I x x x   Display field error condition attribute indicator
J x x x x Data file names
K x x x   Descriptive display file key field name
L x       Data file key list name and optional file/format name
M x       File information data structure name
N x x x   Full data field name (write to)
O x     x Common subroutine name
P   x     Function key/selection exit program to execute
Q       x Field name to receive description value
R       x Field name to receive key value
S     x   Selection exit value test
T   x     Function key/selection exit
U x       File information data structure subfield prefix
V x x x   Source of data (Read From) field name
W     x   Data file key list key field name
X     x x Error message array index
Y     x   Function key/selection exit parameter field name
Z     x   Numeric field size definition (right adj alpha)
0   x     Gregorian date Data Structure numeric 6 byte date
1 x       Gregorian date Data Structure numeric 2 byte month
2 x       Gregorian date Data Structure numeric 2 byte day
3 x       Gregorian date Data Structure numeric 2 byte year
4 x x x   Parameter 1 from *PROC calculations
5 x x x   Parameter 2 from *PROC calculations
6 x x x   Parameter 3 from *PROC calculations
7 x x x   Parameter 4 from *PROC calculations
8 x x x   Parameter 5 from *PROC calculations

32.3 Exception Directives

Exception directives:

  • Provide unusual option definition to the program generation process.

  • Combine two other types of directives. For example:

    DSPF &01FILE

    Combines a functional directive (DSPF) with a substitution directive (&01FILE), so it is an exception directive.

    Example:

    You create a line of code for the READ Master file and then substitute the Master file name.

Most exception directives are substitution directives but are out of the normal syntax substitution directives use.

Following are the exception directives JD Edwards World includes with the software:

Factor 1 Factor 2 Result Keyword Function
  x   &xxFILE Master/video/report file name
  x   &xx(FILE) File name in single quote marks
  x   &xxFORMAT Master/video format name
  x   &xxFORMAT1 Subfile line 24 format name
  x   &xxFORMATC Subfile control record format name
  x   &xxFORMATS Subfile record format name
x x   &xxKEYFLD Master file primary key field name
x x   &xxPGCTL Number of subfile records in 1 page
x     % Factor 1 intentionally left blank
x x x = User defined calculation logic result

32.4 Conditional Directives

Conditional directives:

  • Are the most flexible and most powerful directives.

  • Verify specific conditions exist before determining if the system must perform any action.

  • Use positions 1 to 5 to provide directive initiation and use Factor 1, Factor 2, and the Result field to complete the directive definition.

Subroutine S010-11 includes examples of conditional directives. For example:

If SFSELC exists, include code for selection exits.

You can combine conditional directives.

Following are the conditional directives JD Edwards World includes with the software:

Position/Factor/Result Description
Pos 1 + Include detail logic module if true
  - Include detail logic module if false
Pos 2-5 FLDN Test existence of data field
  DTAI Test existence of data item
  FILE Test existence of file
  FMT Test existence of file
Factor 1 Name of field, item, file or format to test. Can also contain *ANYx for file test which you can use to test for types of files in a program where x might optionally designate number of files.
Oper (file test only) DSPF Display file
  PF Physical file only
  LF Logical file only
  PRTF Printer file only
  DB Database file
Factor 2 Name of detail logic module to include into source code. Might also use *AND to produce compound conditions
Result Field Pos 1 @ Any input file
  M Master input file with M in file specifications
  1-9 Master input file with 1 - 9 in field specifications
Result Field Pos 2 @ Any output file
Result Field Pos 3 @ Any update file
  M Master update file with M in file specifications
  1-9 Master update file with 1 - 9 in field specifications
Result Field Pos 4 @ Any add file