Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cobol calls Assembler subroutine

Status
Not open for further replies.

mani05

Programmer
Apr 16, 2009
13
IN
Hi,
Please anyone help me to understand how cobol pass values to assembler subroutine and it gets back.I am looking for manual also.
 
Please post O/S and COBOL vendor and version. And are you working with the COBOL source or the assembler source?
 
Hi,
I am using XP2000.I am working in IBM COBOL.The assembler subroutine is already there,i want to modify something in that assembler subroutine.So i am trying to understand the process how cobol calls assembler,how it pass the value and it gets back.
 
I mentioned Windows XP/2000,i am working on COBOL-85.
 
RM COBOL-85...anyway this concept isn't much different compared to what your caller is, for all subroutines use these.

Variables are passed either by value or by reference. This is probably what you will be most concerned with. The COBOL calling program will need to match the subroutine in how it is called.

A "By Value" reference is copied to an internal reference in the function. If it's not set as a constant, it can be changed, but changes will not be reflected outside of the function.

A "By Reference" reference is passed via pointer reference. It can be changed, and the change will be reflected in the main program after the call.

There are also many other methods regarding the order/way parameters are passed to subroutines. You will need to match this in the subroutine with how RM-COBOL handles things. But with the way your post reads, you are modifying and not creating, so this should not be a concern for you.

Measurement is not management.
 
manni05,
It's been a long time since I have done this but your problem brings back some memories. Yes I did something like this a long time ago. Cobol calling assembler or RPG and vice versa.

I think your problem here can be summarized as:

1. Understanding the linkage between program languages. This is a big topic because you have to understand how data is shared. Just like Glenn said data can be passed by reference, value and also by content, either statically or dynamically.

2. Know how the parameters are being passed and received and the structures of the parameters. Know what is the common area being used by both program (sometimes they called it data areas).

3. If you are going to change something in assembler then do it in assembler and not in cobol. If you are going to change the structure of a parameter then you will have to do it in both programs because they need to match or you will get errors.

Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top