Page tree
Skip to end of metadata
Go to start of metadata

Summary: This page explains how to prepare and configure the analysis of your RPG source code.

Source code organization

Before the RPG source code can be delivered to CAST and then analyzed, it needs to be collected from the proper iSeries libraries and transferred to the designated location. During this operation, each artifact (program, CL, DSPF) must be put into a single file only. This will result in a single artifact per file. Furthermore, the type of source code must be expressed using the extension to the file. The appropriate files extensions are listed in the following table. 

Source code is kept in a member of a file. The file is kept in a library. Each file can have many members. Each member is the source code for a program.

The source code files can have any name but conventionally the names start with Q and end with SRC, for source.

Source code type

iSeries library

Required extension

Used in MetaModel

RPG-III programs

QRPGSRC

*.rpg, *.rpg38

RPG300

ILE RPG Programs

QRPGLESRC

*.rpgle

RPG400

ILE RPG Programs with SQL

QSQLRPGLESRC

*.sqlrpgle

RPG400

Copy source members

QCPYLESRC

*.cpyle

RPG400

CL programs

QCLSRC

*.cl, *.clp, *.cl38, *.clp38

CL400

ILE CL Programs

QCLLESRC

*.clle

CL400

Display Files

QDDSSRC

*.dspf, *.dspf38

DDS400

Printer Files

QDDSSRC

*.prtf, *.prtf38

DDS400

Logical Files

QDBSRC

*.lf, *.lf38

DB400/DDS400

Physical Files

QDBSRC

*.pf, *.pf38

DB400/DDS400

Bound service programs

QBNDPGM

*.bnd

RPG400

Menu

QMNUSRC orQMENUSRC

*.menu

MENU

SQL Files *.SQLDB400

Source code preprocessing

RPG source code needs to be preprocessed so that CAST can understand it and analyze it correctly. In previous releases of the extension, this preprocessing was a manual action that needed to be completed before the code was analyzed. However, in this release and all future releases, the code preprocessing is actioned automatically when an analysis is launched or a snapshot is generated (the code is preprocessed before the analysis starts). In other words you only need to package, deliver and launch an analysis/generate a snapshot for the preprocessing to be completed.

RPG 2.0 has specific pre-processors for each language: the preprocessor per language only considers the files with the expected extensions. 

Note that the CAST Management Studio will use the LISA folder (see CAST Management Studio help for more information about this folder).

Application Source code delivery and Snapshot generation

When delivering your source code for analysis with CAST, you need to follow the same process as for technologies that are supported by CAST "out of the box". In other words:

CAST AIC Portal/CAST Delivery Manager Tool

Two packages then need to be created in the CAST Delivery Manager Tool > Add package wizard 

  • For the RPG code, choose the option Files on your file system as the source location:

  • For Tables and Views, choose the DB400 extraction option:

  • Return to the CAST Management Studio, then Validate and Accept the Delivery and Confirm the analysis configuration - as part of this process, please follow the specific instructions below:
  • In the Application editor > Dependencies tab, add the dependency between the Universal Analysis Unit as Source and LIB (UDB DB2 schema) as the target

Logging mechanism

Analysis log files

Analysis logs are stored in the default locations used by the CAST Management Studio.

RPG Preprocessor

RPG Preprocessor log files (the preprocessor is launched automatically during an analysis) are stored in the following locations:

CAST AIP releaseLocationLog file name
8.2.x

%PROGRAMDATA%\CAST\CAST\Extensions\<extension_name>\Configuration\Languages\RPG\prepro

Note that the above location is the default, however, if you have modified the CAST_PLUGINS_ROOT_PATH variable in the CastGlobalSettings.ini file, this location may be different.
com.castsoftware.rpg.<language name>.<extension_major_version.extension_minor_version.extension_maintainance_version>.prepro_<YYYYMMDDHHMMSS>.log
8.3.xDefault location is set to C:\castms\log\<unique_application_id>\, but this location can be configured at will in the CAST Management Studio "Preferences".

Errors and Warnings

During the analysis, the Universal Analyzer may throw errors or warnings. The table below lists the most significant errors/warnings and lists a suggested remediation action:

