PreviousNext
Help > XML Easycom > Simplified RPG Syntax
Simplified RPG Syntax

 

Simplified RPG accepts only declaration statements. ‘D’ letter at beginning of a regular RPG declaration is omitted.

Statements are ended by a semi colon (;).

There are no column constraints.

 

Name

[E]

[DS
PR
S]

[n]T[d]

[ Keywords ] ;

Name is the name of a variable, structure, or procedure.

E means that the structure is externally defined by a physical file. Keyword EXTNAME is mandatory.

DS: When this keyword is present, Name is a data structure.

PR: When present, Name is a Procedure name.

S: When present, Name is a simple variable.

n is the number of digits of a simple variable.

T is the data type.

d is the precision.

Keywords are used according to regular RPG syntax.

 

When DS, PR and S are not specified, name is a member of the data structure or a parameter of a procedure which definition was started by a previous statement.

 

/COPY directive can used in S-RPG definitions, to load external RPG source members.

PR keyword is used to declare a procedure.
If the procedure maps to a program (*PGM) use standard RPG keyword EXTPGM to point to the real program.
If the procedure maps to a procedure in a service program, use keyword EXTPROC to give the real procedure name, if it is different from the name used and defined by PHP.

DS keyword is used to define data structures.
EXTNAME keyword can be used to define an external data structure from a physical file description. In that case, special letter E is present before DS keyword.

CONST keyword sets parameter as INPUT only.

 

Example of S-RPG Syntaxs.

 

      DS_CUST   E DS  extname(SP_CUST:RSP_CUST);

      PSPCUST   PR;

        Result    LIKEDS(DS_CUST);

        TERM1     5S 0;     

 

      DS_A      DS;

        MBR1    10a;

        MBR2    10a inz('Member 2');

        MBR3     8p2;

      SampleDS1 PR  extpgm(SampleDS1);

        PARM1   10a  const;

        PARM2    8p2;

        PARM3   likeds(DS_A);";

 

RPG and PCML sources contain structure and program definitions. Definitions are maintained for all job life.

It is recommended to not run twice a <define> for the same RPG or PCML source.