Wed, Apr
0 New Articles

TechTip: Take Open-Source ILE Further - Creating from the IFS

  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

The future of storing ILE source code is closer than you think.

In this long-awaited article, I'm going to talk about how to store your RPG and CL code on the IFS and what steps you need to take in order to create objects out of that source.

First, you should know that CRTRPGMOD, CRTBNDRPG, and CRTSQLRPGI all have a parameter to specify a stream file for source. Thanks to IBM, this makes compiling RPG programs much easier. But what about CL? There isn’t a stream file parameter on CRTBNDCL, so what options do we have? I’ll come to that in a little while. If you work with other ILE languages, you might be glad to hear that the C, C++, and COBOL “Create” commands also have stream file parameters.

Next, I’m going to talk about how to organize your source. Let's imagine there is a library called MYPROG that holds two source physical files, one called QRPGLESRC and another called QCLLESRC. Now you have to consider how you'd lay that out in an IFS-styled manner. You might have a directory named MYPROG, with two directories below that called QRPGLESRC and QCLLESRC. It would look something like this:






As you can see, this is how you'd normally lay out your source code, but instead of libraries and source physical files, we just have regular directories. For this example, I have created MYPROJ in the IFS root, but you may create it wherever you like, including your home directory.

Creating Your First Program!

Creating your first program is just as simple as it would be if you were compiling from a source member. First, you need to create a stream file. For the sake of example, I created HELLOWORLD.rpgle within the QRPGLESRC directory.

Now bear in mind, stream file names do not have a logical maximum length. In theory, you could have RPG stream files named HELLOWORLDHOWAREYOU.sqlrpgle, and it wouldn't make a difference. But when creating an object from this source, that object will still have its 10-character limit. Don't give stream file long names just because you can.

So now I have created HELLOWORLD.rpgle, I am going to place some source code in there so it can be compiled:


Dcl-S Text Char(11);

Text = 'Hello world';


*InLR = *On;



To compile this, I’m going to use CRTBNDRPG. Luckily, since the stream file name (without the extension) is 10 characters, I can give the object the same name. The only difference here is that you can’t pass in a source member, but instead you pass in the path to the stream file you want to compilein this case, /MYPROJ/QRPGLESRC/HELLOWORLD.rpgle.


Compiling CL Source

Compiling CL source can be a touchy subject. In fact, what I’m about to tell you doesn't apply only to CL, but also display files, commands, and a few others.

I'm afraid to tell you that CRTBNDCL does not have a stream file parameter. There is an RFE to add support for CL in stream files, but we've heard nothing from IBM on the matter; it could be a while before we even see it, let alone are able to use it.

This means we need to create our own process to create our CL programs. What do I mean by “process,” you ask? You need to have a way to automate compiling CL from the IFS.

A common method and the one I will be using is having a program to automate the following steps:

1.Copy the stream file to a temporary member (replace this member if it already exists too).

2.Create the CL program from the temporary member.

Might seem easy, right? It's the best we have right now, but there is one small thing to remember: If you create a temporary member within a source file in QTEMP and still want the ability to debug the CL, you will need to use DBGVIEW(*LIST) in your CRTBNDCL command. You will find that, after you start debugging, *LIST is not the best thing to do. Another option is to not make it a temporary member. Instead, copy the stream file into a member that resides in the same library you are creating the object in and then use DBGVIEW(*SOURCE) to retain the source.

Seems like a lot just to create a CL from the IFS, doesn’t it? There is an easier way in the meantime, but that is until IBM gives us the stream file parameter. I mentioned this in my previous article , but Brian Garland's CRTFRMSTMF is a great way to do this and could easily be part of your process to create CLs, display files, etc. The good news is that Brian has made it open source for us all to use.

CRTFRMSTMF allows you to compile non-traditional things like CL from the IFS. It actually uses the process I described earlier; it creates a temporary memory and runs the compile command for us. The best way to try it is to obtain the source for this project and compile it on your machine so you have access to the CRTFRMSTMF command.

So let's say we have a CL program called MYCLPGM.clle that lives in the QCLLESRC directory I created earlier.


             DCL       VAR(&TEXT) TYPE(*CHAR) LEN(11)

             CHGVAR     VAR(&TEXT) VALUE('Hello world')

             SNDPGMMSG MSG(&TEXT)



Now, I can make use of the process to create this CL, but for this article I will show both methods.

Process 1






Process 2 (Automated)




What’s Next?

I hope this article has shown you how easy it can be to store source on the IFS. It really is the future and will allow development and dev ops processes to become much easier.

In the next article, I plan to show you how to start using Git on this MYPROJ directory to maintain your source code.



Support MC Press Online

$0.00 Raised:

Book Reviews