ToolsError/Warning MessageAction
PreprocessorFile 'FileName' is emptyThis is caused by source code that is referring file is empty. You can safely ignore this warning.
PreprocessorUnable to open file 'FullFileName'This is caused by source code that is referring file that cannot be found in the preprocessed code. You can safely ignore this warning.
Preprocessor

PF corresponding to the table 'tableName' was not found

This is caused by source code that is referring the Table that cannot be found in the preprocessed code. You can safely ignore this warning.
PreprocessorFile Disk 'FDescName' not found : missing recordThe record will not be created. This is caused by source code that is referring the FDescName that cannot be found in the preprocessed code. You can safely ignore this warning.
PreprocessorFile Disk 'FDescName' not found : renamed record 'RecordName'The record will not be created. This is caused by source code that is referring the FDescName that cannot be found in the preprocessed code. You can safely ignore this warning.
PreprocessorFile Disk 'FDescName: renamed record 'RecordName' doesn't match the DDS record 'RecordName'This is caused by source code that is referring the FDescName that cannot be found in the preprocessed code
PreprocessorError NOMAIN in a PROGRAMThe program will not be preprocessed. Program will not be created
PreprocessorCopy not found 'CopyName'This is caused by source code that is referring the called Copy that cannot be found in the preprocessed code. You can safely ignore this warning.
PreprocessorMissing called program='PgmName'This is caused by source code that is referring the called program that cannot be found in the preprocessed code. You can safely ignore this warning.
PreprocessorError on match if/endif at line 'LineNumber'Object will not be created.
AnalyzerUnable to find the object end for type 'RPG400Subroutine' This is caused by source code that is referring to a SubRoutine that cannot be found. You can safely ignore this warning.
AnalyzerUnable to find the regexp for the link 'accessLink'   The link will not be created -
AnalyzerAn unnamed object of type 'RPG400SQLStructure' has been detectedThis is because RPG400SQLStructures have no specific name, as such, the CAST framework will give them the name "unnamed". You can safely ignore this warning.
 AnalyzerDuplicate object of type 'RPG400SQLStructure' has been detected: '<unnamed>'As mentioned above, structures have no specific name and are automatically given the name "unnamed" by CAST - as such multiple objects with the name "unnamed" will exist and will cause this error. You can safely ignore this warning.
 AnalyzerUnable to find the object end for type 'RPG400Rule'This is caused by source code that is referring to a Rule cannot be found. You can safely ignore this warning.
 AnalyzerDuplicate object of type 'MENUItem' has been detected: 'XXXXXX'This is due to a duplicate Menu name in the original Menu file. You can safely ignore this warning.
 AnalyzerWarning after preprocessing the source code- Unknown format for ' A XA3439 R REFFLD(DATM FRFGFDI4)'

Follow Sample Reference Function Specifications

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A                                      REF(FILE1)    (1)
00020A          R RECORD1
00030A            FIELD1    R                             (1)
00040A            FIELD2    R                             (1)
00050A            FIELD3    R               REFFLD(FLD3)  (2)
00060A            FIELD4    R               REFFLD(FLD4 FILE2)  (3)
00070A            FIELD5    R               REFFLD(FLD5 LIB1/FILE3)  (4)
00080A            FIELD6    R               REFFLD(RECORDB/FLD6 LIB1/FILE4)  (5)
00090A            FIELD7    R               REFFLD(FIELD6 *SRC)  (6)
00100A            FIELD8    R               REFFLD(FLD6)  (7)
00110A          R RECORD2
00120A            FIELD1        20  (8)
00130A
00140A          R RECORD3
00150A            FIELD1    R               REFFLD(RECORD2/FIELD1 *SRC)  (9)
00160A
00170A          R RECORD4
00180A            FIELD1    R               REFFLD(FIELD1 *SRC)  (10)
     A

Note:For line 00010, you can also specify library name and record format
name. See the REF keyword example/

You must specify R in position 29 for each field that refers to another field that was previously defined.

RPG preprocessor supports only the cases (2) and (7) : Only one parameter for the REFFLD function.

For XXL applications, if any performance issue is experienced during the "Run Extensions at application level" step of the analysis, please contact CAST Support.

  • No labels