The IBM i operating system has a tool called NetServer, which lets your System i act as a server on a Windows Network. With this support, you can navigate to your System i on your Windows Network and access the IFS folders marked as "shared" to the Windows Network.
Traditionally, the only way to share or unshare the IFS folders is through System i Navigator. However, I need to enable and disable these shares from the green-screen environment. Oh, woe is me! What shall I do? You guessed it . . . I wrote my own CL commands to share and unshare these folders. Now I can enable or disable the shares from the 5250 command line or even from a CL program.
IBM provides APIs that make it possible to control NetServer from a program. These APIs can retrieve the current configuration parameters, as well as change the configuration, start and stop the server, and add and remove shares.
To write my SHARE and UNSHARE utilities, all I had to do was write simple CL programs that use the IBM APIs.
The utilities consist of the SHARE and UNSHARE CL commands. Here are the parameters supported by the SHARE command:
Share Directory (SHARE)
Type choices, press Enter.
Share name . . . . . . . . . . . Character value
IFS directory to share . . . . .
...
Share for reading only . . . . . *YES *YES, *NO
Bottom
F3=Exit F4=Prompt F5=Refresh F12=Cancel F13=How to use this display
F24=More keys |
Likewise, here's a screen shot of the UNSHARE command:
UN-Share Directory (UNSHARE)
Type choices, press Enter.
Share name . . . . . . . . . . . Character value
Bottom
F3=Exit F4=Prompt F5=Refresh F12=Cancel F13=How to use this display
F24=More keys
|
For example, if I have an IFS directory named /usr/local/lib/group/qc that I want to share under the name QC on the Windows Network, I type the following:
SHARE SHARE('QC') DIR('/usr/local/lib/group/qc') READONLY(*NO)
Assuming that NetServer has already been set up and configured, this should immediately show up as a share named QC on my server. If I want to remove that share, I can simply do the following:
UNSHARE SHARE(QC)
I find this handy when I want to quickly share a directory. I can just type SHARE at the command line, and presto! I have a new share.
I also find these utilities useful for enabling and disabling shares on the fly from a CL program. For example, at my company, we have a process that generates a file containing each payroll period's direct-deposit information. Once generated, that file has to be uploaded to an HTTP server provided by our bank.
Because of the sensitive nature of that file (it contains employees' bank account numbers) we need to keep it as secure as possible. Of course, we use object-level security, but I find that security is even better if we share the directory only when it's needed. Our employee runs the option to "export direct deposit information," and the utility automatically enables the share. When the user is done uploading the file to the bank, the utility unshares the folder so that nobody can access it from the Windows Network. Doing this makes me feel a bit more secure. In order to steal the file, a hacker would not only have to know the user ID and password of a legitimate user profile, but the hacker would also have to get the timing right, since he or she would be able to steal only the data at the precise moment that the file is being uploaded to the bank.You can download the SHARE and UNSHARE utilities from the following link:
http://www.pentontech.com/IBMContent/Documents/article/57061_634_Share.zip [2]
Links:
[1] http://systeminetwork.com/author/scott-klement
[2] http://www.pentontech.com/IBMContent/Documents/article/57061_634_Share.zip