This has worked for me for years.
John
//===============================================================
p #splitPathFile...
p b export
d pi 256 varying
d pString 256 const varying
d pReturnWhat 8 const
//
// Split a full ifs path/filename into 2 pieces and return
// either path or filename based on 'ReturnWhat'.
//
// Returns..: Path - everything to the left of rightmost slash
// ..: Name - everything from the right of rightmost slash
// ie;
// Filename = #splitPathFile(pFrPathFile:'FILENAME');
// Path = #splitPathFile(pFrPathFile:'PATH' );
//===============================================================
d pos s 10i 0
d rtnval s 256 varying
pos = LastPos(pString:'/');
if pos > 0;
if pReturnWhat = 'FILENAME';
rtnval = %subst(pString :pos+1);
else;
rtnval = %subst(pString :1:pos-1);
endif;
endif;
return rtnval;
p e
<br />
The information in this email is confidential and may be legally privileged.
It is intended solely for the addressee. Access to this email by anyone else is
unauthorized. If you are not the intended recipient, any disclosure, copying,
distribution or any action taken or omitted to be taken in reliance on it, is
prohibited and may be unlawful.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.