How can I convince z/OS scp to transfer binary files?
You can use one of the other SSH-based tools such as sftp
.
Whereas scp
will let you transfer a file (with automatic authentication set up) with something like:
scp -i ident_file zos_file linux_user@linux_box:linux_file
you can do a similar thing with the secure FTP:
sftp IdentityFile=ident_file -b - linux_user@linux_box <<EOF
binary
put zos_file linux_file
EOF
equivalent of ftp put and append in scp
Put is just the normal scp
scp /path/to/source user@host:/path/to/target
Append only works with a little hack (and not with scp directly)
cat source | ssh user@host "cat >> /path/to/target"
Merging EBCDIC converted files and pdf files into a single file and pushing to mainframes
File merging could easily be achieved by using Cat command in unix with > and >> append operators.
Also, if the next file should start from a new line (as was my case) a blank echo could be inserted between files.
How can I determine which security manager is active on z/OS using Java?
You can use the IBM JZOS package to peek at memory as follows. For production code, I would create an enumeration for the security managers and rather than pass strings around and have to deal with string comparisons.
import com.ibm.jzos.ZUtil;
/**
* This is a sample program that uses IBM JZOS to determine
* the Enterprise Security Manager that is active on a z/OS
* system.
* <p>
* @see com.ibm.jzos.ZUtil#peekOSMemory(long, int)
* @see com.ibm.jzos.ZUtil#peekOSMemory(long, byte[])
*/
public class peek {
public static void main(String[] args) throws Exception {
byte[] rcvtIdBytes = new byte[4];
long pPSA = 0L;
int psaOffsetCVT = 16;
long pCVT = ZUtil.peekOSMemory(pPSA + psaOffsetCVT, 4); // Get address of CVT from PSA+16
int cvtOffsetCVTRAC = 0x3e0; // Offset of CVTRAC (@RCVT) in the CVT
long pCVTRAC =
ZUtil.peekOSMemory(pCVT + cvtOffsetCVTRAC, 4); // Get the address of CVTRAC (Mapped by ICHPRCVT)
// Now we can retrieve the 4 byte ID (in IBM-1047) of the active ESM.
int cvtracOffsetRCVTID = 0x45; // Offset of RCVTID in the RCVT
ZUtil.peekOSMemory(pCVTRAC + cvtracOffsetRCVTID, rcvtIdBytes); // Get the RCVTID
String rcvtId = new String(rcvtIdBytes, "IBM-1047");
System.out.println("The Security Manager is: "+rcvtId);
}
}
Related Topics
Change a String in a File with Sed
Linux: Find a List of Files in a Dictionary Recursively
How to Avoid Having Version Numbers in .So File Name
Webdrivererror Error: Chrome Failed to Start: Exited Abnormally
Write and Read from Ttyusb0, Can't Get Response
Linux - Modify File Modify/Access/Change Time
Why Are Both "True" and "False" Tests True
I Would Like to Store All Command-Line Arguments to a Bash Script into a Single Variable
Git Post-Receive Checkout to Remote Machine
Ubuntu/Fedora: How to Add Applications in The Menus
How to Create Ansible Playbook to Obtain Os Versions of The Remote Hosts
Why Does Wget Output to Stderr Rather Than Stdout
Gui Svn Client for Debian Linux