Calling Assembler from Cobol



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Calling Assembler from Cobol

Postby sallyroselle » Thu Dec 08, 2011 8:32 pm

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!
sallyroselle
 
Posts: 12
Joined: Wed Nov 09, 2011 9:10 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Calling Assembler from Cobol

 

Re: Calling Assembler from Cobol

Postby BillyBoyo » Thu Dec 08, 2011 9:01 pm

Is the Assembler module "LE Compliant"?
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Calling Assembler from Cobol

Postby enrico-sorichetti » Thu Dec 08, 2011 10:15 pm

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
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2644
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 130 times

Re: Calling Assembler from Cobol

Postby sallyroselle » Thu Dec 08, 2011 11:59 pm

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?
sallyroselle
 
Posts: 12
Joined: Wed Nov 09, 2011 9:10 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Calling Assembler from Cobol

Postby BillyBoyo » Fri Dec 09, 2011 12:05 am

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).
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Calling Assembler from Cobol

Postby sallyroselle » Fri Dec 09, 2011 12:27 am

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.
sallyroselle
 
Posts: 12
Joined: Wed Nov 09, 2011 9:10 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Calling Assembler from Cobol

Postby sallyroselle » Fri Dec 09, 2011 12:40 am

I missed the comp part-

I coded it as you have above, and it worked! Thanks so much for your help!
sallyroselle
 
Posts: 12
Joined: Wed Nov 09, 2011 9:10 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Calling Assembler from Cobol

Postby BillyBoyo » Fri Dec 09, 2011 1:42 am

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.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post