ssh from OpenSSH exits with the exit status of the remote command or with 255 if an error occurred.
ssh2 on z/OS uses these exit codes:
0: Successful completion of the command.
1: Miscellaneous errors, such as "command not found" or "invalid argument".
2: Misuse of shell builtins (bash, for example, returns 2 for "command not found").
126: Command invoked cannot execute
127: "command not found"
128: Invalid argument to exit
128+n: Fatal error signal "n"
130: Script terminated by Control-C
255*: Exit status out of range
*Exit statuses greater than 255 are used by some programs to indicate specific failure modes. For example, the ssh command returns exit status 255 if it cannot establish a connection to the server.