0% found this document useful (0 votes)
6 views21 pages

F-Spec Full Guide - 1

The document provides a comprehensive guide on file specifications (F-spec) used in RPGLE programming, detailing the declaration of various file types such as program-described and externally described files. It outlines operations such as reading, inserting, updating, deleting records, and displaying data, along with the use of printer files. Additionally, it introduces important keywords like RENAME, PREFIX, EXTMBR, and USROPN that are commonly used in file handling.

Uploaded by

sayalibhorde23
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views21 pages

F-Spec Full Guide - 1

The document provides a comprehensive guide on file specifications (F-spec) used in RPGLE programming, detailing the declaration of various file types such as program-described and externally described files. It outlines operations such as reading, inserting, updating, deleting records, and displaying data, along with the use of printer files. Additionally, it introduces important keywords like RENAME, PREFIX, EXTMBR, and USROPN that are commonly used in file handling.

Uploaded by

sayalibhorde23
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

The File Spec

Full Guide.
Are you having difficulty understanding?

Tech Don
Tech Don

This F-specification is used to declare


all the files which we will be using in the
program

We will declare all the files such as PF,


LF, DSPF, Subfiles, PRTF .
Tech Don

There are two basic file types in RPGLE

1. Program-described files

2. Externally described files

Most applications written today use


externally described files
Tech Don

Supose if we have a Requirement like

1.Read a file

2.Insert a record in the file

3.Update a record in the file.

4.Delete a record

5.To display data in display file

6.Use a Printer file


Example 1 :- Read a File
RPG :-

Free-Form:-

or

or
Tech Don

2. Insert a record in the file

2.1 Externally described disk file with no


key and open for input

2.2 Externally described disk file with


key and open for Input
2.1 :-INPUT -FILE SPEC-NO KEY

RPG :-

Free-Form:-

or

or
2.2:-INPUT -FILE SPEC-WITH KEY

RPG :-

Free-Form:-

or

or
Tech Don

3. Update a record in the file.

Externally described disk file with key


and open for update
3. FILE SPEC-Update - with Key

RPG :-

Free-Form:-

or

or
Tech Don

4. Delete a record.

Externally described disk file with key


and open for Delete
3. FILE SPEC-Delete - with Key

RPG :-

Free-Form:-

or

or
Tech Don

5. To display data in display file.

Suppose we have a scenario like to


display all the records in the pf.

we will create a display file and specify


it in the filespec of the program as below
image. Read the file by using built-in
functions.

The object type of display file is *DSPF


5.DISPLAY FILE

RPG :-

Free-Form:-

or
Tech Don

6. Use a Printer file.

There are two types of Printer files

1. Program described printer file

2. Externally described printer file

The object type of printer file is *PRTF


6. PRINTER FILE
RPG :-

Free-Form:-

or
Tech Don

Keywords that are mostly used

1.RENAME:-

The RENAME keyword allows you to


rename record formats in an externally
described file.

2. PREFIX:-

The PREFIX keyword is used to partially


rename the fields in an externally
described file
Tech Don

3.EXTMBR:-
Using EXTMBR ('member name’), we can
use the member that we want to access
from the file

4. USROPN:-
Specify this keyword to indicate that the
file must be explicitly opened with the
OPEN operation and should be closed
with the CLOSE operation.
I'm Tech don
I help Rpg Developers Learn skills
with my content on LinkedIn.

Follow me and together, we'll


learn the skill once, and get paid
forever.
Tech Don

Download the RPGLE


Guide Pack
Just One dollar to support my content
If You enjoyed this thread, then
consider giving simple repost ♻️

You might also like