How can we help you?

We have hundreds of highly-qualified, experienced experts working in 70+ technologies.

IBM i e-Book

A Developer’s Guide to Mastering IBM i Concepts

System Architecture

Source Files and Types

In context with IBM i, a source file is a structured container for housing programs source code written in languages like RPG, CL etc. These files are typically identified by a specific naming convention or a specific type and are integral to the software development process. It is used as a repository to store, manage and edit code efficiently. Source files play a pivotal role and are often manipulated using tools like Source entry utility ( SEU) or intergraded development environments (IDEs). They ensure the integrity of the source code, facilitating software development and maintenance on the IBM i platform.

SOURCE PHYSICAL FILES


Source files or source physical files are essentially a container of repository that holds individual source code members.
Within a source physical file, each source code file is referred to as a ‘member’. The members are individual source code files that contain the actual code written in a specific programming language. It is a structured way to manage or organize the source code for programs, files, and other objects on the system.

COMMANDS USED


CRTSRCPF

CRTSRCPF is an IBM i command that is used to create the source physical file.

File: Specify the name of the source file which you want to create.

Library: Specify the library where the source file will be created.

Record length: Provide the record length of the source physical file i.e. the number of bytes in the length of records stored in the source physical file.

The record format of the source physical file contains three fields.

  • Source sequence number
  • Source statement
  • Date

The default record length is 92 bytes. The source sequence number contains 6 bytes, Date contains 6 bytes, and the source statement contains 80 bytes.

Similarly, if user makes the record length as 112, the source statement will contain 100 bytes, 6 bytes will be for sequence number & 6 bytes for date.

STRPDM

Program development manager (PDM) can be started using the command STRPDM which shows a menu of options for the level on which the user wishes to work.

User can choose a particular option or directly enter a command for that menu.

To work with libraries user can choose option 1 or directly use WRKLIBPDM command.
The work with objects user can choose option 2 or directly use WRKOBJPDM command.
Similarly to work with members user can choose option 3 or directly use WRKMBRPDM command.

TYPES OF SOURCE FILES


While working with members the user can create a new member by pressing F6 key.

Here users can enter the name of the member/source that they want to create and source type for that member.

Source Types

The source types determine the syntax checker, prompting, and formatting that are used for that member.
Different source types serve different purposes. Different source types are used to organize and define various elements of a program or application.

Many source types can be used in IBM i. To check the entire list of source types supported by IBM i, the user can press F4 key on the source type parameter while creating a new member.
Below are the most frequently used Source types in the IBM i world.

PHYSICAL FILE (PF)

Source type: PF

Physical files define the structure and attributes of a physical database file.
These files are used to store and organize data records.

Object type: PF type sources are compiled using the CRTPF command and are created with *FILE type object.

LOGICAL FILE (LF)

Source type: LF

Logical files provide a logical view of one or more physical files.

They allow users to define alternate record selection criteria & and record sequences. It simplifies data access by specifying different key sequences or filtering criteria.

Object type: LF type sources are compiled using CRTLF command and are created with *FILE type object.

RPG PROGRAM (RPGLE or RPG)

Source type: RPG

RPG stands for report program generator.
RPG source type is used to define the logic and processing instructions for a program. RPGLE source is where you write the business logic, calculations, and data manipulation for your application.

Object type: RPG type sources are compiled using CRTRPGPGM command and are created with *PGM type object.

RPG ILE (RPGLE)

Source type: RPGLE

It is an ILE version of RPG where users can write programs and business logic in a more efficient and modular way which can reduce reusability.

Object type: RPGLE type sources are compiled using CRTBNDRPG command and are created with *PGM type object.
RPGLE type sources can also be compiled using the CRTRPGMOD command and are created with *MODULE type object.

SQLRPG PROGRAM (SQLRPG)

Source type: SQLRPG

SQLRPG source type is used to define the logic and processing instructions for a program. It is like the RPG program along with the ability to use embedded SQL operations within the same program. This way user can manipulate the data using SQL statements within their program.

Object type: SQLRPG type sources are compiled using CRTSQLRPG command and are created with *PGM type object.

SQLRPG ILE(SQLRPGLE)

Source type: SQLRPGLE

It is an ILE version of SQLRPG where users can write programs and business logic with the ability to use embedded SQL operations in a more efficient and modular way which can reduce the reusability.

