HELP NEEDED
-----------
I have the following problem:
I have C code generated from an AWk program using awkcc.
I need to port this C code to an IBM 5000 series mainframe (MVS).
I don't have any idea about IBM mainframes and hence do not know
about the various C compilers on IBM. The C code I have is NOT
ANSI C - it is old-fashioned K&R C. Any insights on portability
is appreciated.
Modern MVS systems no longer have K&R C compilers. The C compiler you'll use
on MVS will compile C89, and likely have a fair amount of C99 support.
Some caveats to watch for:
* MVS mainframes use EBCDIC characterset variants, while your Sparc/Unix
Awk-derived K&R C will likely assume ASCII. Since awk uses regexps, which
implies a wide range of characterset issues ([a-z] implies a contigious
set of values in ASCII, and a discontigious set in EBCDIC) that *will be
different* on MVS in EBCDIC, you will likely have a lot of
hand-correction to do to the awkcc-generated code.
* EBCDIC is a /family/ of charactersets, each one subtly different. The
family (as a whole) doesn't support the same character glyphs as ASCII,
and often supports glyphs with different values depending on the variant.
Since you are porting an awkcc-generated program, I presume that it takes
text input, and you will, by necessity, have a concern about *which*
EBCDIC the input text is recorded in.
* What am I thinking? Since certain commonly-used ASCII characters don't
exist in the EBCDIC-variant that your MVS C compiler will require source
to be written in, you will have to hand-correct your awkcc-generated code
to use *trigraphs* (or perhaps digraphs) to represent those characters.
Notably missing are the [ and ] glyphs, which are central to the coding
of C arrays.
* MVS C supports C89. While the C89 standard supports K&R as a "legacy"
format, you might find that the MVS C compiler in use /does not/ support
K&R. You will likely have a lot of hand-correction to do to the awkcc
generated code.
* MVS C filenames do not follow the format that Sparc/Unix dictates. If the
code opens named files, you will have to make changes to those filenames.
(i.e. FILE *fp = fopen("/etc/myconfig.conf","r"); becomes
FILE *fp = fopen("DDNAME:SYSCONF","r"); ).
* MVS data files are physically stored as "records", usually of fixed
length, and often of lengths greater than 80 bytes. The MVS C runtime
will "transform" 80-byte fixed-length data into a byte stream suitable
to be read with fgetc() et al. However, if your input data is recorded
in something other than 80-byte fixed-length records, you must fread()
and fwrite() it instead. Sorry, but that's the legacy of MVS, and there
isn't much you can do about it.
I'm sure that, if I put my mind to it, I could come up with more hints. But,
I think that I've given you enough hints for now.
You've bit off a pretty big chunk of work to do. Luck be with you.
HTH