Page 1 of 1

Compiler option in Cobol

PostPosted: Wed Jan 05, 2011 9:51 am
by mf.sheela
Hi,

I am new to mainframe and this forum. I had attented a interview recently and they asked me an question in cobol which i had no idea about. The question is:

1. A main program (Prog A) --> in Cobol 3 with compiler option Rmode(24). Is calling a sub program (Prog B) in Cobol 3 with the compiler options AMODE(31) RMODE(ANY). They asked me if the program will abend because of Rmode(24) option in main program. Can any one please let me know if the program will abend?

Also i am curious to know what will happen if the Main program in Cobol 3 with compiler option Rmode(24),Data(24) call a sub program in cobol 3 with compiler option AMODE(31) RMODE(ANY)? would this abbend.

Can any one please help me in this.

Thanks in advance,
Sheela.

Re: Compiler option in Cobol

PostPosted: Wed Jan 05, 2011 10:30 am
by steve-myers
One important piece of information is lacking: is prog B called dynamically or is it statically linked with prog a?

Re: Compiler option in Cobol

PostPosted: Wed Jan 05, 2011 6:27 pm
by mf.sheela
Hi Steve,

The sub program (Prog B) is called dynamically.


Thanks,
Sujesh.

Re: Compiler option in Cobol

PostPosted: Thu Jan 06, 2011 7:23 pm
by FUFENG
really!i also don't know the answer.now!thank you.i get it !

Re: Compiler option in Cobol

PostPosted: Tue Feb 01, 2011 12:05 am
by syannigeri
waiting for reply..

Re: Compiler option in Cobol

PostPosted: Tue Feb 01, 2011 12:32 am
by Robert Sample
A main program running RMODE 24 will be passing parameters below the line. The subprogram running AMODE 31 RMODE 24 can address memory below the line, so there would not be any storage access problems. Where memory problems come from is when a main program is running AMODE 31 RMODE ANY and passes a parameter above the line to a subprogram running AMODE 24 which means it cannot access the parameters passed to it.

Terminology is critical in IT, where similar terms may mean very different things. There is no such thing as "compiler option RMODE(24)" as specified in your post -- COBOL has a DATA(24) compiler option but not RMODE(24). Only the linkage editor / binder has an RMODE option. Furthermore, you referenced "COBOL 3" in your post -- I did not answer your post because I have no idea what "COBOL 3" is nor what platform it runs on. The current IBM mainframe version of COBOL is Enterprise COBOL for z/OS; previous compilers include Enterprise COBOL for MVS & VM, COBOL for MVS & VM, COBOL/390, VS COBOL II, OS/VS COBOL There has not ever been a "COBOL 3" compiler for an IBM mainframe.

Re: Compiler option in Cobol

PostPosted: Tue Feb 01, 2011 1:15 am
by steve-myers
A proposed RMODE for a program section can be specified in object format. In Assembler, the RMODE pseudo-operation can specify the proposed RMODE. The RMODE for a load module, if not explicitly specified by parameters or control statements in the Binder or Linkage Editor is the most restrictive of the RMODEs in the input object. Even then, a program that dynamically loads a load module can override the load module's RMODE.

As Mr. Sample indicated, an RMODE and AMODE 24 module can call an RMOOE ANY module if it makes arrangements to change the AMODE to AMODE 31 before it calls the module, and changes the AMODE back to AMODE 24 after the RMODE ANY program terminates. The big danger here is that the RMODE ANY module might attempt to return data above the 16-meg line to the RMODE/AMODE 24 program, which will cause the RMODE/AMODE 24 program to fail.

Last year a project I did had an AMODE 31 program call an RMODE 24 (actually, an RMODE unknown) program. This was done, in part, by placing any data sent to the new program in storage allocated below the 16-meg line.

Re: Compiler option in Cobol

PostPosted: Tue Feb 01, 2011 2:56 am
by Akatsukami
Robert Sample wrote:Terminology is critical in IT, where similar terms may mean very different things. [...] Furthermore, you referenced "COBOL 3" in your post -- I did not answer your post because I have no idea what "COBOL 3" is nor what platform it runs on. The current IBM mainframe version of COBOL is Enterprise COBOL for z/OS; previous compilers include Enterprise COBOL for MVS & VM, COBOL for MVS & VM, COBOL/390, VS COBOL II, OS/VS COBOL There has not ever been a "COBOL 3" compiler for an IBM mainframe.

I believe that Enterprise COBOL for z/OS is often (mis)called COBOL 3.