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 mikeffaust@yahoo.com.


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