Resource Center

  • SB Profound WC 5536 Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application. You can find Part 1 here. In Part 2 of our free Node.js Webinar Series, Brian May teaches you the different tooling options available for writing code, debugging, and using Git for version control. Brian will briefly discuss the different tools available, and demonstrate his preferred setup for Node development on IBM i or any platform. Attend this webinar to learn:

  • SB Profound WP 5539More than ever, there is a demand for IT to deliver innovation. Your IBM i has been an essential part of your business operations for years. However, your organization may struggle to maintain the current system and implement new projects. The thousands of customers we've worked with and surveyed state that expectations regarding the digital footprint and vision of the company are not aligned with the current IT environment.

  • SB HelpSystems ROBOT Generic IBM announced the E1080 servers using the latest Power10 processor in September 2021. The most powerful processor from IBM to date, Power10 is designed to handle the demands of doing business in today’s high-tech atmosphere, including running cloud applications, supporting big data, and managing AI workloads. But what does Power10 mean for your data center? In this recorded webinar, IBMers Dan Sundt and Dylan Boday join IBM Power Champion Tom Huntington for a discussion on why Power10 technology is the right strategic investment if you run IBM i, AIX, or Linux. In this action-packed hour, Tom will share trends from the IBM i and AIX user communities while Dan and Dylan dive into the tech specs for key hardware, including:

  • Magic MarkTRY the one package that solves all your document design and printing challenges on all your platforms. Produce bar code labels, electronic forms, ad hoc reports, and RFID tags – without programming! MarkMagic is the only document design and print solution that combines report writing, WYSIWYG label and forms design, and conditional printing in one integrated product. Make sure your data survives when catastrophe hits. Request your trial now!  Request Now.

  • SB HelpSystems ROBOT GenericForms of ransomware has been around for over 30 years, and with more and more organizations suffering attacks each year, it continues to endure. What has made ransomware such a durable threat and what is the best way to combat it? In order to prevent ransomware, organizations must first understand how it works.

  • SB HelpSystems ROBOT GenericIT security is a top priority for businesses around the world, but most IBM i pros don’t know where to begin—and most cybersecurity experts don’t know IBM i. In this session, Robin Tatam explores the business impact of lax IBM i security, the top vulnerabilities putting IBM i at risk, and the steps you can take to protect your organization. If you’re looking to avoid unexpected downtime or corrupted data, you don’t want to miss this session.

  • SB HelpSystems ROBOT GenericCan you trust all of your users all of the time? A typical end user receives 16 malicious emails each month, but only 17 percent of these phishing campaigns are reported to IT. Once an attack is underway, most organizations won’t discover the breach until six months later. A staggering amount of damage can occur in that time. Despite these risks, 93 percent of organizations are leaving their IBM i systems vulnerable to cybercrime. In this on-demand webinar, IBM i security experts Robin Tatam and Sandi Moore will reveal:

  • FORTRA Disaster protection is vital to every business. Yet, it often consists of patched together procedures that are prone to error. From automatic backups to data encryption to media management, Robot automates the routine (yet often complex) tasks of iSeries backup and recovery, saving you time and money and making the process safer and more reliable. Automate your backups with the Robot Backup and Recovery Solution. Key features include:

  • FORTRAManaging messages on your IBM i can be more than a full-time job if you have to do it manually. Messages need a response and resources must be monitored—often over multiple systems and across platforms. How can you be sure you won’t miss important system events? Automate your message center with the Robot Message Management Solution. Key features include:

  • FORTRAThe thought of printing, distributing, and storing iSeries reports manually may reduce you to tears. Paper and labor costs associated with report generation can spiral out of control. Mountains of paper threaten to swamp your files. Robot automates report bursting, distribution, bundling, and archiving, and offers secure, selective online report viewing. Manage your reports with the Robot Report Management Solution. Key features include:

  • FORTRAFor over 30 years, Robot has been a leader in systems management for IBM i. With batch job creation and scheduling at its core, the Robot Job Scheduling Solution reduces the opportunity for human error and helps you maintain service levels, automating even the biggest, most complex runbooks. Manage your job schedule with the Robot Job Scheduling Solution. Key features include:

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • LANSAWhen it comes to creating your business applications, there are hundreds of coding platforms and programming languages to choose from. These options range from very complex traditional programming languages to Low-Code platforms where sometimes no traditional coding experience is needed. Download our whitepaper, The Power of Writing Code in a Low-Code Solution, and:

  • LANSASupply Chain is becoming increasingly complex and unpredictable. From raw materials for manufacturing to food supply chains, the journey from source to production to delivery to consumers is marred with inefficiencies, manual processes, shortages, recalls, counterfeits, and scandals. In this webinar, we discuss how:

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • Profound Logic Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application.

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: