Wednesday, April 4, 2012

File DELETE in SQR


Using the CALL SYSTEM, any OS commands can be executed from SQRs. 
CALL SYSTEM Using $del_file #del_status Wait 
if edit(#del_status,’9′) = ‘0′
show ‘intfiles.txt was deleted sucessfully’
end-if

$del_file – Specifies the operating system command to execute. The command can be a quoted string, string variable, or column.

#del_status – Represents the status of execution of OS Command. This is always going to be Numeric variable
UNIX/Linux: Zero (0) indicates success. Any other value is the system error code.
PC/ Microsoft Windows: A value less than 32 indicates an error.

Wait – This flag is used to enable to do multitask processing.
(Microsoft Windows only): WAIT specifies that SQR suspend its execution until the CALL SYSTEM command has finished processing. NOWAIT specifies that SQR start the CALL SYSTEM command but continue its own processing while that command is in progress.

For Microsoft Windows, the default is NOWAIT. On UNIX\Linux operating systems the behavior is always WAIT.

** Please note delete command needs to be built dynamically in $del_file above based on your process scheduler OS environment.

No comments:

Post a Comment