Summary: This document provides information about the extension providing RPG support.
Please see RPG 3.0 - Release Notes for more information.
This extension provides support for applications written using RPG languages.
In what situation should you install this extension?
If your application contains source code written using RPG and you want to view these object types and their links with other objects, then you should install this extension.
Supported Versions of RPG
- RPG III (also known as GAP 3)
- RPG IV with traditional operation codes
- RPG IV with alternate Calc spec and Extended Factor 2
- RPG IV with /FREE directive
Embedded SQL support
Embedded SQL is supported, primarily to obtain Usiud links from RPG400 and CL400 objects to SQL Tables and SQL Views. The resolution of these link types requires that the database (DB2 UDB) is delivered and analyzed, however, the DB400 extractor can be used to simulate this database.
- The following source code is considered as embedded SQL:
- For RPG400: C/EXEC SQL … C/END-EXEC
- For RPG Free Format: EXEC SQL … ;
- For CL: RUNSQL(…)
- Dynamic execution is not supported.
Function Point, Quality and Sizing support
- Function Points (transactions): a green tick indicates that OMG Function Point counting and Transaction Risk Index are supported
- Quality and Sizing: a green tick indicates that CAST can measure size and that a minimum set of Quality Rules exist
|Quality and Sizing|
CAST AIP compatibility
CAST AIP release
Supported DBMS servers
This extension is compatible with the following DBMS servers:
|An installation of any compatible release of CAST AIP (see table above)|
Download and installation instructions
CAST Transaction Configuration Center (TCC) configuration
A set of RPG Transaction Entry/End Points, Data Entities and Excluded Items for use in the CAST Transaction Configuration Center is delivered in the extension via a .TCCSetup file. Therefore if you are using:
- CAST AIP ≥ 8.3.x, there is nothing for you to do: this configuration will be automatically imported during the extension installation and will be available in the CAST Transaction Configuration Center
- CAST AIP ≤ 8.2.x, you can manually import the file %PROGRAMDATA%\CAST\CAST\Extensions\com.castsoftware.rpg.<version>\RPG.TCCSetup to obtain configuration (see instructions below).
Manual import action for CAST AIP ≤ 8.2.x
Locate the .TCCSetup file in the extension folder: %PROGRAMDATA%\CAST\CAST\Extensions\com.castsoftware.rpg.<version>\RPG.TCCSetup
In the CAST Transaction Configuration Center, ensure you have selected the Templates node:
This .TCCSetup file is to be imported into the CAST Transaction Calibration Center using either the:
File > Import Configuration menu option:
- Or right clicking on the Template node and selecting Import Configuration:
- The import of the "RPG.TCCSetup" file will provide you with a sample configuration under Templates (click to enlarge)
- Now right click any of the imported items and select copy
- Paste the item into the equivalent node under the Application, for example, below we have copied it into the Application MEUDON:
- Repeat for any additional items or generic sets that have been imported from the .TCCSetup file.
Prepare and deliver the source code
Once the extension is downloaded and installed, you can now package your source code and run an analysis. The process of preparing and delivering your source code is described below:
Source code preparation
Before the RPG source code can be delivered 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
Used in MetaModel
ILE RPG Programs
ILE RPG Programs with SQL
Copy source members
*.cl, *.clp, *.cl38, *.clp38
ILE CL Programs
Bound service programs
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 Analyzer provides specific pre-processors for each language embedded in this extension: the preprocessor per language only considers the files with the expected extensions.
Deliver the source code
Using AIP Console
AIP Console expects either a ZIP/archive file or source code located in a folder configured in AIP Console. You should include in the ZIP/source code folder all RPG source code. CAST highly recommends placing the files in a folder dedicated to RPG. If you are using a ZIP/archive file, zip the folders in the "temp" folder - but do not zip the "temp" folder itself, nor create any intermediary folders:
The following file extensions will trigger the extractor to process the IBM Db2 for i related files correctly - so ensure that at least one of these is delivered if you have IBM Db2 for i definitions (DDS and/or DDL):
When the source code has been delivered, AIP Console will create:
- One RPG package with the provided source code. The associated Analysis Unit will end with a suffix as shown below:
- One RPG DB400 package containing source code with the specific IBM Db2 for i file extensions listed above. The associated Analysis Unit will have a name depending on what has been discovered and will be extracted into a subfolder named as below:
Using the CAST Delivery Manager Tool
- create a new Version
- create a new Package for your RPG source code using the Files on your file system option and choose the location of your source code:
Click to enlarge
- create an additional new package for your Tables and Views using the DB400 extraction option:
Click to enlarge
- Run the Package action.
- Before delivering the source code, check the packaging results.
Configuring Technical Size measures for RPG in the CAST Health Dashboard
Technical Size measures can be displayed for RPG analysis results in the CAST Health Dashboard by manually editing the following file:
Add the following entries into the existing section "TechnicalSizeMeasures":
Following any changes you make, save the app.json file and then restart your application server so that the changes are taken into account.
Dependency configuration in the CAST Management Studio
In the Application editor > Dependencies tab, add a dependency between the Universal Analysis Unit as Source and LIB (UDB DB2 schema) as the target
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:
|Preprocessor||File 'FileName' is empty||This is caused by source code that is referring file is empty. You can safely ignore this warning.|
|Preprocessor||Unable 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.|
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.|
|Preprocessor||File Disk 'FDescName' not found : missing record||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.|
|Preprocessor||File 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.|
|Preprocessor||File 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|
|Preprocessor||Error NOMAIN in a PROGRAM||The program will not be preprocessed. Program will not be created|
|Preprocessor||Copy 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.|
|Preprocessor||Missing 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.|
|Preprocessor||Error on match if/endif at line 'LineNumber'||Object will not be created.|
|Preprocessor||File does not match RPG III format (RPG IV)||This means file is not RPG III and probably is RPG IV.|
|Preprocessor||File does not match RPG IV format (RPG III)||This means file is not RPG IV and probably is RPG III.|
|Analyzer||Unable 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.|
|Analyzer||Unable to find the regexp for the link 'accessLink'||The link will not be created -|
|Analyzer||An unnamed object of type 'RPG400SQLStructure' has been detected||This is because RPG400SQLStructures have no specific name, as such, the CAST framework will give them the name "unnamed". You can safely ignore this warning.|
|Analyzer||Duplicate 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.|
|Analyzer||Unable 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.|
|Analyzer||Duplicate 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.|
|Analyzer||Warning 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
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.
What results can you expect?
Below you can find a description of the RPG MetaModel, please click the image to download a full scale PDF version:
The following objects are displayed in CAST Enlighten:
|3||DDS400 PRTF File|
|4||DDS400 DSPF File|
|5||DDS400 Physical File|
|6||DDS400 Logical File|
|5||RPG300 File Printer|
|6||RPG300 File Disk|
|7||RPG300 File Workstn|
|8||RPG300 File Special|
|9||RPG300 File Seq|
|11||RPG300 Copy Member|
|12||RPG300 File Disk Record|
|13||RPG300 SQL Statement/Structure|
|14||RPG300 Data Structure|
|16||RPG300 Local Record Structure|
|5||RPG400 Subroutine FreeFormat|
|6||RPG400 File Printer|
|7||RPG400 File Disk|
|8||RPG400 File Workstn|
|9||RPG400 File Special|
|10||RPG400 File Seq|
|12||RPG400 Procedure FreeFormat|
|13||RPG400 Procedure Prototype|
|14||RPG400 Bound Service Program|
|15||RPG400 Copy Member|
|16||RPG400 Data Structure|
|17||RPG400 File Disk Record|
The following structural rules are provided: