C program call to COBOL / DB2

0 pts.
Tags:
390
DB2
Mainframe
Tech support
zSeries
Can a C program in a mainframe environment call a COBOL program or a DB2 stored procedure. If so is any sample code available.
ASKED: December 6, 2005  5:26 PM
UPDATED: December 6, 2005  5:49 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.

The exact way to do these are dependent on your OS. Because I got the message through an AS/400 board, I’ll assume a 400 for now.

Calling an SQL stored procedure:

EXEC SQL CALL procedureName(:firstArgument, :secondArgument);
if (SQLCODE<0) {
Handle error here
}

Calling a Cobol program:

system(“CALL PGM(libraryName/programName) PARM(parameters, if any, go here)”);


Sheldon Linker
Linker Systems, Inc.
www.linkersystems.com
sol@linker.com
800-315-1174
+1-949-552-1904

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • TwoMetreBill
    The simple answer is yes but you have a bit of study ahead of you. You'll need to first study the LE environment (I'm assuming that you are using the IBM C and COBOL LE/390 environment) programmer's guides. This will tell you how to properly setup and reuse the language environment for inter-language communication. These books will also give you the inter-languate calling conventions for things such as parameters. Then you'll need to study the DB2 programmer's guide to identify the requirements unique to stored procedures. There is sample code installed in libraries as part of the product installs. The systems programmers who installed LE and DB2 can tell you the names of those libraries. You probably won't find the exact example you are looking for but you should be able to figure it out from the manuals and the samples. If you are not familiar with these environments, you do have a bit of research and experimentation ahead of you. I hope you aren't on a tight schedule. Additionally, if you are not using IBM's LE/C and LE/COBOL, you are really going to earn your pay. Lastly ensure that you are using the same definitions for DBCS for all the products. Bill
    0 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following