Skip to main content

For security, want to retrieve files from a directory by owner ID (%username%)

For security, want to retrieve files from a directory by owner ID (%username%)

Good morning.

Have you tried with:

ACCEPT TERMINAL-ABILITIES FROM TERMINAL-INFO
ACCEPT SYSTEM-INFORMATION FROM SYSTEM-INFO

 See Format 3 (ACCEPT FROM), Steps 7 and 8.

 You will obtain useful information, either you are executing your program locally (wrun32.exe/runcbl) or via Thin Client.

If you want to inquire information about the files themselves, you can use C$FILEINFO, or CALL a Windows API such as KERNEL32.DLL and use one of its modules.


Good morning.

Have you tried with:

ACCEPT TERMINAL-ABILITIES FROM TERMINAL-INFO
ACCEPT SYSTEM-INFORMATION FROM SYSTEM-INFO

 See Format 3 (ACCEPT FROM), Steps 7 and 8.

 You will obtain useful information, either you are executing your program locally (wrun32.exe/runcbl) or via Thin Client.

If you want to inquire information about the files themselves, you can use C$FILEINFO, or CALL a Windows API such as KERNEL32.DLL and use one of its modules.

C$fileinfo would be good except returns only date time and file size, I believe.

Not familiar with calling api's in a cobol application


For security, want to retrieve files from a directory by owner ID (%username%)

Hi,

i would use WMI.
It is easy to use with cobol as OLE Programming.. like accessing word, excel and so on.
i also have a example here in the forum how i do a ping with wmi in cobol.

TO use WMI u need to create a .def File with AXDEFGEN.
The needed object is for WMI then the @WbemScripting

The next i would use this Example https://devblogs.microsoft.com/scripting/how-can-i-determine-the-owner-of-a-file/ to convert it to a cobol code.

Greetings
David


Hi,

i would use WMI.
It is easy to use with cobol as OLE Programming.. like accessing word, excel and so on.
i also have a example here in the forum how i do a ping with wmi in cobol.

TO use WMI u need to create a .def File with AXDEFGEN.
The needed object is for WMI then the @WbemScripting

The next i would use this Example https://devblogs.microsoft.com/scripting/how-can-i-determine-the-owner-of-a-file/ to convert it to a cobol code.

Greetings
David

I would probably use C$SYSTEM and run an operating system command:

Windows: DIR /Q *.* >mytempfile

Unix: ls -l * >mytempfile

Then read in the text file "mytempfile".  Extract the user id from the line and choose to use it or read next.  Then after I close that temporary file, I use the "DELETE FILE" command.