fromdsn — write the contents of a z/OS dataset to stdout


fromdsn [OPTION...] dataset-name
fromdsn -ssh [ssh-opt...] [user]@host [OPTION...] dataset-name
fromdsn -local [OPTION...] dataset-name
fromdsn -v
fromdsn -h


The fromdsn command reads a z/OS MVS dataset and writes a stream of data to stdout. Lines (if requested) are produced from dataset records based on the options provided.

The fromdsn command runs in one of three environments:

  • locally (default on z/OS sytems)

  • remotely, from a client which was started by Co:Z launcher.

  • remotely, from a client that started a durable session to the server using the cozcontrol command.

  • remotely, from a client-initiated ssh connection: -ssh option

The user has wide flexibility in choosing:

  • How dataset-name is to be allocated/opened for writing

  • How 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.

The fromdsn command also supports reading JES spool files using special dataset-name syntax:

  • -JES.jobid - reads the concatenated spool files for a given job. The -S option may be specified to indicate that SYSIN spool files should be included.

  • -JES.jobid.dsid - reads a specific spool file by numerid dsid.

  • -JES.jobid.[stepname[.procstep]ddame - reads the first spool file in a job that matches a step/procstep/ddname. This form may also be used to retrieve SYSIN spool files. When reading -JES.jobid.JESJCLIN, the output will include not only JCL card images, but also embedded SYSIN spool files.


-ssh [ssh-options...] [user]@host

Specifies a remote invocation of fromdsn using a client-initiated ssh connection to the given z/OS user@host. If specified, this must be the first command option.


Specifies the use of local z/OS I/O, even if run via CoZLauncher. Applicable when the source and target are both z/OS. If specified, this must be the first command option.


binary mode, same as -l none -p 0x00.


display help and exit.


keep trailing pad characters in record. The default is to trim if dataset-name has fixed length records.


always trim trailing pad characters, even if the dataset contains variable-length records.

-l line-separator

nl | cr | lf | crlf | crnl

follow lines with a newline, carriage return, linefeed, or combination. The characters are taken from the target codepage. The default is nl.


preceed lines with a four byte IBM-style RDW, consisting of a two byte network order (big endian) length, followed by two bytes of zeros.


preceed lines with a four byte network order (big endian) length of the record that follows. Note: Unlike the rdw option, this length value does not include the size of the length field.


Write a 128 byte MicroFocus standard header prior to output data. Preceed each line 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 line is padded with zeros to the nearest 4 byte boundary.


follow lines with a hex character sequence. The sequence must be between 1 and 8 bytes long.


no line separator

-L logging-options

A comma-separated list of options to control logging and tracing.

M | A | C | E | W | N | I | D | T | F

Logging threshhold: eMergency, Alert, Critical, Error, Warning, Notice (default), Info, Debug, Trace, Fine.


Prefix log messages with a system timestamp


Include consumed cpu time in log messages


Messages are logged to filename on the server instead of stderr. If not fully qualified, the file is written to the user's home directory on the server.


Messages are logged to SYSLOG facility instead of stderr


Set the logging threshold for a specific component. Specify only at the request of product support personnel.

-o fopen-options

additional mode arguments to the z/OS C library fopen() routine. The base mode options used by fromdsn to open dataset-name are rb,type=record,noseek". See "z/OS C++ Programming Guide" for details.

-p 0xbb

pad character.

-q technique-str

Codepage conversion technique string. Used to override the default Unicode Services value of LMREC. For more information, see IBM's Unicode Services User's Guide and Reference (SA22-7649).


dataset-name will be prefixed with the current z/OS userid.

-s source-codepage

The codepage name or numeric CCSID id of the input dataset. If not specified, then the default z/OS process codepage is used.


This option may be specified when reading the concatenated spool files for a JES job ('-JES.jobid') to specify that the SYSIN spool files should also be included. This feature is only available on z/OS 1.10 or later.

-t target-codepage

The codepage name or numeric CCSID id of data written to stdout. If not specified and invoked from a remote client with a line- separater other than 'none', 'rdw' or 'mfrdw', then the default client codepage is used, otherwise the default z/OS code- page is used. Translation is disabled if source-codepage equals target-codepage.

-T STANDARD | translate_table_dsname

Specifies the translate table to use for text mode transfers. This option overrides the -s -t -q options if also given. If STANDARD, the translate table TCPIP.STANDARD.TCPXLBIN is used. If a dataset name is supplied, it is expected to be in the format produced by the TSO CONVXLAT command. Only single byte translations are supported. Specifically, the dataset DCB must be LRECL=256,RECFM=F and contain two translation table records. The first record is an ASCII-to-EBCDIC mapping; the second record is an EBCDIC-to-ASCII mapping. Additional comment records (starting with * in the first column) are allowed.


display the current version and exit.

-x bpxwdyn-alloc-keywords

can be specified to provide more precise control over the disposition of dataset-name than the fopen-options. For example, opening a dataset with fopen forces a disposition of 'OLD'. This may not always be desirable in a shared batch environment. The bpxwdyn keywords enable different dispostions to be specified (e.g 'SHR'). If dataset-name is '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".


fromdsn 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).


Local z/OS Examples

fromdsn > /home/user/member1

Copies an MVS dataset (PDS member) to an HFS/zFS file.

fromdsn -x shr mvs1.input.dataset > /home/user/mydata

Copies an MVS dataset using DISP=SHR.

fromdsn mvs1.input.dataset | todsn mvs1.output.dataset

Copies one MVS dataset to another

fromdsn -jes.job123 > job.out

Copies all output from a job to an HFS/zFS file

fromdsn > report.txt

Copies the output from a job's spool file to an HFS/zFS file

Remote Client SSH Connection Examples

fromdsn -ssh //mvs1.input.dataset > /tmp/data

Downloads an MVS dataset over an SSH connection (Unix).

fromdsn -ssh -p 2222 -l rdw -r //binary.dataset > /tmp/

Downloads a MVS dataset over an SSH connection with addtional ssh options: (the dataset contains binary records which are prefixed with RDWs)

See Also


Saint Charles, Missouri
+1 636.300.0901

Copyright© 2009 - 2022 Dovetailed Technologies, LLC. All rights reserved. Co:Z® is a registered trademark and Co:Z Toolkit™ is a trademark of Dovetailed Technologies, LLC.

Saint Charles, Missouri
+1 636.300.0901

Copyright© 2009 - 2022 Dovetailed Technologies, LLC. All rights reserved. Co:Z® is a registered trademark and Co:Z Toolkit™ is a trademark of Dovetailed Technologies, LLC.