MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Compiler Options (AMODE, RMODE, DATA, RENT)

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
sanat
Beginner


Joined: 15 Feb 2003
Posts: 11
Topics: 7
Location: chennai

PostPosted: Wed Mar 12, 2003 8:56 am    Post subject: Compiler Options (AMODE, RMODE, DATA, RENT) Reply with quote

Need some more info on the compiler options. I went thru the manuals, but have the following doubts.

Q1) The manual says RMODE decides where the program should reside when loaded into memory (below line or above the line). It can have a value 24, 31 or ANY. My ques is why the program needs to be loaded aove the line. Does it mean the object module (or, the load module occupies those many bytes...certainly not).

Q2) Is the AMODE specifies the addressing required for calling various system services, addressing required for the data to be handled in the I/O ? Pl. confirm.

Q3) What is the use of DATA option ? Does it the signify the amount of data passed to a sub program from calling program ?

Q4) If the progrm is compiled with RENT option, then the program can be reentrant (or quasi-reentrant). Reentrancy means that program will not modify itself during execution. But, how can a program modify itself and what sort of modifications the program can go thru during run time !!!

Thanks,
Sanat.
Back to top
View user's profile Send private message Yahoo Messenger
semigeezer
Supermod


Joined: 03 Jan 2003
Posts: 1014
Topics: 13
Location: Atlantis

PostPosted: Wed Mar 12, 2003 9:18 am    Post subject: Reply with quote

Good questions!
1) RMODE defines where the program may be loaded and the only reason to use RMODE(31) or ANY is to reduce the amount of data & programs below 16MB. That memory is a limited resource, which is already half used by the operating system and other programs, so if your program does not need to be there, you want to get it out of the <16MB area. The name given to that problem explains it best: VSCR or Virtual Storage Constraint Relief.

2) You are correct. a little more info though... To understand RMODE you need to understand how an address is created. (ignoring 64 bit, of course), an address is used from a register, and registers are 32 bits. The first bit (bit 0) is ignored as far as addressing goes (it has meaning, but nothing relevent here). The remaining 31 bits define an address of 2GB. But in the old days, only 24 bits were used (bits 7-31) because the machines were 16MB machines and it only takes 24 bits to address that. So the remaining bits (0-7) were often used for some other purpose and now that machines can address the whole 31 bits, the machine needs a way to know to ignore those bits. That is what AMODE does. To get back to your question about I/O, many of the I/O routines use 24 bit addressing because they use that 1st byte for something else. Therefore, the data that the I/O routines will use (control blocks, buffers, etc) must be below 16M; AMODE(24). There are I/O routines that can run 'above the line' that have been around for years, so not all I/O requires AMODE(24). There are other services as well that require AMODE(24) such as some TSO routines (TPUT), and I'm sure many others. Frequently a program is written in 2 parts, the main part is AMODE(31) and the 2nd AMODE(24), with appropriate code to switch modes at runtime (See the BASM or BSM assembler instructions for example).

3) I don't know... sounds like a COBOL question and I don't know COBOL.

4) Two types of self modification exist. Data and instructions. Data modification just means that the data exists within the program; it is stored in the same general place as the program is. Things like local variables and save areas can be done this way. A reentrant program must get storage elsewhere for those data.

The other modification type is instruction modification. That is rarely done these days, but it is possible (and a very bad thing to do), to change instructions within the program at run time. For example, by flipping one or two bits in a conditional Branch (B) instruction you can change it from branch if zero to branch if not zero. This was done when memory was tight but is a disaster to do today for performance and maintainability reasons.
Back to top
View user's profile Send private message Visit poster's website
Dibakar
Advanced


Joined: 02 Dec 2002
Posts: 700
Topics: 63
Location: USA

PostPosted: Wed Mar 12, 2003 9:21 am    Post subject: Reply with quote

Answer to Q4:

'MOVE A TO B' is an example where the code modified itself if B is a variable defined in WORKING-STORAGE SECTION. Since the varaible location is part of the program.

