gtpo1m5wOperations

ZFILE hex-Display the Contents of a File

Use this command to write the contents of a file to the standard output (stdout) stream in character, decimal, hexadecimal, or octal format.

Requirements and Restrictions

Format




-c
displays a specified file in EBCDIC character display format. The displacement is shown on the left in hexadecimal, followed by 8 bytes of input data per line in EBCDIC with each character separated by spaces. Characters that cannot be printed are shown in hexadecimal format with the exception of the following C language escape sequences, which are displayed as \x and have the following corresponding meanings:

\0
Null

\a
Alert

\b
Backspace

\f
Form feed

\n
New-line character

\r
Carriage return

\t
Horizontal tab

\v
Vertical tab

-d
displays a specified file in the decimal display format. The displacement is shown on the left in hexadecimal, followed by 8 bytes of input data per line in unsigned decimal format. Each byte is shown three columns wide and is padded on the left with zeros. The columns are separated by spaces.

-o
displays a specified file in the octal display format. The displacement is shown on the left in hexadecimal, followed by 8 bytes of input data per line in octal. Each byte is shown three columns wide and is padded on the left with zeros. The columns are separated by spaces.

-x
displays a specified file in a lowercase hexadecimal display format. The displacement is shown on the left in hexadecimal, followed by 8 bytes of input data per line. Each byte is shown two columns wide. The columns are separated by spaces.

-X
displays a specified file in an uppercase hexadecimal display format. The displacement is shown on the left in hexadecimal, followed by 8 bytes of input data per line. Each byte is shown two columns wide. The columns are separated by spaces.

-v
displays all lines of a file, including duplicate lines. By default, the ZFILE hex command suppresses identical lines of output showing repeated lines by displaying a single asterisk (*). The -v (verbose) parameter forces duplicate lines to be displayed.

-n length
specifies the number of bytes to display from a file, where length is the number of bytes to display. Specify the length as a decimal number or use one of the following letters immediately following the number to indicate a different specification:

k
length is specified as a multiple of 1024

m
length is specified as a multiple of 1 048 576

o
length is specified in octal

x
length is specified in hexadecimal

-s offset
specifies the number of bytes to skip in a file before the display begins, where offset is the number of bytes to skip. Specify the offset as a decimal number or use one of the following letters immediately following the number to indicate a different specification:

k
offset is specified as a multiple of 1024

m
offset is specified as a multiple of 1 048 576

o
offset is specified in octal

x
offset is specified in hexadecimal

path
is the path of the file you want to display. If multiple files are specified, the ZFILE hex command handles the input as one single file rather than individual files, and the concatenation of these files is in the order you specify.

