Sam,
We had a similar situation when we used poi or jar to write to the IFS.
Every so often something would try to create a dir or file containing
characters that made qlansrv unhappy so I added a couple of routines to a
utility service program that was automatically pulled into the compile via a
binding directory. Not fancy but it works from RPG or CL.
JK
cleanpath = FixBadPathName(%trim( oldpath ));
cleanfile = FixBadFileName(%trim( oldfile ));
DBadFile C '/\:*?"<>|$'
DOKFile C '__________'
DBadPath C '\:*?"<>|$'
DOKPath C '_________'
*==============================================================
* Name...: FixBadFileName
* Purpose: Replace invalid chars in file name
* Returns: corrected string
* Params.:
* String : (input) String to correct
* Log....:
* 28Jun05 JEK- Created
*---------------------------------------------------------------
P FixBadFileName...
P B export
D FixBadFileName...
D PI 256 Varying
D String 256 Varying const
D w_String S 256
/free
w_String = %xlate (BadFile: OKFile: String);
Return w_String;
/end-free
P FixBadFileName...
P E
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Lennon_s_j@xxxxxxxxxxx
Sent: Thursday, January 28, 2010 6:36 PM
To: midrange-l@xxxxxxxxxxxx
Subject: Re: Verify IFS Path & File name string is valid
I want to be sure that if the called program tries to create a file with
the path and file name that it won't fail. The resultant file will be a
PDF that will be redisplayed in a browser using a .NET app. Thus I have
the feeling that there are certain characters that can't be used, for
example ?, :, <, >.
Sam
On 1/28/2010 7:17 PM, Scott Klement wrote:
Do you mean "valid" in the general sense of "it's physically possible to
create a path with this name" or do you mean "valid" in the sense of "my
boss will allow us to utilize names like this" or do you mean "valid" in
the sense of "points to a directory that already exists"?
Or what do you mean?
If you mean in the most general sense -- I don't think there's any
possible character string that's not a valid path name.
On 1/28/2010 4:10 PM, Lennon_s_j@xxxxxxxxxxx wrote:
An RPG program will be building an IFS path and file name string and
will pass it to another program to create the file. Is there an easy,
or any, way to verify that we have built a valid path and file name?
Thanks, Sam
As an Amazon Associate we earn from qualifying purchases.