Which CALL SYSTEM options affect backup restoration reliability across platforms?
0 reputation · 05 Dec 2025, 19:16 UTC
0 reputation · 05 Dec 2025, 19:16 UTC
We need to guarantee that a REXX restoration script that uses CALL SYSTEM produces the same data integrity results on IBM i, Unix, and Linux. The goal is to detect failures and verify that the restored files match the original backup.
CALL SYSTEM executes a native shell command and returns a status code, but the way the status and any command output are exposed to the REXX program varies by platform. On IBM i the command output can be captured into a REXX variable when the command is quoted, while on Unix/Linux this feature is not supported without external redirection. Additionally, option syntax for utilities such as tar, rsync, or db2 backup/restore differs, potentially causing silent corruption if the script assumes a single syntax.
Because the script relies on CALL SYSTEM to invoke the backup utility, it is unclear whether a non‑zero status will be automatically detected and whether the output can be used to confirm success across all target systems.
Which CALL SYSTEM syntax guarantees a reliable return status on IBM i, Unix, and Linux? Does capturing command output into a REXX variable on IBM i provide a mechanism that is unavailable on Unix/Linux, and how should a script handle this discrepancy? Which options or wrappers are needed to ensure that the restored data can be verified reliably regardless of platform?
29775 reputation · 05 Dec 2025, 23:23 UTC
No single CALL SYSTEM syntax guarantees identical behavior on IBM i, Unix, and Linux, because the port of CALL SYSTEM itself differs: on IBM i it routes through the system command interface and (in some REXX implementations there) quoted commands can return captured output, while on Unix/Linux it typically forks a shell and only the numeric exit status comes back. What you can guarantee everywhere is the return code — so the reliable design is: treat the exit status as the only cross-platform signal, push all output capture into shell redirection, and verify restored data with checksums computed outside the backup tool's own success message.
Confirmed by general shell behavior: a command invoked through a system-call wrapper returns the child process's exit status, and a well-behaved utility (tar, rsync, db2) exits non-zero on failure. That part is portable.
Likely, but verify on your exact interpreter: the IBM i output-capture-into-a-variable feature for quoted commands is an implementation extension, not part of portable REXX. Classic Regina and ooRexx on Unix/Linux do not capture stdout this way; output goes to the terminal unless you redirect it. Because REXX variants differ, treat any capture-on-IBM-i behavior as platform-specific and confirm it against your interpreter's documentation before depending on it — this is the piece most likely to silently change meaning when the script is ported.
Standardize on this shape on every platform:
cmd = 'tar -xf backup.tar -C /restore/dir 2>/tmp/restore.err'
rc = 0
CALL SYSTEM cmd
rc = RESULT /* or RC, depending on interpreter */
if rc <> 0 then do
say 'Restore failed, rc='rc
exit rc
endKey points:
>log 2>&1 on Unix/Linux; on IBM i, spool or file redirection appropriate to the shell you invoke). Never rely on the REXX variable-capture extension if the script must run on Unix/Linux.Exit status alone does not prove integrity — a restore can "succeed" while producing truncated or stale files. Add a verification layer that is identical on all platforms:
sha256sum -c manifest.txt; on IBM i use the equivalent available hash tool or a small script. Invoke this via a second CALL SYSTEM and check its status too.Be cautious with compression and encryption options: enable them only after confirming the same algorithm and version exist on every target platform, and confirm decryption keys are present before starting — a missing key typically aborts mid-restore, leaving a partial tree. Also test overwrite behavior in staging first: unconditional overwrite can silently replace newer files.
Which REXX interpreter (and version) is running on each platform matters — the exact name of the status variable, whether CALL SYSTEM raises an error condition, and whether IBM i output capture is available all depend on it. If you can share that, the status-check idiom above can be made exact instead of defensive.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.