top of page

Specifications

 Order of the Types of Specifications in an RPG/400 source program (HFELICO)

 

  1. —H, Control (header)

  2. —F, File description

  3. —E, Extension

  4. —L, Line Counter

  5. —I, Input

  6. —C, Calculation

  7. —O, Output

 

•An RPG source program must be entered into the system in the order shown above

•Extension and Line Counter specification are the only exceptions, the order can be either  E L or L E, but must be placed between the File  Description and Input specifications

•Any of the specification types can be absent, but at least one must be present

•A typical program may use File Description, Input, Calculation, and Output specification

•All the specifications should be specified in 6th column

 

—H, Control (header)

— provide information about program generation and running of compiled program, which includes

—  - Name of the program

—  - Date format

—  - Whether an alternate collating sequence or file translation is used

—Only one control specification is allowed per program

 

—F, File description

—define all files that the program uses

 -—Name of the file

— -How the file is used

— -Size of Records in file

— -Input or Output device used for the file

 

—E, Extension

—describe all Table files, Array files and Record Address files used in program and indicate how they are initialized

— -Name of file, array, or table

— -Number of entries in table or array input record

— -Number of Entries in Table or Array

— -Length of Table or array entry

 

—L, Line Counter

—Describes the page or form on which output is printed

— -Number of lines per page

— -Line of page at which overflow occurs

 

—I, Input

—describes data structures, named constants, records, and fields in the input files and indicate how the records and fields are used by the program

— -Name of file

— -Sequence of Record Types

— -Whether record identifying, Control level, field indicators are used

— -Type of field (Alphanumeric or Numeric, Packed, Zoned or Binary Format)

— -Location of each field in record

 -—Name of each field in record

 

—C, Calculation

  • —Describes calculations to be done by the program and indicate the order in which they are done

  • —These can be used to control the Input and Output operations

  • —C specifications consist of

— -Control level and Conditioning indicators for operation specified

— -Field or constants to be used in the operation

 -—Operation to be performed

 

—O, Output

—Describes the records and fields in the output files and conditions under which output operations are processed

 —-Name of the file

— -Type of record to be written

— -Spacing and skipping for PRINTER files

— -Output indicators that condition the record being written

— -Name and location of each field in output record

— -Edit codes and Edit words for the fields

 

Simple example of Declarations:

H                                                                     
 * Read Only - Keyed Sequence                                         
FTestLf01  IF   E           K Disk                                    
 * Write Only                                                         
FTestLf02  o    E             Disk    Rename(TestRec: TestRec02)      
 * Read/Write Only - Keyed Sequence                                   
FTestLf03  IF A E           K Disk                                    
 * Read/Update-Delete Only - Keyed Sequence                           
FTestLf04  UF   E           K Disk                                    
 * Read/Write/Update-Delete Only - Keyed Sequence                     
FTestLf05  UF A E           K Disk    Rename(TestRec:Testrec01)       
F                                     Prefix(a)                       
FTable1    IT   F   10        Disk                                    
 * Display File - Simple record format                                
FDisppf    CF   E             WorkSTn                                 
 * Display File - Subfile                                             

FDisppf    CF   E             WorkSTn SFile(SflRec: SflRrn)       
 * Data Spec                                                      
 * Variables                                                      
DVar1             S             10                                
 * Constants                                                      
DConst1           C                   CONST('Y')                  
 * Data Structure                                                 
DName             DS                                              
DFName                    1     15                                

DMName                   16     16                               
DLName                   17     32                               
 *                                                               
DName             DS                  Occurs(100)                
DFName                          15    OverLay(Name : *Next)      
DMName                           1    OverLay(Name : *Next)      
DLName                          15    OverLay(Name : *Next)      
 * Array                                                         
DArray_Run        S             10    DIM(100)                   

DArray_PRun       S             10    DIM(100) fromfile(Table1)     
DArray_CT         S             10    DIM(1) CTDATA  PERRCD(1)      
DArray_CT1        S             10    DIM(2) CTDATA  PERRCD(1)      
 * main Logic                                                       
** CTDATA Array_CT

Option Invalid.

** CTDATA Array_CT1

Option Invalid1.

Option Invalid2.

 

bottom of page