by excitom · 8y ago · 0 comments
JCL itself has a lot of warts, no denying that. But the basic idea behind the DD statement is interesting. In Unix, file descriptors are just numbers; whereas, in classic MVS, instead of numeric file descriptors the API uses 1-8 character names (DDNAMEs). While in principle a Unix program can inherit any number of file descriptors, in practice very few programs inherit any more than 0-2, because remembering numbers has poor usability. In classic MVS, it is not uncommon for a program to inherit more than 3 file descriptors, because they are assigned names not numbers. ("File descriptors" and "inherit" are not quite the right terms, but trying to use Unix-like language to make it comprehensible to people.)
(And I say classic MVS, because contemporary z/OS is actually a conforming Unix implementation so it supports numeric file descriptors in the Unix API, as well as alphanumeric DDNAMEs in the classic MVS API.)
Unix Programmer: "Huh? Why did you comment out the entire program, except for that one function?"
Mainframe Programmer: What? No, those are JCL statement lines."
Unix Programmer: "..."
$ tldr dd
dd
Convert and copy a file.
- Make a bootable usb drive from an isohybrid file (such like archlinux-xxx .iso):
dd if=file.iso of=/dev/usb_drive
- Clone a drive to another drive with 4MB block and ignore error: dd if=/dev/source_drive of=/dev/dest_drive bs=4m conv=noerror
- Generate a file of 100 random bytes by using kernel random driver: dd if=/dev/urandom of=random_file bs=100 count=1
- Benchmark the write performance of a disk: dd if=/dev/zero of=file_1GB bs=1024 count=1000000
[0]: https://github.com/tldr-pages/tldr