RPG, RPGLE, RPG 400

AWS Blu Insights supports RPG (Report Programming Generator) dependencies analysis in the mainframe group. It detects dependencies among programs (e.g. RPG, RPGLE) as well as other file types (e.g. CL, PF, LF…).

Traditional Statements

Direct dependency

Logical dependencies

CALL

The CALL statement implies a dependency on a CL or an RPG file.

  • CALL PROGRAM in .RPG and .RPGLE files
  • CALL(EXTENDERS) PROGRAM in .RPG and .RPGLE files. There can be one or several extenders among A, H, N, P, D, T, Z, M, R, E.

Where PROGRAM can be a raw string or a variable declared in the same file with EXTPGM or EXTPROC.

CALLB

The CALLB statement implies a dependency on a CL or an RPG file.

  • CALLB PROGRAM in .RPG and .RPGLE files
  • CALLB(EXTENDERS) PROGRAM in .RPG and .RPGLE files. There can be one or several extenders among A, H, N, P, D, T, Z, M, R, E.

Where PROGRAM can be a raw string or a variable declared in the same file with EXTPGM or EXTPROC.

CALLP

The CALLP statement implies a dependency on a CL or an RPG file.

  • CALLP PROCEDURE in ‘.RPG’ and ‘.RPGLE’ files
  • CALLP(EXTENDERS) PROCEDURE in ‘.RPG’ and ‘.RPGLE’ files. There can be one or several extenders among A, H, N, P, D, T, Z, M, R, E.

Where PROCEDURE can be a raw string or a variable declared in the same file with EXTPGM or EXTPROC.

Procedures can be declared in RPG files :

  • Global : P PROCEDURE B EXPORT
  • Local : P PROCEDURE B
  • An implicit procedure is declared for each ‘.RPG’ or ‘.RPGLE’ files
EXTPGM

The EXTPGM statement defines a variable but also implies a dependency on the EXTPGM part

  • D myVar PR EXTPGM(PROGRAM)

Where myVar is the name of the declared variable and PROGRAM is the name of a file in the project

Inclusion dependencies

COPY
  • COPY FILE
  • COPY LIBRARY,FILE

Where LIBRARY is the name of a library and FILE is the name of a file in the project.

INCLUDE
  • INCLUDE FILE
  • INCLUDE LIBRARY,FILE

Where LIBRARY is the name of a library and FILE is the name of a file in the project.

Resource dependencies

DTAARA

The call on DTAARA implies a dependency on a file that is not an RPG (PF, LF, RPGLE, PRTF…) nor a Mainframe file.

  • DTAARA DEFINE DATAOBJECT
  • DTAARA DEFN DATAOBJECT

Where DATAOBJECT is the name of a file in the project.

EXTNAME

The call on EXTNAME implies a dependency on any other file.

  • EXTNAME(filename)

Where filename is the name of a file in the project.

FLINE
  • Ffilename (C|I|O|U)

Where filename is the name of a file in the project.

The call on FLINE can implied a dependency on a PRTF, PRT, LF or PF file if the file definitions are not included in the RPG program by I/O lines

  • Ifilename are for input files defined with a C, I and U flag
  • Ofilename are for output files defined with a C and O flag
FORMAT

The call on FORMAT implies a dependency on a PRTF, PRT, LF or PF file.

  • FORMAT(ddsFile)

Where ddsFile is the name of a file in the project.

JFILE / PFILE

The call on JFILE or PFILE implies a dependency on a PRTF, PRT, LF, PF or DDS file.

  • JFILE(ddsFile)
  • JFILE(*LIBL/ddsFile)
  • JFILE(*CURLIB/ddsFile)
  • JFILE(LIBNAME/ddsFile)
  • PFILE(ddsFile)
  • PFILE(*LIBL/ddsFile)
  • PFILE(*CURLIB/ddsFile)
  • PFILE(LIBNAME/ddsFile)
  • JFILE(ddsFile1 ddsFile2 ...)
  • JFILE(path1 path2 ...)
  • PFILE(ddsFile1 ddsFile2 ...)
  • PFILE(path1 path2 ...)

