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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

zOS Enterprise cobol calling non LE Assembler pgm AMODE(24), RMODE(24)

Status
Not open for further replies.

andymc1

Programmer
Jun 28, 2002
23
CH
Hello, most of you will already know this but its the first time I have had to do it so thought I'd share what I found.

An Enterprise cobol program has to call a non LE compliant Assembler routine which is both amode(24) and rmode(24). After many OC4's, what seems to work is link edit the cobol module amode(24) and rmode(24) and compiler options data(24), rmode(24) and define the passed linkage as EXTERNAL. That is all. If you do a normal cobol call i.e. call ws-prog using ws-parms then it defaults to the 'by reference' type of call as defined in the LE manuals so you don't even have to play with the call statement. If the Assembler routine populates Register15 with the return code on the way back(standard practice) you can just check RETURN-CODE for the rc. This standard RETURN-CODE field is something I have never used before, I have lead a fairly sheltered cobol life obviously, but after two days of faffing with these options and reading manuals it now works and I feel like sharing the info.

Don't know if you need all of these options and of course it will depend on what you are trying to do but what it does mean is that Enterprise Cobol can call non LE Assembler rmode(24), amode(24) successfully, something which all the manuals say but don't really give you the details at least not in the simple language I need. To anyone who is trying to do this for the first time I hope this post helps. By the way I was told you needed a runtime option of Heap(,,Below) to make sure all storage stayed beneath the 16MB line but I didn't need this presumably because of the data(24) option. Also, I didn't need to pass parms back to the Cobol routine but I am told that if the Assembler just writes over the old parms (i.e. Register1) then it will be accessible again on return to the calling module, BUT I haven't tested this and of course the RETURNING ws-parm1 would be the preferred option on your cALL statement if you needed to pass data back. I guess the interesting thing is that with COBOL I always think of passing data but when dealing with Assembler you have to think addressing storage. Any comments on the above welcome, especially if you've found different.

cheers
Andy
 
I believe compiling your Cobol program with RMODE(24) and AMODE(24) is not necessary. I have called Assembler non LE compliant routines using just the DATA(24) compile option and using a dynamic call "CALL WS_NAME USING VARIABLE" where WS_NAME is a working storage field contaning the routine name. As long as you call the assembler routine dynamically (allowing it to load below the line) and the data addresses you pass it are below the line (DATA(24)) it should work.

FYI, with the new ZOS operating systems from IBM, it will soon become advantagious to upgrade you assembler routines to AMODE 31. The new ZOS system can make use of performance enhancements if it knows all will be AMODE 31.

etom
 
Thanks Etom

but this didn't work for me, just tried with AMODE(24)link edit parms and DATA(24) compile parms only and this worked too.

Yes it makes sense to convert the Assembler to 31 but the routines are part of external software so the only thing I can do is ask them to upgrade, however for my project deadlines its too late :-(

cheers
Andy
 
To have an AMODE(31) RMODE(ANY) Enterprise COBOL program call an AMODE(24) RMODE(24) non-LE conforming Assembler:

A) Compile the COBOL program with DATA(24) (use RMODE(AUTO))

B) Use a DYNAMIC CALL statement to call the Aseembler program. (This can be done by either using the DYNAM compiler option if you want ALL calls to be dynamic - or use CALL identifier with NODYNAM compiler option)

***

This should work for COBOL calling Assembler. If, however, you have Assembler calling COBOL, you should read the infromation at:



Bill Klein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top