But if B is declared in LINKAGE SECTION then the code is not modified. Even though for reentran program only one load module is copied to memory which is used again and again. But a new copy of LINKAGE SECTION is created every time this program is executed.

Am I right people?
Diba.
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12372
Topics: 75
Location: San Jose

PostPosted: Wed Mar 12, 2003 9:23 am    Post subject: Reply with quote

Sanat,

A very good explanation from semigeezer. I will try to answer the question about DATA.Data is a compiler option for COBOL.check this link for a detailed explanation of DATA compiler option.

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IGY3PG00/2.4.12?DT=20011203125201

Hope this helps...

cheers

kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Anand_R
Intermediate


Joined: 24 Dec 2002
Posts: 189
Topics: 60

PostPosted: Wed Mar 12, 2003 1:30 pm    Post subject: Reply with quote

Hi,

Can u provide the link for all the compiler option explanations..

Thanks
Anand
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12372
Topics: 75
Location: San Jose

PostPosted: Wed Mar 12, 2003 3:55 pm    Post subject: Reply with quote

Anand,

Here is a link to all the compiler option with explanation

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IGY3PG00/2.4?DT=20011203125201

A tip that might help you in future. I have posted a link which explains about the compiler option DATA . so there is a very likely chance that the other compiler options are also explained in that (indeed they are ). so now take only the partial part of the link I posted above for ex:

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IGY3PG00

The first part is the link to the book and 2.4.12 is the topic number in the link and most likey all the compiler options are explained in topic 2.4 which is the link I posted in this post.

Hope this helps....

cheers

kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Dibakar
Advanced


Joined: 02 Dec 2002
Posts: 700
Topics: 63
Location: USA

PostPosted: Thu Dec 08, 2005 5:33 am    Post subject: Reply with quote

Quote:

'MOVE A TO B' is an example where the code modified itself if B is a variable defined in WORKING-STORAGE SECTION. Since the varaible location is part of the program.


I was going through old posts and would like to take this oppurtunity to correct my statement.

In CICS 'MOVE A TO B' is still reentrant because CICS maintains different copies of working storage. I am told that ALTER command will make a COBOL CICS program non re-entrant.

Thanks,
Diba.
Back to top
View user's profile Send private message Send e-mail
MikeBaker
Beginner


Joined: 04 May 2004
Posts: 96
Topics: 9

PostPosted: Thu Dec 08, 2005 4:45 pm    Post subject: Reply with quote

As regards RMODE... there is also a new option available these days called RMODE(SPLIT), whereby the load module can actually be split into two sections, one being RMODE 24 and the other being RMODE 31.
Back to top
View user's profile Send private message
Naved
Beginner


Joined: 09 Dec 2005
Posts: 2
Topics: 0
Location: USA

PostPosted: Fri Dec 09, 2005 10:51 am    Post subject: Reply with quote

I was going through the old posts and thought of sharing something.'
Related to semigeezer's post Posted: Wed Mar 12, 2003 9:18 am In answer to question of Sanat, you mantioned that the high order bit is used for something.. well.. It's used to tell the processor if the address used in the proceeding bits is in 24 or 31 bit mode.
Back to top
View user's profile Send private message
Naved
Beginner


Joined: 09 Dec 2005
Posts: 2
Topics: 0
Location: USA

PostPosted: Fri Dec 09, 2005 11:10 am    Post subject: Reply with quote

Example of nonentrant code:
Code:

START  CSECT
            -
            -
            -
            -
CONT   DS  0H
           CP    A,B                       
           BH    CONT3
           AP    C,D
CONT1 B          CONT3     
           CP    C,G
           BH    CONT3
           BL    CONT4
           MVI   CONT1+1,X'00'   <-- THIS WILL CHANGE THE "B" at CONT1  to  NOP                                               and in the next pass  ' CP    C,G' will be executed
           AP    C,F
CONT3 DS   0H   
            -
            -
            -
            -
            B    CONT
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group