Skip to main content

Posts

Showing posts from December, 2023

What is the importance of User Open (USROPN) in RPGLE - IBM i

User Open (USROPN) USROPN (User Open) in RPGLE provides the flexibility for the programmer to open a file at a specific point in the program execution. In this post, let's explore what is the use of a USROPN and what is the importance of USROPN and how to use it with a simple example. What is the use of USROPN? By default, any file in the RPGLE (defined in F-Spec) opens as soon as the program execution is started and file is closed at the end of the program (by setting LR indicator ON). A simple RPGLE program looks something like this on a high level with out the use of a USROPN.  1 2 3 4 5 6 7 8 9 10 11 **Free                                  Dcl-F TestFile;                                                             Setll *Start TestFile;                Read  TestFile;                       Dow   Not %Eof(TestFile);               // Operation required on a file       Read TestFile;                      EndDo;                                                                      *I