Where ddsFile is the name of a file in the project. 
*LIBL – Search for the target file name in all libraries and establish the dependency with all matches 
*CURLIB – Search for the target file name from the root of the source file path and dependency link will be formed for the matched target 
LIBNAME – Search for the folder named LIBNAME from the root of the source file path and get the list of matched target files 
In case, LIBNAME is not found during the analysis, then Missing library node is create with library name

It’s possible to have several arguments in the JFILE or PFILE statement separated by space. 
path1 and path2 refers to any combination of the library path. 
Example: 
PFILE(*CURLIB/ddsFile1 LIBNAME/ddsFile2) 
PFILE(LIBNAME1/ddsFile1 LIBNAME2/ddsFile2 LIBNAME3/ddsFile3)

REF

The call on REF implies a dependency on a PRTF, PRT, LF or PF file.

  • REF(ddsFile)

Where ddsFile is the name of a file in the project.

REFFLD

The call on REFFLD implies a dependency on a PRTF, LF, PF or DDS file.

  • REFFLD([recName/]refName [libName/]ddsFile)

Where ddsFile is the name of a file in the project, refName is mandatory and doesn’t apply any dependency, recNameand libName are optional and doesn’t apply any dependency.

External DataStruture

The call on E DS implies a dependency on a PRTF, LF, PF or DDS file.

  • Ifilename  E DSddsFile

Where ddsFile is the name of a file in the project and filename doesn’t apply any dependency.

QDDS and QDDSI files

A physical file named filename.pf will be linked to a file named prefix.filename.qdds if it exists

A logical file named filename.lf will be linked to a file named prefix.filename.qddsi if it exists

Dynamic dependencies

In RPG, it is possible to store entities name in constant and use it in any type of dependency

Constant definition

D CONST_NAME C CONST('PROG_TO_CALL')

This constant named CONST_NAME can be used to call PROG_TO_CALL

Transparent constant

I 'PROG_TO_CALL' C CONST_NAME

This constant named CONST_NAME can be used to call PROG_TO_CALL

SQL statement

Computation line

In RPG computation lines (C) a SQL query starts with Exec SQL and ends with End-Exec. All lines starting with + is a continuation. 
00000C/Exec SQL Update USER 
00000C+ Set LAST-NAME = "DOE" 
00000C+ Where NAME = "JANE" 
00000C/End-Exec

Refer to dependencies in SQL file documentation for further information

RPG Free form

There are three ways to write Freeform statements in RPG

  • Put a space in columns 6 and 7 for a one line Freeform statement
  • Use /free and /end-free markers to surround several Freeform statements
  • Start the source file with **free to have a full Freeform source file

COPY/INCLUDE

COPY and INCLUDE statements have the same behavior as in traditional RPG

Prototype declaration statement

Usage of dcl-pr implies a dependency on any other file.

  • dcl-pr external-program
  • dcl-pr prototype-name EXTNAME('external-program')

Where external-program is the name of a file in the project.

File declaration statement

Usage of dcl-f implies a dependency on a PRTF, LF, PF or DDS file.

  • dcl-f dds-file
  • dcl-f printer-file printer

Where dds-file is the name of a LF, PF or DDS file in the project, and printer-file is the name of a PRTF file in the project.

Data structure declaration statement

Usage of dcl-ds statement implies a dependency on a LF, PF or DDS file.

  • dcl-ds dds-file EXT
  • dcl-ds local-alias extname('dds-file')

Where dds-file is the name of a LF, PF or DDS file in the project.

SQL statement

In a Free Form section, a SQL query starts with Exec SQL and ends with ;
/Free 
Exec SQL Update USER 
Set LAST-NAME = "DOE" 
Where NAME = "JANE"; 
/End-Free

Refer to dependencies in SQL file documentation for further information