Page 1 of 1

Calling Assembler from Cobol

PostPosted: Thu Dec 08, 2011 8:32 pm
by sallyroselle
I am currently trying to call an assembler program from cobol. When I call from a JCL using a parm, I get good return codes from the JCL (0 if I find what I need, 8 if I don't). However, when I call it from cobol, I am always getting a return code of 4 when I use look at RETURN-CODE (it's a RACROUTE call). Is there anything special I need to call the assembler? I'm doing a CALL program USING value. Thanks!

Re: Calling Assembler from Cobol

PostPosted: Thu Dec 08, 2011 9:01 pm
by BillyBoyo
Is the Assembler module "LE Compliant"?

Re: Calling Assembler from Cobol

PostPosted: Thu Dec 08, 2011 10:15 pm
by enrico-sorichetti
if I read You post correctly You complain that when executing some <program> as
//<stepname> EXEC PGM=<the program at stake>,PARM=<some parm>

but when You use
call <the program at stake> USING <some variable which contains some parm>


You should realize that the parameter passing between
JCL EXECuting <some program>
is different from the parameter passing for
<some user program> CALLing <some user subroutine>

the person to ask is the one who provided You with the program and its documentation

Re: Calling Assembler from Cobol

PostPosted: Thu Dec 08, 2011 11:59 pm
by sallyroselle
I'm not sure if this Assembler is LE compliant- do you know how I can tell?

As far as JCL vs cobol, the programmer that wrote the assembler stated that wherever it is called from, I should pass it an 8 byte field. The testing from the JCL works fine with the 8 byte field- do I need to pass it something different when I use cobol?

Re: Calling Assembler from Cobol

PostPosted: Fri Dec 09, 2011 12:05 am
by BillyBoyo
You'd need to define your field to pass to the Assembler the way you'd define a field to receive any old PARM in Cobol, ie you'd need a half-word indicating the length of the parameter, then the parameter itself, immediately following.

01 W-PARM-FOR-ASM.
    05  W-PFA-LENGTH COMP PIC S9(4) VALUE +8.
    05  W-PFA-PARM-DATA PIC X(8) VALUE something appropriate to your requirement.


I can't understand why the guy who wrote it isn't more helpful about it. This should work if it works from the EXEC PGN=xxx,PARM=yyy in the JCL.

If they eight byte includes the two-byte length, then length to +6 and X(8) to X(6).

Re: Calling Assembler from Cobol

PostPosted: Fri Dec 09, 2011 12:27 am
by sallyroselle
Does it have to have the two byte length field? I'm sorry, our shop uses very little assembler, so debugging this is not something I've ever done.

Re: Calling Assembler from Cobol

PostPosted: Fri Dec 09, 2011 12:40 am
by sallyroselle
I missed the comp part-

I coded it as you have above, and it worked! Thanks so much for your help!

Re: Calling Assembler from Cobol

PostPosted: Fri Dec 09, 2011 1:42 am
by BillyBoyo
No problem. Glad you got it going.

The two-byte length followed by the data is how Cobol/anything receives the PARM from JCL. This is the difference enrico was pointing to. Obviously nothing else you have in your other Cobol calls needs that, unless the called programe happens to want it that way. If the Assmebler was working that way from PGM=, then that is the way it had to be for the Cobol call.