Name
todsn — read a stream of data from stdin and write records to a z/OS dataset
Synopsis
todsn [OPTION...]dataset-nametodsn-sock[OPTION...]dataset-nametodsn-ssh[ssh-opt...]user@host[OPTION...]dataset-nametodsn-local[OPTION...]dataset-nametodsn-vtodsn-h
Description
The todsn command writes records to
dataset-name using a stream of data
read from stdin. Dataset records are created from the input stream based
on the options provided.
The todsn command runs in one of three environments:
locally (default on z/OS sytems)
remotely, from a client-initiated ssh connection:
-sshoptionremotely, from a client which was started by Co:Z launcher:
-sock(default option on non-z/OS systems)
The user has wide flexibility in choosing:
How
dataset-nameis to be allocated/opened for writingHow records are to be created from the incoming source lines
What character set (codepage) translations are to be performed
dataset-name is automatically converted to upper
case, and is assumed to be fully qualified unless otherwise specified
(see the -r option below). If dataset-name
starts with 'DD:', then it refers to an existing DDNAME.
Options
-sockSpecifies a remote invocation of todsn from a client environment running under a Co:Z Agent. This is the default for non-z/OS environments. If specified, this must be the first command option.
-ssh[ssh-options...]user@hostSpecifies a remote invocation of todsn using a client-initiated ssh connection to the given z/OS user@host. If specified, this must be the first command option.
-localSpecifies the use of local z/OS I/O, even if run via CoZLauncher. If specified, this must be the first command option.
-aopen
dataset-namein append/mod mode. This option changes the base fopen() options toab,type=record,noseek.-bbinary flow mode, same as
-lnone-p0x00-wflow.-hdisplay help and exit.
-kkeep trailing pad characters in record. The default is to trim if
dataset-namehas fixed length records.-Kalways trim trailing pad characters.
-lline-separatorflexible|cr|lf|crlf|nl|crnlsource lines are separated by combination of linefeed and/or carriage return characters. The default is 'flexible' which allows for any of the other patterns above. These characters are taken from the source codepage.
ibmrdwsource lines are preceeded with a four byte IBM-style RDW, consisting of a two byte network order (big endian) length followed by two bytes of zeros.
mfrdwSource data is preceeded by a 128 byte MicroFocus standard header. Source lines are preceeded with a network order (big endian) length. If the maximum record length is < 4095 bytes, the length field is 2 bytes. If the maximum record length is >= 4095 bytes, the length field is 4 bytes. Each record must be padded with zeros to the nearest 4 byte boundary.
rdwsource lines are preceeded with a four byte network order (big endian) length.
0xbb[bb..]source lines are followed with a hex character sequence. The sequence must be between 1 and 8 bytes long.
nonesource lines do not have separators; source lines are determined by the maximum output record length.
-Llogging-optionsA comma-separated list of options to control logging and tracing:
M|A|C|E|W|N|I|D|TLogging threshhold: eMergency, Alert, Critical, Error, Warning, Notice, Info (default), Debug, Trace.
tPrefix log messages with a system timestamp
eInclude consumed cpu time in log messages
sMessages are logged to SYSLOG facility instead of stderr
logname=M|A|C|E|W|N|I|D|TSet a specific log name to the given threshold
-ofopen-optionsadditional mode arguments to the z/OS C library fopen() routine. The base mode options used by todsn to open
dataset-nameare "wb,type=record,noseek". See "z/OS C++ Programming Guide" for details.-p0xbbpad character. The default is the source codepage space character.
-rdataset-namewill be prefixed with the current z/OS userid.-ssource-codepageThe codepage name or numeric CCSID id of the input data. If not specified and invoked from a remote client with a line-separator other than 'none', 'ibmrdw', 'mfrdw' or 'rdw', then the default client codepage is used, otherwise the default z/OS codepage is used.
-ttarget-codepageThe codepage name or numeric CCSID id of output dataset. If not specified, then the default z/OS process codepage is used. Translation is disabled if source-codepage equals target-code- page.
-vdisplay the current version and exit.
-wwrap-optionserroran error is returned if the source line is longer than the maximum record length.
flowsource lines longer than the maximum record length are flowed across subsequent records. For fixed record formats, the pad character is used to complete the final record resulting from the source line.
truncsource lines longer than the maximum record length are truncated
wrapsource lines longer than the maximum record length are broken into multiple records. The default is 'wrap'.
-xbpxwdyn-alloc-keywordscan be specified to provide more precise control over dataset allocation than the fopen-options. These allocation options allow
dataset-nameto be created with specific space and disposition parameters, or allowdataset-nameto be created like an already existing dataset. Ifdataset-nameis 'DD:name', then this option is ignored. For a complete list of options, see the IBM manual: "Using REXX and z/OS UNIX System Services".-zallow for an empty input stream. If not specified, the default is to exit with an error and not open or write to the output dataset if the input stream is empty.
Files
todsn may obtain name matched profile information for a
dataset from either a per-user profile or a system-wide profile on the z/OS system.
For well known dataset-name patterns, profile options can be used
to significantly reduce the specification of individual options on the command line. The file format
and profile options are described in dsn_profile(5).
Examples
Local z/OS Examples
cat /home/user/myfile | todsn //MVS1.DATASET1Copies an HFS or zFS file to an MVS dataset.
cat /home/user/myfile | todsn -o 'recfm=fb,lrecl=80' //MVS1.DATASET1Copies to an MVS dataset, overriding target DCB attributes.
cat /home/user/myfile | todsn -w trunc //MVS1.DATASET1Copies to an MVS dataset, truncating long lines
cat /home/user/myfile | todsn -x shr '//MVS1.MYLIB.DATA(MEMBER1)'Copies to a PDS member, allocating with DISP=SHR.
cat /home/user/myfile | todsn -r //test.dataSpecifies a relative dataset name (HLQ will be added).
cat /home/user/ascii.txt | todsn -s iso8859-1 -r //my.datasetCopies an ASCII HFS file to an EBCDIC MVS dataset.
cat /home/user/rdw.bin | todsn -l rdw -r //my.datasetCopies a binary HFS file with RDW-prefixed lines to an MVS dataset.
Remote Client SSH Connection Examples
cat /tmp/data | todsn -ssh user@myzos2.com -r //my.datasetUploads an MVS Dataset over an SSH connection (Unix).
copy c:ata.txt con: | todsn -ssh user@myzos2.com -r //my.datasetUploads an MVS Dataset over an SSH connection (Windows).
cat /tmp/data | todsn -ssh user@myzos2.com -r '//my.pds(mem1)'Uploads a MVS PDS Member over an SSH connection (Unix).
copy c:ata.txt con: | todsn -ssh user@myzos2.com -r '//my.pds(mem1)'Upload an MVS PDS Member over an SSH connection (Windows).
cat /tmp/data | todsn -ssh -p 2222 user@myzos2.com -r '//my.pds(mem1)'Uploads an MVS Dataset with additional ssh options.