Cool Things: The Select STMF Utility PDF Print E-mail
Programming - RPG
Written by Mike Faust   
Friday, 26 October 2012 00:00

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
About the Author:

Mike Faust is an Application Developer Specialist for Disney Vacation Club in Celebration, Florida. Mike is also the author of the books The iSeries and AS/400 Programmer's Guide to Cool Things, Active Server Pages Primer, SQL Built-in Functions and Stored Procedures, and JavaScript for the Business Developer. You can contact Mike at mikeffaust@yahoo.com.

 

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

 

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
 
Active Server Pages Primer Active Server Pages Primer
This book takes an in-depth look at the ASP concept and how to make the most of it.

List Price $79.00
Now On Sale
 
SQL Built-In Functions and Stored Procedures

SQL Built-In Functions and Stored Procedures


This book provides a terrific introduction to the creation and use of SQL built-in functions and stored procedures under OS/400 and i5/OS.

List Price $49.95
Now On Sale
 
Read More >>
Last Updated on Friday, 26 October 2012 00:00
 
Please login to make comments.
User Rating: / 3
PoorBest 
   MC-STORE.COM