RPGIV and ILE Specifications in AS400

RPGIV and ILE Specifications in AS400
RPGIV and ILE Specifications in AS400, rpgiv, ile specification, rpg specification, rpg-specs, h spec, f spec, d spec, c spec, i spec, o spec, p spec,procedure specs, control spec, file spec, definition spec, calculation spec, input spec, output spec,ibmi,as400,rpgle, epg as400
RPGIV and ILE Specifications in AS400

Inroduction to RPGIV

RPG code is written in various specifications available in RPG programming and many of them are position-dependent. We need to write the RPG code in the source program in the specifications available in RPG and each specification is optional.

The compiler differentiates each line of the code based on the specification in which it is written.

RPG Specifications

There are seven types of specifications that can be coded in the RPG program in the order mentioned below.

H specs (Control specifications)

This specification will provide the compiler with the information of compilation options for the program, how that program will run, name of program, date format, data format.

  • There are various H specs keywords which we can specify such as BNDDIR, ACTGRP, ALWNULL, CCSID, COPYRIGHT, CVTOPT, DATEIT, DATFMT, DEBUG, DFTACTGRP, MAIN, NOMAIN, OPTION, TEXT, USRPRF, TIMFMT, etc.
  • H specs must be written in 6th position in the source program.
  • The H specs keywords are written in 7-80 positions in the source program.
  • If any compile option keyword is specified in H specs then that will override the options provided during RPG program compilation either using CRTRPGMOD or CRTBNDRPG command.
  • F specs (File Description specifications)

    In this specification, we will declare all the files such as PF, LF, DSPF, Subfiles, PRTF which will be used in the program.

  • We can rename file record formats and prefix the file fields. We can read any member of a file using this specification.
  • We can define the program described printer file also.
  • We can describe the externally and program described file both in these specs.
  • We can declare only one primary file in the RPG program.
  • We can define secondary files also in this spec.
  • D specs (Definitions specifications)

    In this specification, we will declare the variables in these specs.

  • Data structure and their sub-fields variable and Array variables used by the program.
  • The exported or imported variable can also be declared.
  • Procedure prototype and procedure Input can also be declared.
  • We can define Standalone fields.
  • I specs (Input specifications)

    In this specification, we can rename some file fields and file record format names. We can define Data structure, named constant.

    C pecs (Calculation specifications)

    In this specification, we write our code logic. All the calculation logic will come here. All the file operations such as Read, Write, Update, Delete, etc are performed in these specs.

    All the API calls, program calls, Subroutine execution, procedure calls, module call, calls to sub-procedures.

    O pecs (Output specifications)

    In this specification, we will define the layout of the program described printer file.

    P pecs (Procedure specifications)

    In this specification, we define the boundary of procedures such as Begin and End of procedure blocks. We can define the procedure name and whether it is an Exported procedure or not.

    Specifications allowed in Main Source Section

    1. H specs (Control)
    2. F specs (File definition)
    3. D specs (Definition)
    4. I specs (Input)
    5. C specs (Cakculation)
    6. O specs (Output)

    Specifications allowed in Subprocedure Section

    1. P specs (Procedure Begin)
    2. F specs (File definition)
    3. D specs (Definition)
    4. C specs (Cakculation)
    5. P specs (Procedure End)

    Related Post

    Post a Comment

    © AS400 and SQL Tricks. All rights reserved. Developed by Jago Desain