Chapter Contents |
Previous |
Next |
Conversion of Existing Programs |
Each of these utility programs is described in the following sections.
Note:
If your object code is currently stored
in a PDS on the mainframe, you may also find the
updte2ar
utility useful.
For details, see ar2updte and updte2ar Utilities.
mf2unix and unix2mf |
The
mf2unix
utility program translates
source code from mainframe to UNIX format, and the
unix2mf
utility program
is used to translate source code when porting in the opposite direction, that
is, from UNIX to mainframe format. The syntax for invoking these utilities
is as follows:
mf2unix [option...] unix2mf [option...]
mf2unix
strips off trailing blanks
and sequence numbers, and changes digraphs to brackets.
unix2mf
breaks long lines, changes
brackets to digraphs, and replaces tabs with the correct number of blank space
characters.
The following option arguments can be specified to modify
the translation performed by the
mf2unix
utility:
Option | Description |
---|---|
-lbl
|
leave trailing blanks. |
-offdi
|
do not change digraphs to brackets. |
-recfm
format-type |
specifies the record format of the input file. format-type can be either a
v
to indicate variable-length
records, or
f
to indicate fixed-length records. |
-noseq
|
do not remove sequence numbers. |
The following option arguments can be specified
to modify the translation performed by the
unix2mf
utility:
In the following example, the
mf2unix
utility is used to translate
the source code contained in
native.c
from mainframe to UNIX format, redirecting the output to
cross.c
:
mf2unix -lbl < native.c > cross.c
The
-lbl
option specifies that trailing
blanks should not be removed. (Notice that the < and > redirection operators
are used to redirect the input and output of
mf2unix
.)
In the next example, the
unix2mf
utility translates
the source code contained in the file
cross.c
from UNIX format
to mainframe format:
unix2mf -t 10 < cross.c > native.c
Output is redirected to
native.c
and the
-t 10
option specifies that tabs should be replaced with 10 blank space
characters instead of the default of 8.
etoa and atoe |
The
etoa
utility performs an
EBCDIC-to-ASCII translation,
and the
atoe
utility performs an ASCII-to-EBCDIC translation.
Both utilities read from standard input, perform the translation, and then
write to standard output. No assumptions about input file format are made,
with regard to new-lines or any other record format. The utilities simply
copy the bytes while performing the translation. Also, both utilities use
the same translation tables used by the SAS/C C
and C++ cross-platform compilers. (IBM code page 1047 standard).
The
etoa
and
atoe
utilities do not accept
input or output filename arguments; therefore, the most effective way to use
these utilities is to redirect the input and output files. For example, the
following command redirects the input from native, performs an EBCDIC-to-ASCII
translation, and then redirects the output to cross:
etoa < native > cross
Another way to effectively control input is with a pipe.
For example, the output from the operating system's
cat
command can be piped to the
atoe
utility as follows:
cat native | atoe > cross
In this example, the input file,
native
,
is copied to the standard output file,
cross
, with ASCII-to-EBCDIC
translation performed by
atoe
.
objdump |
The
objdump
utility prints out a mainframe object file (either OS/390 or CMS)
for viewing on a host workstation. Output from the utility is directed to
the standard output file and is printed in 80-column lines, with EBCDIC characters
translated to ASCII. (
objdump
uses the same translation tables as used by
etoa
and
atoe
.) The resulting output is similar to what you
would see if you were to browse the file using the ISPF editor under MVS.
The syntax used to invoke
objdump
is as follows:
objdump [option...] object-file
Assuming that
foo.o
is the output of the cross-platform compiler, the following command directs
a dump of that object file to
stdout
.
objdump -h -n foo.o
In this case, both hexadecimal values and line numbers are displayed in the output.
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.