× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



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.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.