-f formatfile
specifies that the iterationcount, bytecount, and formatspecifier are declared in a separate file, where formatfile is the path to the file that contains this format string information. In this file, blank lines and lines whose first nonblank character is a hash mark (#) are handled as comments and ignored. For more information about specifying the iterationcount, bytecount, and formatspecifier, see the -e parameter.

-e
indicates that a format string is specified on the command line. The format string consists of one or more format units, and a format unit consists of an iteration count, a byte count, and a format specifier. The entire format string must be enclosed with single quotation marks.

iterationcount
is a positive integer that represents the number of times you want to have the formatspecifier parameter applied.

bytecount
is a positive integer that defines the number of bytes of input data interpreted each time the formatspecifier is applied. This number is always preceded by a slash (/). If you do not specify the bytecount parameter, the default is determined by the specified formatspecifier. (See Table 9 for specific default values.) Do not specify the bytecount parameter if you are specifying a formatspecifier containing multiple conversion specifications (excluding %_ad, %_ao, %_ax, %_aX, %_Ad, %_Ao, %_Ax, and %_AX).

formatspecifier
is the information needed to determine how you want your data to be written to stdout and is enclosed by double quotation marks (" "). This parameter functions similarly to the format parameter of the fprintf function. (See TPF C/C++ Language Support User's Guide for more information about the fprintf function, including flags, widths, and precision specifications.) This parameter in the ZFILE hex command has the following limitations:
  • An asterisk (*) cannot be used for width or precision.
  • You must specify a bytecount or a precision for each %s conversion specification.
  • The following conversion specifications are not supported: %C, %h, %l, %n, %p, %q, and %S.
Note:
Conversion specifications always begin with a percent sign (%) as explained in the TPF C/C++ Language Support User's Guide.
The ZFILE hex command also supports C language escape characters (as described for the -c parameter) along with the following additional conversion specifications:

Table 7. Additional Conversion Specifications for the ZFILE hex Command

Type Argument Output Format
%_ad Not applicable. Input data displacement for each line shown in decimal notation. The displacement is cumulative across all specified input files.
%_ao Not applicable. Input data displacement for each line shown in octal notation. The displacement is cumulative across all specified input files.
%_ax Not applicable. Input data displacement for each line shown in lowercase hexadecimal notation. The displacement is cumulative across all specified input files.
%_aX Not applicable. Input data displacement for each line shown in uppercase hexadecimal notation. The displacement is cumulative across all specified input files.
%_Ad Not applicable. Ending displacement shown in decimal notation. The displacement is cumulative across all specified input files and is displayed once at the end of the display.
%_Ao Not applicable. Ending displacement shown in octal notation. The displacement is cumulative across all specified input files and is displayed once at the end of the display.
%_Ax Not applicable. Ending displacement shown in lowercase hexadecimal notation. The displacement is cumulative across all specified input files and is displayed once at the end of the display.
%_AX Not applicable. Ending displacement shown in uppercase hexadecimal notation. The displacement is cumulative across all specified input files and is displayed once at the end of the display.
%_c Not applicable. EBCDIC characters. Nonprintable characters are displayed in hexadecimal except for those that can be represented by standard C language escape sequences (see the -c parameter for more information).
%_p Not applicable. EBCDIC characters. Nonprintable characters are displayed as single periods (.).
%_e Not applicable. EBCDIC characters. Nonprintable characters are displayed in hexadecimal with the exception of some control characters, which are displayed with their corresponding 3-character name. Table 8 shows how the control characters will be displayed with this conversion specification.

When using the %_e conversion specification type, some control characters are displayed as 3-character names rather than in hexadecimal. The following table lists those control characters along with each corresponding 3-character name.

Table 8. Control Character Display for the _e Conversion Specification in the ZFILE hex Command

00 -- nul 01 -- soh 02 -- stx 03 -- etx
04 -- sel 05 -- _ht 06 -- rnl 07 -- del
08 -- _ge 09 -- sps 0a -- _lf 0b -- _vt
0c -- _ff 0d -- _cr 0e -- _so 0f -- _si
10 -- dle 11 -- dcl 12 -- dc2 13 -- dc3
14 -- res 15 -- _nl 16 -- _bs 17 -- poc
18 -- can 19 -- _em 1a -- ubs 1b -- cul
1c -- ifs 1d -- igs 1e -- irs 1f -- itb
20 -- _ds 21 -- sos 22 -- _fs 23 -- wus
24 -- byp 25 -- lf_ 26 -- etb 27 -- esc
28 -- _sa 29 -- sfe 2a -- _sm 2b -- csp
2c -- mfa 2d -- enq 2e -- ack 2f -- bel
32 -- syn 33 -- _ir 34 -- _pp 35 -- trn
36 -- nbs 37 -- eot 38 -- sbs 39 -- _it
3a -- rff 3b -- cu3 3c -- dc4 3d -- nak
3f -- sub 41 -- rsp ca -- shy e1 -- nsp
ff -- _eo


Additional Information

Examples

In the following example, the default display format is shown, where file filehex256 contains hexadecimal bytes 00 to ff. The display skips the first 192 bytes of this file.

+--------------------------------------------------------------------------------+
|User:   ZFILE hex -s 192 filehex256                                             |
|                                                                                |
|System: FILE0001I 09:41:23 START OF DISPLAY FROM hex -s 192 filehex256          |
|        000000c0- c0c1c2c3 c4c5c6c7 c8c9cacb cccdcecf {ABCDEFG HI......         |
|        000000d0- d0d1d2d3 d4d5d6d7 d8d9dadb dcdddedf }JKLMNOP QR......         |
|        000000e0- e0e1e2e3 e4e5e6e7 e8e9eaeb ecedeeef \.STUVWX YZ......         |
|        000000f0- f0f1f2f3 f4f5f6f7 f8f9fafb fcfdfeff 01234567 89......         |
|        00000100                                                                |
|        END OF DISPLAY                                                          |
+--------------------------------------------------------------------------------+

In the following example, the -f parameter is used to re-create the default ZFILE hex display format as shown in the previous example. File filehex256 contains hexadecimal bytes 00 to ff. The display skips the first 192 bytes of this file. File SampleFormatFile contains the following three lines:

"%08.8_Ax\n"
"%08.8_ax" "- " 4/1 "%02.2x" " " 4/1 "%02.2x" " " 4/1 "%02.2x" " " 4/1 "%02.2x" " "
8/1 "%_p" " " 8/1 "%_p" "\n"
+---------------------------------------------------------------------------------------------+
|User:   ZFILE hex -s 192 -f SampleFormatFile filehex256                                      |
|                                                                                             |
|System: FILE0001I 09:41:23 START OF DISPLAY FROM hex -s 192 -f SampleFormatFile file...      |
|        000000c0- c0c1c2c3 c4c5c6c7 c8c9cacb cccdcecf {ABCDEFG HI......                      |
|        000000d0- d0d1d2d3 d4d5d6d7 d8d9dadb dcdddedf }JKLMNOP QR......                      |
|        000000e0- e0e1e2e3 e4e5e6e7 e8e9eaeb ecedeeef \.STUVWX YZ......                      |
|        000000f0- f0f1f2f3 f4f5f6f7 f8f9fafb fcfdfeff 01234567 89......                      |
|        00000100                                                                             |
|        END OF DISPLAY                                                                       |
+---------------------------------------------------------------------------------------------+

In the following example, file filehex256 contains hexadecimal bytes 00 to ff and is displayed using the lowercase hexadecimal format. The display skips the first 192 bytes of this file and shows only 16 bytes of data.

+--------------------------------------------------------------------------------+
|User:   ZFILE hex -x -n16 -s192 filehex256                                      |
|                                                                                |
|System: FILE0001I 09:41:23 START OF DISPLAY FROM hex -x -n16 -s192 filehex256   |
|        000000c0  c0  c1  c2  c3  c4  c5  c6  c7                                |
|        000000c8  c8  c9  ca  cb  cc  cd  ce  cf                                |
|        000000d0                                                                |
|        END OF DISPLAY                                                          |
+--------------------------------------------------------------------------------+

In the following example, file filehex256 contains hexadecimal bytes 00 to ff and is displayed using both the EBCDIC character format and the lowercase hexadecimal character format. The display skips the first 192 bytes of this file and shows only 16 bytes of data.

+--------------------------------------------------------------------------------+
|User:   ZFILE hex -cx -n16 -s192 filehex256                                     |
|                                                                                |
|System: FILE0001I 09:41:23 START OF DISPLAY FROM hex -cx -n16 -s192 filehex256  |
|        000000c0   {   A   B   C   D   E   F   G                                |
|        000000c0  c0  c1  c2  c3  c4  c5  c6  c7                                |
|        000000c8   H   I  ca  cb  cc  cd  ce  cf                                |
|        000000c8  c8  c9  ca  cb  cc  cd  ce  cf                                |
|        000000d0                                                                |
|        END OF DISPLAY                                                          |
+--------------------------------------------------------------------------------+

Related Information

See ZDFIL-Display File for more information about the ZDFIL command.