Object type: SQLRPGLE type sources are compiled using the CRTSQLRPGI command and are created with (OBJTYPE) *PGM or *MODULE type object.

CONTROL LANGUAGE PROGRAMMING(CLP)

Source Type: CLP

CLP stands for Control language programming.

It allows users to write IBM i commands in a program along with the ability to include statements from compiled languages (like RPG, COBOL etc.) to perform specific calculations that will be executed more easily and efficiently.

Object type: CLP type sources are compiled using CRTCLPGM command and are created with *PGM type object.

CONTROL LANGUAGE ILE(CLLE)

Source Type: CLLE

CLLE stands for control language with language extension.

It is an ILE version of CLLE which allows the user to write programs in a modular way. It can be used when the user wants to invoke RPG procedures within a CL program.

Object type: CLLE type sources are compiled using CRTBNDCL command and are created with *PGM type object.

CLLE type sources can also be compiled using CRTCLMOD command and are created with *MODULE type object.

DISPLAY FILE(DSPF)

Source type: DSPF

Display files are used to define the layout and characteristics of interactive screens or user interfaces. They specify how data is presented to users and input is accepted.

Object type: DSPF type sources are compiled using the CRTDSPF command and are created with *FILE type object.

PRINTER FILE(PRTF)

Source type: PRTF

Printer files define the layout and formatting of output generated by your RPGLE programs. They specify how data should be printed on physical printers. It is used to format reports, labels, and other printed output produced by RPG/RPGLE programs.

Object type: PRTFF type sources are compiled using the CRTPRTF command and are created with *FILE type object.

TEXT(TXT)

Source Type: TXT

TXT source is used for including comments and documentation with your source code. It is not compiled or processed by IBM i compiler but serves as a readable note.

Users can use type TXT source members to write SQL queries, and then execute using RUNSQLSTM command.

QUERY(QRY)

Source Type: QRY

QRY source type member is used for creating and storing queries using query/400 language on the IBM i system. Query/400 is a language specifically designed for defining queries to extract, filter, and manipulate data from databases. These sources store definitions of queries that can be run interactively or as a part of a batch job process.

BOUND(BND)

Source type: BND

The binder language is used to define the binding source for ILE programs.

BND members include statements that specify attributes of a program such as a module that contains export names, the activation group it runs in, and other binding-related information.

A BND source might include statements to bind together different modules of an application, ensuring they work together cohesively when a program is executed.

COMMAND DEFINITION (CMD)

Source Type: CMD

CMD source members define custom commands, simplifying complex operations, and improving command line efficiency.

Users can encapsulate specific tasks and can be invoked from CL programs or the command line.

C Programming(C)

Source Type: C

C type source members allow users to write and then run programs written in C programming language in IBMi.

Object type: C type sources are compiled using CRTBNDC command and are created with *PGM type object.

C type sources can also be compiled using CRTCMOD command and are created with *MODULE type object.

CPP Programming(CPP)

Source Type: CPP

CPP type source members allow users to write and then run written in C++ programming language in IBM i.

Object type:CPP type sources are compiled using CRTBNDCPP command and are created with *PGM type object.

CPP type sources can also be compiled using CRTCPPMOD command and are created with *MODULE type object.

COBOL LANGUAGE(CBL)

Source Type: CBL

COBOL stands for common business-oriented language.

CBL source type members contain code written in COBOL a high level programming language designed for business applications.

COBOL is known for its readability and often used in legacy systems for financial and administrative applications.

Object type: CBL type sources are compiled using CRTCBLPGM command and are created with *PGM type object.

CPP type sources can also be compiled using CRTCPPMOD command and are created with *MODULE type object.

COBOL LANGUAGE BOUND(CBLLE)

Source Type: CBLLE

CBLLE source type members also contain code written in COBOL programming language, but they undergo a two-step process. First the source code is compiled into an intermediate form called ‘object module’ using the COBOL compiler. Then the object module is bound into executable programs.

Object type: CBLLE type sources are compiled using CRTBNDCBL command and are created with *PGM type object.

CBLLE type sources can also be compiled using CRTCBLMOD command and are created with *MODULE type object.

How can we help you?

We have hundreds of highly-qualified, experienced experts working in 70+ technologies.

share_iconShare
X

Awards and Certifications

company-logo
company-logo
company-logo
company-logo
company-logo
company-logo
company-logo
company-logo
company-logo
company-logo