Description
This component allows remote command to the AS/400.
How to use
Fill ‘Commands’ property with the commands (one command each line). Then call ‘Execute’ method.
The execute function will return the number of succeeded executed commands.
Example of use
{ Add libraries in the LIBL with TACE400Rcmd Component }
ACECmd..Commands.Clear;
ACECmd.Commands.Add(‘ADDLIBLE MYLIB1’);
ACECmd.Commands.Add(‘ADDLIBLE MYLIB2’);
If ACECmd.Execute <> 2 Then
begin
// error
end;
Properties
Commands
property Commands:TStrings;
Description
This property holds all the commands you want to send the AS/400.
Each item of this property represents a command.
NoWaitObject
property NoWaitObject:TOleControl;
Description
This property is used to link the component to an TACE5250 component.
This is useful when having an ACE5250 terminal component running in the same job than easycom.
This allows to have end notification in TACE5250 component after having used TACE400Rcmd.ExecuteNoWait.
StopOnError
property StopOnError:boolean;
Description
This property is useful only if you plan to put multiple commands in the component.
If this property is true, the component will stop processing if one command fails.
Otherwise, it will ignore all commands failing.
The number of successfully executed commands is returned by the TACE400Rcmd.Execute method.
Methods
Execute
function Execute:integer;
Description
This function executes the commands that are in Commands property. It returns the number of the commands that were successfully executed.
ExecuteNoWait
procedure ExecuteNoWait;
Description
This procedure executes the command that is in the Commands property (for this function, only one command is allowed).
It is designed to be used only in conjunction with a 5250-emulation component.
It can indeed handle interactive commands (such as WRKACTJOB).
This only can work if the 5250 terminal is working in the same job than your client/server application.
The function returns immediately without waiting command completion.
All BDE components using the TACE400Rcmd.DatabaseName are unavailable during command processing:
only the 5250 is useful there.
End notification will be sent to the 5250-emulation component by TACE5250.RcmdComplete Event.
The 5250 component that will receive notification must be linked to the TACE400Rcmd component using
TACE400Rcmd.NoWaitObject property.
Steps to follow to use this function:
- fill TACE400Rcmd.Commands with your interactive command
- point TACE400Rcmd.NoWaitObject to your TACE5250 component
- make your 5250 working in the same job (by using Easycom Protocol or by using EACHOST).
- point TACE5250.DatabaseName to the same alias than your C/S application.
- use TACE400Rcmd.ExecuteNoWait
- show your 5250 window to let the user work with it
- intercept the TACE5250.RcmdComplete Event to show again your C/S application.