Page 1 of 1

How to get the Data back from assembler in Cobol.

PostPosted: Tue Jul 22, 2008 10:27 pm
by Ramkumarsony
I am sending some data to a assembler program from a cobol. so the address of address of parm list will be stored in register one(R1). suppose after doin some changes how to retrieve the data back to the cobol program. i have used the following code for getting the data in assembler to map the address of parms in register 5. Then used a "dsect" to get the data.

L R5,0(R1)
USING VALDSECT,R5
.
.
.
VALDSECT DSECT
DATAS 0CL20
DATA1 CL10
DATA2 CL10
.
.
Now I have to send this data back to the cobol. can anyone plz give me the piece of code to do so.

Re: How to get the Data back from assembler in Cobol.

PostPosted: Wed Jul 23, 2008 12:09 am
by dick scherrer
Hello Ramkumarsony and welcome to the forums,

Do you know how to call a cobol sub-program from a cobol main program?

Let's say that the sub-program is given some numbers and is to send back an "answer". How does the cobol sub-program give back the answer?

Assembler works the same way. The calling program establishes addressability to the parm field(s) and the called module simply uses the fields.

Re: How to get the Data back from assembler in Cobol.

PostPosted: Wed Jul 23, 2008 10:18 am
by Ramkumarsony
Hi D.Sch.....
Thanks alot.. :) So since we are manipulating the data by using their address, any change we made will get reflected in cobol also(Because its a "Call by reference" calling) so after manupulating the data if i map the address of data to the register 1(R1) i can retrieve the changed data in cobol. right?

Re: How to get the Data back from assembler in Cobol.

PostPosted: Thu Jul 24, 2008 2:21 am
by dick scherrer
Hello,

You won't actually "retrieve" anything in COBOL - when the "move" happens in assembler, the actual receiving field is the field within the cobol program.

When your assembler code begins, one of the first things done is to establish this addressability. If your assembler code "sees" the parm correctly, that is all you should need to do.

so after manupulating the data if i map the address of data to the register 1(R1
You will have already done this and will not need to do it again.

Re: How to get the Data back from assembler in Cobol.

PostPosted: Thu Jul 24, 2008 9:47 am
by Ramkumarsony
ok Dick scherrer.. thanks... :)