Calling UNIX scripts from SQR

It often requires us to invoke OS commands from within an SQR. Today we will see how to use the call system command from within the SQR to invoke a UNIX script.

Call System Command

SQR provides the Call System command to issue commands to the underlying OS. The OS then returns a status indicating if the execution of the command that was issued was successful or not. This is how the Call System command is used.

Call System using $cmd_string #status

In the above statement, $cmd_string is contains the command that would be issued to the OS. It’s up to you to decide what needs to be written in the script, the choices are unlimited! The status that the OS returns will be received in #status. On successful execution, the status returned would be 0. This can be used to confirm if the command issued was successful or not.

Another way of doing this would be to hard code the value of the command directly within the Call System command. This would be less flexible though.

Call System using 'rm abcd.lis' #status
Tags: , ,
Leave a Reply

Your email address will not be published. Required fields are marked *