Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to access windows pipes in cobol

Status
Not open for further replies.

tonyc1

Programmer
Jan 10, 2002
16
GB
Can anyone please tell me how to access a named windows pipe using cobol 97?
I think i need to use API but don't really understand how. I have examples from fujitsu of API and I think I need to link kernel32.lib in somehow but the rest is a mystery!
Thanks
 
Hello Tony

Can you more detailed about your problems?
I know how to use API call with Powercobol and the same way can be applied using Cobol 97.

Let me Know

Gianni
alias Tromba
 
Thank you for replying. I've made some progress. It seems that when trying to call "CallNamedPipe" (from Kernel32.lib) I didn't have the right amount of parameters and it would not let me link the program. Now if anyone knows what I should be putting in for the parameters of "CallNamedPipe" that might help me get further!
thanks
Tony
 
Hello Tony

Take care using Api calls.
There are few things you have to know before use any Api calls.
First of all, search on the "Kernel32.lib" file with a normal text editor like Notepad, for the word (function) you want to use: "CallNamedPipe".
Normally, an Api call can be made in Ascii mode.
Seeing the result editing, we found that the "CallNamedPipe" has an "A" suffix at end of its name.
This could means the call must be done in Ascii mode like:

CALL "CallNamedPipeA" WITH STDCALL LINKAGE
USING by value parm1
by value parm2
by value parm2

Of course, the "Kernel.lib" file must be included on the project as an external resource.
Each of these "parm" fields must be defined PIC S9(9) COMP-5.
The value "28" you will find searching on the "Kernel32.lib", means that the call need 3 parameters passed from the caller and each parm must be declared as a long field (S9(9) COMP-5).

An advice: you can download a good api reference from This guide offers a variety of the best and used api calls as in Vb and, of course, you can use them also with Fujitsu cobol or Powercobol.

Let me know if this hints help you.

Regards
Gianni
 
This is the complete Vb declaration:

Declare Function CallNamedPipe Lib "kernel32" Alias "CallNamedPipeA" (ByVal lpNamedPipeName As String, lpInBuffer As Any, ByVal nInBufferSize As Long, lpOutBuffer As Any, ByVal nOutBufferSize As Long, lpBytesRead As Long, ByVal nTimeOut As Long) As Long

Note that the "string" must be declared on cobol BY REFERENCE and each "long" field must be PIC S9(9) COMP-5.

About the type "Any", you can use string or numeric fields.


Gianni
 
Thanks again for all your help. I will look at all the info you have mentioned.
Once again thank you and I'm very grateful
Tony
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top