Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.
Highlighted
SMartin_accela_com Regular Contributor.
Regular Contributor.
77 views

Efficient way to get owner id for a filename in cobol program

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

0 Likes
3 Replies
Micro Focus Frequent Contributor
Micro Focus Frequent Contributor

Re: Efficient way to get owner id for a filename in cobol program

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.

----------------------------
Claudio Contardi
Product Support Engineer, Senior
Micro Focus
0 Likes
SMartin_accela_com Regular Contributor.
Regular Contributor.

Re: Efficient way to get owner id for a filename in cobol program

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

0 Likes
neidingd Honored Contributor.
Honored Contributor.

Betreff: Efficient way to get owner id for a filename in cobol program

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

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.