So far as the path name delimiter goes you can actually use the \ if you want. The Qp0lOpen API works the same as Open but supports the path name format (
http://publib.boulder.ibm.com/infocenter/iseries/v5r4/topic/apiref/pns.htm) rather than a simple path. Within the path name format you can say to use the \ (or most anything else) rather than /. As for the change in directory makeup, no API to help you there...
Bruce Vining
Scott Klement <rpg400-l@xxxxxxxxxxxxxxxx> wrote:
Hi Ali,
Looking for an api to convert IFS path string from Windows style
(\\myas400\QDLS\mdDir\myfile.txt) to IFS style (/myDir/myfile.txt).
There's no API that I know of. However, you could do this:
ifspath = %xlate('\': '/': windows_path);
if (%subst(ifspath:1:2) = '//';
ifspath = '/QNTC' + %subst(ifspath:2);
endif;
This would convert \\myas400\QDLS\mdDir\myfile.txt into
/QNTC/myas400/QDLS/mdDir/myfile.txt, thus making it a legal IFS path name.
From your example, however, it looks like you want to change the
perspective of the path as well as just converting it's syntax. In
other words, you want the code to somehow convert a network path into a
local path. That's not so simple, and I don't see the value of doing
so. There are all sorts of technical hurdles as well as security
ramifications...
For example, the system would have to know whether the hostname listed
is the local host's name, or not. That'd mean you'd have to account for
IP address, DNS lookups and NetBIOS lookups to see if it matched the
current system. Certainly doable, but it'd require a fair amount of code.
Once you recognized the system as the local system, you'd have to
extract the share name, look in the NetServer configuration (There are
APIs to return the configured shares in NetServer) and map the netserver
share name to an IFS directory name.
Once you'd done that, you could access the directory directly -- but
then what if the NetServer admin had set the share up as read only? Or
only readable to certain users? Well, by accessing directly from the
IFS, you'd slide right past those security options and get access
anyway, since it's a local directory, not going through NetServer!
I suppose you could probably determine all of this information from APIs
and handle it appropriately. I guess I just don't see why it's worth
the amount of work. Why would you WANT your users to be able to specify
the path name, as if they were on a completely different computer, and
have the system automatically convert it? Wouldn't that be confusing to
the user?
But, sure I guess it's possible.
As an Amazon Associate we earn from qualifying purchases.