Cool Things: The Select STMF Utility

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

Take advantage of this simple IFS file access utility.            

 

Do you have an application that reads a data file from the IFS? This utility will allow your application to prompt the user to select the file to be processed. The utility is made up of an RPGLE program (SELECTSTMF) and a display file (SLCTSTMFFM). Figure 1 shows the main screen for SELECTSTMF.

 

102612Faustselectstmffig1                       

Figure 1: Here's your main screen.

 

The user has two available options. Option 1 is used to identify the file name to be passed back to the caller or to select a subfolder when multiple folders exist in the current path. To navigate back to the parent folder, use option 1 on the subfile record that displays an object link of "[parent folder]" as shown in Figure 2.

102612Faustselectstmffig2

Figure 2: Navigate to the parent folder.

 

A user can also use the option 5 to display additional information about a given file on the IFS. Figure 3 shows the results of option 5.

 

102612Faustselectstmffig3

Figure 3: Use option 5 to display file information.

 

The utility has three parameters. The first parameter identifies the initial folder displayed to the user. The second parameter is used to identify whether or not the user should be allowed to navigate to subfolders from the initial folder. This value is specified as a value of Y or N. The third parameter is used to pass the full path to the selected file back to the caller.

 

The example below shows calling the utility from a CL program, starting at the home folder and allowing subfolder navigation:

 

chgvar &strPath value('/home')
chgvar &rtnFile value(' ')
call selectstmf parm(&strPath 'Y' &rtnFile)

 

The RPG program used by this utility calls the C language IFS functions OPENDIR to open each folder, READDIR to read the contents of that folder, and CLOSEDIR to close the folder when it's no longer needed.

 

To download the source code for this utility, click here.

 

 

Mike Faust

Mike Faust is a senior consultant/analyst for Retail Technologies Corporation in Orlando, Florida. Mike is also the author of the books Active Server Pages Primer, The iSeries and AS/400 Programmer's Guide to Cool Things, JavaScript for the Business Developer, and SQL Built-in Functions and Stored Procedures. You can contact Mike at This email address is being protected from spambots. You need JavaScript enabled to view it..


MC Press books written by Mike Faust available now on the MC Press Bookstore.

Active Server Pages Primer Active Server Pages Primer
Learn how to make the most of ASP while creating a fully functional ASP "shopping cart" application.
List Price $79.00

Now On Sale

JavaScript for the Business Developer JavaScript for the Business Developer
Learn how JavaScript can help you create dynamic business applications with Web browser interfaces.
List Price $44.95

Now On Sale

SQL Built-in Functions and Stored Procedures SQL Built-in Functions and Stored Procedures
Unleash the full power of SQL with these highly useful tools.
List Price $49.95

Now On Sale

BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  •  

  • 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.

  • 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

  • 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: