Highlighted
Absent Member.
Absent Member.
1248 views

[archive] C$Fileinfo

[Migrated content. Thread originally posted on 30 September 2005]

Hello everyone,
I'm woandering about can I do a lookalike C$FILEINFO in a thin client environment. I mean C$FILEINFO doesen't support the
@[DISPLAY]: notation, so in if I've to check the presence of a certain file on a client path, I've to launch a C$SYSTEM with
csys-desktop attribute setted and the redirect it'output into a text file to parse. Not much handy and really slow.
Has someone an alternative idea to work it out?
Thanks In Advance and have a nice day, Giovanni
0 Likes
9 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] C$Fileinfo

You can use DLLs with Thin Client. The Windows API provides functions FindFirstFile etc...

They provide the same information.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] C$Fileinfo

Hi Gisle,
I implemented the use of FindFirstFileA as You described in search.cbl example, and it works, but with some differences:
if the file I wanna check doesn't exists it returns a > 1 handle and I've to chech the WIN-FILE-NAME being or not = low-values to understand if the file really exists or not. Do you have an explanation for this?
bye giovanni
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] C$Fileinfo

Sounds like the datatype is incorrect, or... May you show me the working storage description?
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] C$Fileinfo

Hi, here's my working-storage:

******-----------------------------------------------------------------------
01 util-finfo.
02 uf-dati.
04 uf-file.
05 uf-file-name pic x(256).
05 uf-file-location pic x(01).
04 uf-file-info.
05 uf-file-size pic x(08) comp-x.
05 uf-file-date pic 9(08) comp-x.
05 uf-file-time pic 9(08) comp-x.
04 uf-status pic 9(08).
04 uf-esito pic x(01).
02 uf-dati-w.
04 uf-w-file-name pic x(256).

78 k-w32-max-str value 260.
*
01 u-w32-file-name pic x(k-w32-max-str) value space.
01 u-w32-file-handle usage handle.
*
01 u-w32-file-data.
04 u-w32-dwFileAttributes usage unsigned-long.
04 u-w32-ftCreationTime.
06 u-w32-ftCreationTime-dwLow usage unsigned-long.
06 u-w32-ftCreationTime-dwHigh usage unsigned-long.
04 u-w32-ftLastAccessTime.
06 u-w32-ftLastAccessTime-dwLow usage unsigned-long.
06 u-w32-ftLastAccessTime-dwHigh usage unsigned-long.
04 u-w32-ftLastWriteTime.
06 u-w32-ftLastWriteTime-dwLow usage unsigned-long.
06 u-w32-ftLastWriteTime-dwHigh usage unsigned-long.
04 u-w32-nFileSize.
06 u-w32-nFileSizeHigh usage unsigned-long.
06 u-w32-nFileSizeLow usage unsigned-long.
04 u-w32-dwReserved0 usage unsigned-long.
04 u-w32-dwReserved1 usage unsigned-long.
04 u-w32-cFileName pic x(k-w32-max-str).
04 u-w32-cAlternateFileName pic x(13).

******--------------------------------------------------------------------------
and here's the procedure:
******-------------------------------------------------------------------------
call-finfo-thin-client.
initialize util-cdll
initialize u-w32-file-name u-w32-file-data
move null to u-w32-file-handle
move null to u-w32-file-name
string uf-file-name delimited " "
low-values delimited size into u-w32-file-name
move null to u-w32-cFileName
move null to u-w32-cAlternateFileName
move "kernel32.dll" to u-cdll-dll-name
move "FindFirstFileA" to u-cdll-dll-function

perform call-dll-load

call u-cdll-w-dll-function
using by reference u-w32-file-name,
by reference u-w32-file-data
returning u-w32-file-handle
on overflow
*display overflow warning
end-call

if (u-w32-cFileName > 1)
if (u-w32-cFileName <> low-values)
move k-yes to uf-esito
end-if
end-if
perform call-dll-unload
.

******-------------------------------------------------------------------------
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] C$Fileinfo

The problem lies in your data types.
Remember, COBOL datatypes are designed to be portable, thus, they are not compatible with native OS datatypes, be it Windows or Unix.

Attached you will find the sample from the Advanced Windows training. This should get you going.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] C$Fileinfo

Hi Gisle, you're right:
1st problem:
there was an error in code I posted:
if (u-w32-cFileName > 1)
if (u-w32-cFileName <> low-values)
move k-yes to uf-esito
end-if
end-if
must be:
if (u-w32-file-handle <> k-w32-invalid-handle)
if (u-w32-cFileName <> low-values)
move k-yes to uf-esito
end-if
end-if
2nd problem, in data type, must be:
78 k-w32-invalid-handle value 4294967295.
and not = 1.
ThakU as always, have a nice evening! Giovanni.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] C$Fileinfo

I am using the sample pretty much as provided for this and after getting a good call to kernel32.dll

SET ENVIRONMENT "DLL_CONVENTION" TO "1"
CALL "@[DISPLAY]:kernel32.dll"
on exception go to dll-load-error.

I am still getting a program missing or inaccessible error when calling FindFirstFileA.

string "C:\ssoft800.kbd"
low-values
delimited by size into tmp-string.

call "FindFirstFileA" using
by reference tmp-string
by reference win32-find-data
giving ff-search-handle.

I have set CODE_CASE to 0 in my cobol config, but that is default anyway.

The only catch is that our system is installed on Unix but our run time is in Windows. I am on XP.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] C$Fileinfo

Sorry, someone in my office was able to figure this out. We need to use
"@[DISPLAY]:callName", I thought I'd post this incase it helps anyone else out who is running thin client.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] C$Fileinfo

Hi, sorry for the late answer I was out of office for some days: yours office mate was right: if you load a local (clinet side) DLL with @[DISPLAY] you've to use @[DISPLAY] notation to acces dll functions too.
one Note: from Acu version 8.0, C$Fileinfo supports @[DISPLAY] notation so if you need to get file infos on client side you can use it instead of using WinApi calls.
bye Giovanni
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.