Joined: 26 May 2005 Posts: 15 Location: maharashtra
Hello Everybody,
As I remember I have seen placing the control blocks below or above the line in assembler programs. DCB always lies below the line but we can keep it above the line I think with the help of keyword MODE=31.
How do you we switch the common working storage in the program above or below the line as we do in COBOL programs by using the compiler option DATA(24) DATA(31)? Please let me know or atleast point me to the reference document.
In Assembler on a z/OS system, the location of virtual storage obtained by a user program is determined by the keywords used or defaulted on the GETMAIN or STORAGE macro. LOC=31 or LOC=24 indicates a request for storage above the 31-bit address line or below it.
The GETMAIN or STORAGE macro call in your program that actually obtains the program work area controls where the work area is actually allocated, above the line or below it.
Common storage work areas are usually obtained shortly after entry to the user program. Find the GETMAIN or STORAGE macro call that obtains the common work area, then change the macro to use LOC=24 or LOC=31 as appropriate.
The program MUST be link edited (using the linkage editor or binder) with AMODE=31 in order to successfully use LOC=31 on the GETMAIN or STORAGE macro.
Joined: 26 May 2005 Posts: 15 Location: maharashtra
Thank you very much Ironmike. I will further look into the details of the macro....
I am having a query. I dont know whether it is logical or not.. Say I have coded a program as following..
MAINPGM CSECT
STM 14,12,12(13)
BALR *,12
ST
LA 13,SAVE+4
.
.
.
.
.
BR 14
A DC
B DC
C DC
etc..
While executing the program in AMODE 31, Where does the data A,B and C lie ( below or above the line) and how to switch it dynamically from below to above. Say it is lying below the line , how to switch it to above the line dynamically?
Can we issue Getmain for this ?
This question may be weird for you. I also haven't seen a code since a long time. Basically I am not a assembler programmer but having interest in it.
A, B, and C are labels you assigned to storage areas defined with the DC instruction, and as you have coded your sample program, they are included inside of your Assembler program itself. Where they reside (above the 31 bit address line or below it) depends therefore upon where your program itself resides. If your program resides in virtual storage above the 31 bit address line, then areas labeled A, B, and C reside there also. If your program resides below the line, then the storage areas labeled A, B, and C do also since they are part of your program.
Program residency is controlled by one thing: the RMODE used when the program is link edited via the linkage editor or binder. RMODE=ANY tells z/OS to load the module anywhere, either above or below the 31 bit address line. RMODE=24 says load it BELOW the 31 bit address line. There is no RMODE=31, but RMODE=ANY almost always (99.9999% of the time) causes your program to load ABOVE the 31 bit address line.
If your program resides above the 31 bit address line, then you must code for that residency state by ensuring that your code treats all addresses as 31-bit addresses, not 24-bit addresses.
Now, the only way to move storage areas A, B, and C above the 31 bit address line (or below said line) is to use the GETMAIN or STORAGE macro to dynamically obtain virtual storage LOC=31 or LOC=24 and then move the A, B or C contants to that area.
Usually, it's best to define contants that don't change (DC instruction) in your program, and variables that do change (DS instruction) in a DSECT, then use GETMAIN (or STORAGE, same thing) to obtain an area either above or below the 31 bit address line and load the address of the gotten area into the base register assigned to that DSECT via a USING instruction.