Creating a PL/B Automation Component
A PL/B Automation Component can be any PL/B program that runs under the PLBWIN command. No special coding is required. In this example, we will create a component that will read an AAM file.
The program starts by opening or preparing the AAM file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The DoPrep function just creates a sample file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The program then registers an event to indicate a read request and an event to allow component termination. It then goes into a loop waiting for events.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The DoRead function will start to read the AAM file and send each record back as an event. When the OVER flag is set an event indicating no more record will be sent. Since ARG1 was assigned to Name during the EventReg statement, Name will contain the name to search for.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The DoExit function will just stop.
|
|
|
|
|
|
|
|
|
|
|
|
The entire program follows:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
See Also: Automation
![]() |