Vern,

I must have missed that. However, I'm using this inside a "do loop" that's reading directory contents.

Using the prototypes from Scott's IFSIO_H.
FN=Filename (without the path)

dcl-pi Ifs_ClrDir int(10);
inDir varchar(1024) const;
inMask varchar(20) const options(*nopass);
end-pi;

dcl-s rc int(10);
dcl-ds entry based(p_entry) likeds(dirent);
dcl-s dh pointer;
dcl-s fn char(128);
dcl-s Stmf varchar(512);
dcl-s fldr varchar(1024);
dcl-ds mystat likeds(statds);
dcl-s fileMask ind inz(*off);

fldr = %trim(inDir);
dh = opendir(fldr); // Open a directory
if dh = *null;
return -1;
endif;

dou p_entry = *null;
p_entry = readdir(dh); // Read a directory entry

if (p_entry = *null); // if not end of entries...
iter;
endif;

fn = %subst(entry.d_name:1:entry.d_namelen); // Filename

if fn = '.' or // skip . and ..
fn = '..';
iter;
endif;

Stmf = %trim(fldr) + '/' + %trim(fn);

rc = stat(%trim(Stmf): mystat);
if rc < 0; // Move on to next file
iter;
endif;

if %subst(mystat.st_objtype:1:4) = '*DIR'; // Skip folders
iter;
endif;

if fileMask;
if %scan(inMask:fn) = 0;
iter;
endif;
endif;

rc = unlink(%trim(Stmf));

enddo;

closedir(dh); // Close Directory



From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Vern Hamberg via MIDRANGE-L
Sent: Friday, May 8, 2026 2:28 PM
To: midrange-l@xxxxxxxxxxxxxxxxxx
Cc: Vern Hamberg <vhamberg@xxxxxxxxxxxxxxx>
Subject: Re: [EXTERNAL] How to check if exist in IFS (QTNC) a file

EXTERNAL EMAIL - This email was sent by a person from outside your organization. Exercise caution when clicking links, opening attachments or taking further action, before validating its authenticity.
Secured by Check Point

Hi Greg

It's been awhile - does stat allow wildcards in the name? The OP asked
about using a partial name. Maybe it'd require something to get a list
with the partial name, then use stat or access on each.

*Regards*

*Vern Hamberg*

IBM Champion 2025 <cid:part1.fSO0xgOG.8u7Q0fzh@centurylink.net> CAAC
(COMMON Americas Advisory Council) IBM Influencer 2023


On 5/8/2026 8:52 AM, Greg Wilburn wrote:
I use stat() to check for file size.

rc = stat(%trim(inStmf):mystat);
if rc < 0;
return rc;
endif;

Less than 0 is not found.

From: MIDRANGE-L<midrange-l-bounces@xxxxxxxxxxxxxxxxxx<mailto:midrange-l-bounces@xxxxxxxxxxxxxxxxxx>> On Behalf Of gio.cot via MIDRANGE-L
Sent: Friday, May 8, 2026 6:31 AM
To: 'Midrange Systems Technical Discussion'<midrange-l@xxxxxxxxxxxxxxxxxx<mailto:midrange-l@xxxxxxxxxxxxxxxxxx>>
Cc: gio.cot<gio.cot@xxxxxxxxxxx<mailto:gio.cot@xxxxxxxxxxx>>
Subject: [EXTERNAL] How to check if exist in IFS (QTNC) a file

EXTERNAL EMAIL - This email was sent by a person from outside your organization. Exercise caution when clicking links, opening attachments or taking further action, before validating its authenticity.
Secured by Check Point

Hi all



I would need to check in a windows server (mapped via QTNC), if exist a file
with partial name;

example: if i run "DSPLNK
OBJ('/qntc/zz-yy-appxx/XT/DOCS/TX/ORDERS/HIST/myfile_26_90501*') , i can
see that in the folder exist a file named "myfile_26_90501_11052026.txt"

can i do with clp or rpg run a command to check existance passing the file
partial name ?

usually i use extproc('access') File_Exists = access(pathptr:F_OK)

Thanks in advance

Gio

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email:MIDRANGE-L@xxxxxxxxxxxxxxxxxx<mailto:MIDRANGE-L@xxxxxxxxxxxxxxxxxx>
To subscribe, unsubscribe, or change list options,
visit:https://protect.checkpoint.com/v2/r01/___https://lists.midrange.com/mailman/listinfo/midrange-l___.YzJ1OnRvdGFsYml6ZnVsZmlsbG1lbnQxOmM6bzplNTAzOTY2ODA3ZmIxZDM4MjM3MjNlMWMzMWExNDczMTo3OjQzNDg6MDBlOGNiMGI4MzFlNWFmNGIzMjA4YTI5YTA2MTczYmFlODVlOGU2MDVkY2JmNTk4ZmUzOTk3MDQzY2MxZWUxYzpwOlQ6Rg<https://protect.checkpoint.com/v2/r01/___https:/lists.midrange.com/mailman/listinfo/midrange-l___.YzJ1OnRvdGFsYml6ZnVsZmlsbG1lbnQxOmM6bzplNTAzOTY2ODA3ZmIxZDM4MjM3MjNlMWMzMWExNDczMTo3OjQzNDg6MDBlOGNiMGI4MzFlNWFmNGIzMjA4YTI5YTA2MTczYmFlODVlOGU2MDVkY2JmNTk4ZmUzOTk3MDQzY2MxZWUxYzpwOlQ6Rg>
or email:MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx<mailto:MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx>
Before posting, please take a moment to review the archives
athttps://protect.checkpoint.com/v2/r01/___https://archive.midrange.com/midrange-l___.YzJ1OnRvdGFsYml6ZnVsZmlsbG1lbnQxOmM6bzplNTAzOTY2ODA3ZmIxZDM4MjM3MjNlMWMzMWExNDczMTo3OjY1Y2Y6OTU0MjE5ZTI3MjIwNDU2OWQwNzc3YWRjZDU5M2M3NTNjYTk3MGE3ZTc3ZDcxZDZlYTdlMWI4ZjYyNTczZGY3YzpwOlQ6Rg<https://protect.checkpoint.com/v2/r01/___https:/archive.midrange.com/midrange-l___.YzJ1OnRvdGFsYml6ZnVsZmlsbG1lbnQxOmM6bzplNTAzOTY2ODA3ZmIxZDM4MjM3MjNlMWMzMWExNDczMTo3OjY1Y2Y6OTU0MjE5ZTI3MjIwNDU2OWQwNzc3YWRjZDU5M2M3NTNjYTk3MGE3ZTc3ZDcxZDZlYTdlMWI4ZjYyNTczZGY3YzpwOlQ6Rg>.

Please contactsupport@xxxxxxxxxxxxxxxxxxxx<mailto:support@xxxxxxxxxxxxxxxxxxxx<mailto:contactsupport@xxxxxxxxxxxxxxxxxxxx%3cmailto:support@xxxxxxxxxxxxxxxxxxxx>> for any subscription related questions.

[CAUTION! This email originated outside of the organization. Please do not open attachments or click links from an unknown or suspicious origin.]


Greg Wilburn
Director of IT
301.895.3792 ext. 1231
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx<mailto:MIDRANGE-L@xxxxxxxxxxxxxxxxxx>
To subscribe, unsubscribe, or change list options,
visit: https://protect.checkpoint.com/v2/r01/___https://lists.midrange.com/mailman/listinfo/midrange-l___.YzJ1OnRvdGFsYml6ZnVsZmlsbG1lbnQxOmM6bzo1NzYzNTYyYWIyMmUyOTViMDkxNTdiYjc0YTlhYTg4ODo3OmY1MTU6YzAxYmExZDM2MmI3Zjc2YTU5Yjg5NTM3OWFhOGE1ODE5MjAzNzhiYWNlNzA4NjVkN2Y0YTk5ZTU3NDhlNzdlNDpwOlQ6Rg<https://protect.checkpoint.com/v2/r01/___https:/lists.midrange.com/mailman/listinfo/midrange-l___.YzJ1OnRvdGFsYml6ZnVsZmlsbG1lbnQxOmM6bzo1NzYzNTYyYWIyMmUyOTViMDkxNTdiYjc0YTlhYTg4ODo3OmY1MTU6YzAxYmExZDM2MmI3Zjc2YTU5Yjg5NTM3OWFhOGE1ODE5MjAzNzhiYWNlNzA4NjVkN2Y0YTk5ZTU3NDhlNzdlNDpwOlQ6Rg>
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx<mailto:MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx>
Before posting, please take a moment to review the archives
at https://protect.checkpoint.com/v2/r01/___https://archive.midrange.com/midrange-l___.YzJ1OnRvdGFsYml6ZnVsZmlsbG1lbnQxOmM6bzo1NzYzNTYyYWIyMmUyOTViMDkxNTdiYjc0YTlhYTg4ODo3OmE1ZTY6YmEwMThiY2VlZjQzZThmMjcyNzE4MTFkMWU1ZTIyMWExODcyMDM1MjU5ZjY2ZGM5ZThlYmZlMWZiZWQ5MjBlMjpwOlQ6Rg<https://protect.checkpoint.com/v2/r01/___https:/archive.midrange.com/midrange-l___.YzJ1OnRvdGFsYml6ZnVsZmlsbG1lbnQxOmM6bzo1NzYzNTYyYWIyMmUyOTViMDkxNTdiYjc0YTlhYTg4ODo3OmE1ZTY6YmEwMThiY2VlZjQzZThmMjcyNzE4MTFkMWU1ZTIyMWExODcyMDM1MjU5ZjY2ZGM5ZThlYmZlMWZiZWQ5MjBlMjpwOlQ6Rg>.

Please contact support@xxxxxxxxxxxxxxxxxxxx<mailto:support@xxxxxxxxxxxxxxxxxxxx> for any subscription related questions.

Greg Wilburn
Director of IT
301.895.3792 ext. 1231

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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

This mailing list archive is Copyright 1997-2026 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.