Progress
External Program
Interfaces
Coding the 4GL Program
The 4GL program:
- Assumes that the C program creates and connects the named pipe.
- Refers to the named pipe using the name the C program specifies.
- Uses the INPUT FROM statement to read the named pipe.
- Uses the OUTPUT TO statements to write the named pipe.
- Uses the INPUT CLOSE and OUTPUT CLOSE statements to close the named pipe.
The following 4GL program demonstrates reading and writing a Windows NT named pipe "custpipe:"
- The program defines three buttons, labeled “Write to Pipe,” “Read from Pipe,” and “Quit.”
- The program defines a form to contain the buttons.
- The program defines a trigger for the Write to Pipe button. The trigger redirects output to named pipe custpipe, displays (to named pipe custpipe) the name of each customer in the Sports database, and closes the named pipe.
In an OUTPUT TO statement,
\\.
means the current machine. To communicate with remote machine “pcdev68,” for example, use\\pcdev68
. This follows Uniform Naming Conventions (UNC).The OUTPUT TO statement uses the APPEND option, which causes Progress to open the named pipe without first creating it. This is necessary because Progress 4GL cannot create named pipes.
- The program defines a trigger for the Read to Pipe button. The trigger defines an integer data item, reads named pipe custpipe, assigns the value read (a customer number) to the integer data item, closes the named pipe, retrieves the row of the customer table with the specified customer number, and displays the columns of the row.
The INPUT FROM statement assumes that the pipe exists and that another process writes to it. The INPUT FROM statement blocks until the other process writes to the named pipe.
- The program defines a trigger for the Quit button.
- The program enables all objects in the frame and waits on a close event.
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |