Data Sets, Unix Files, and Character Encoding
Part Two - Challenge #09


You will learn about the flexibility of z/OS applied to MVS Data Sets, Unix Files, EBCDIC, and ASCII

z/OS grandfather operating system was MVS. MVS included a variety of record oriented Data Set organizations.

Data Sets are written, read, and updated by MVS.

Unix is a base component of z/OS. Unix stores streams of bytes in Files in Unix Filesystems.

Files are written, read, and updated by Unix.

z/OS is a powerful combination of MVS and Unix which includes MVS Data Sets and Unix Files. z/OS software and business applications can use MVS Data Sets and Unix Files simulaneously or interchangebly.

The previous challenge exposed you to binary, hexadecimal, and character encoding standards, such as EBCDIC and ASCII.

Challenge 9 exposes you to the flexibility of z/OS applied to MVS Data Sets, Unix Files, and character encoding standards.

z/OS Disk Storage Allocation for MVS Data Sets and Unix Files
  • z/OS disk storage space is allocated in 'extents'
      Extent is a contiguous area on disk
      z/OS data sets have 1 primary extent
      When a primary extent is full, then a secondary extent is allocated
      The number of secondary extents depends upon the type of data set
      The size of a primary and secondary extents are determined by a SPACE attribute

    See References drop down Data Set Allocation and Disk Storage Summary

  • There are many different types of data sets in z/OS, and different methods for accessing them. Among the most commonly used types are:
      In a sequential data set, records are data items that are stored consecutively.
      To retrieve the tenth item in the data set, for example, the system must first
      pass the preceding nine items. Data items that must all be used in sequence,
      like the alphabetical list of names in a classroom roster, are best stored
      in a sequential data set.
      A partitioned data set or PDS consists of a directory and members.
      The directory holds the address of each member and thus makes
      it possible for programs or the operating system to access each
      member directly. Each member, however, consists of sequentially
      stored records. Partitioned data sets are often called libraries.
      Programs are stored as members of partitioned data sets.
      Generally, the operating system loads the members of a PDS
      into storage sequentially, but it can access members directly
      when selecting a program for execution.
      In a Virtual Storage Access Method (VSAM) key sequenced data set (KSDS),
      records are data items that are stored with control information (keys)
      so that the system can retrieve an item without searching all preceding
      items in the data set. VSAM KSDS data sets are ideal for data items
      that are used frequently and in an unpredictable order.
    VSAM Linear Data Set
      Linear dataset is the only form of byte-stream dataset
      Can be formatted for Unix Filesystems
      Can be formatted for Db2 Tablespaces and Indexspaces


Use TSO Unix interface, OMVS, to edit Unix file and copy in data from an MVS data set
  1. Enter TSO OMVS to launch a Unix shell prompt
  2. Enter oedit ascii to edit a new Unix file
  3. Enter edit primary command copy 'zos.mtm2019.public.iso8859'
      Result is a copy MVS sequential data set records into Unix file
      Enter edit primary command hex on to display the hexadecimal values of the copied ASCII text
  4. Press F3 or save;end to exit edit session and return to shell prompt
  5. Enter exit, then enter again to exit from Unix shell prompt

Examine Unix File stream of bytes behavior
  1. From the Unix shell prompt, TSO OMVS, enter ls -TH ascii
      Unix ls command with -T flag lists the ascii file tag information where:
      output includes untagged and T=off (no tag assigned)

      Unix ls command with -H flag lists file formats and text data delimiters where:
      output includes nl (newline character, ascii x'15') is used as the text data delimiter
  2. From Unix shell prompt, enter cat ascii
      Unix cat command is used to 'concatenate' or display text file
      Displayed output is unreadable because system default is to read EBCDIC, not ASCII
      Newline character (nl, x'15') embedded in the ascii text did result in 15 newlines when text was displayed
  3. From Unix shell prompt, enter iconv -t IBM-1047 -f ISO8859-1 ascii | more
      Unix iconv command converts characters from one code page set to another where:
    -t IBM-1047 specifies the 'to' output character encoding where IBM-1047 is EBCDIC
    -f ISO8859-1 specifies the 'from' input character encoding where ISO8859-1 is ASCII
    iconv to EBCDIC did not recognize newline (nl x'15') as a valid EBCDIC character

Optional but helpful: From Unix shell prompt, enter man ls or man cat or man iconv to read about details of those Unix commands within the z/OS environment. When presented with (Page #), entering q will quit display of the command output.

Change a Unix file character encoding tag

z/OS utilities provide options to manage tags on UNIX files.

The chtag command allows you to set, modify, remove, or display information in a file tag.

Research the z/OS Unix chtag command by entering z/OS Unix command man chtag or an internet search.

Change the ascii file tag to EBCDIC using the z/OS Unix chtag command.

Success is when Unix command ls -TH ascii displays T=on with assigned EBCDIC character encoding scheme.

Unix command chtag -r ascii removes any previously assigned character encoding tag.

When your ascii Unix file has the EBCDIC tag assigned:

  1. From Unix shell prompt, enter ls -TH ascii > taglist
  2. From Unix shell prompt, enter cp taglist "//p2.output(#09)"
      The following truncation message is expected and can be ignored
    cp: FSUM6260 write error on file "//p2.output(#09)":
      EDC5003I Truncation of a record occurred during an I/O operation.
Optional: You can browse member #09 in your P2.OUTPUT MVS partitioned data set to verify the text is what you expect.

You are now aware of z/OS flexibility related to MVS data sets, Unix files, and character encoding.
You know more about z/OS than the average person.

Next: Challenge #10