anyone who has Converted COBOL program to C/C++(mainframe)

K

Kalpana Shridhar

I am on a project where I am converting COBOL to C++ on the mainframe.
I am new to COBOL and have a lot of questions - any websites or any
suggestions from experienced people will be really appreciated.
My main issue is with the CALL routine - I have to call a external function
which I believe is Assembly. Right now the call is made using 4 structures
in COBOL.
To convert to C++ - what should I be concerned about, should I pass 4
structures as input - what should I look for during data conversion.
Any input with the conversion would be very very helpful.

Thanks,
Kalpana
 
R

Raoul Gough

Kalpana Shridhar said:
I am on a project where I am converting COBOL to C++ on the mainframe.
I am new to COBOL and have a lot of questions - any websites or any
suggestions from experienced people will be really appreciated.
My main issue is with the CALL routine - I have to call a external function
which I believe is Assembly. Right now the call is made using 4 structures
in COBOL.
To convert to C++ - what should I be concerned about, should I pass 4
structures as input - what should I look for during data conversion.
Any input with the conversion would be very very helpful.

This is slightly off-topic in clc++, since the C++ standard doesn't
define any COBOL compatbility features - you might have more luck in a
COBOL group. This will always be platform-specific, anyway, so maybe a
group dedicated to the particular mainframe (you didn't say which).

Whatever, the trick will be ensuring memory-layout compatability
between the COBOL structures and the corresponding C structures. I say
C structures because you can't add much C++ stuff to a struct before
you lose any control of the memory layout. I did some stuff along
these lines a few years ago, and the COBOL compiler's reference manual
was very informative about memory layout of the various data types. I
would also suggest examining the raw data from the COBOL structures
(e.g. in a debugger or by writing to a binary file) to double-check
that you understand the layout. Then again, if you have the assembly
sources, you could use them to find out where everything goes. You
might need some C-compiler specific stuff to control structure
padding/packing.
 
P

paul

When calling an Assembler subroutine, it often depends on the platform
you're using. My experience has ben with IBM mainframes running DOS/VSE and
MVS.

IBM uses a standard calling routine for communicating between different
programs. Certain registers are used for particular functions. The main
thing I believe you would have to be concerned about is passing in the data
to the subroutine. As I recall, the 31-bit address for each parameter in
the CALL statement is appended together. Therefore, if you are calling with
four arguments, you would be passing in a 16-byte area (4 4-byte addresses)
to the Assembler routine. The last address should have the high order
(x80000000) bit set to 1. This is how the calling routine recongnizes that
it's the last address.

If you are using the C++ compiler on the same mainframe as the existing
COBOL and Assembler code, there should be manuals somewhere that describe
how to call an Assembler routine from a C++ function. That may be your best
bet in the situation.

HTH,

Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,527
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top