IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to keep data above or below the line?


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
dinesh_mf

New User


Joined: 26 May 2005
Posts: 15
Location: maharashtra

PostPosted: Thu Aug 04, 2005 8:25 pm
Reply with quote

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.

All suggestions are welcome...


Regard,
dinesh Thakur
Back to top
View user's profile Send private message
ironmike

New User


Joined: 07 Aug 2005
Posts: 33

PostPosted: Sun Aug 07, 2005 6:07 am
Reply with quote

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.
Back to top
View user's profile Send private message
dinesh_mf

New User


Joined: 26 May 2005
Posts: 15
Location: maharashtra

PostPosted: Mon Aug 08, 2005 9:40 pm
Reply with quote

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.

Thank you very much,
Dinesh
Back to top
View user's profile Send private message
ironmike

New User


Joined: 07 Aug 2005
Posts: 33

PostPosted: Mon Aug 08, 2005 10:27 pm
Reply with quote

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.
Back to top
View user's profile Send private message
dinesh_mf

New User


Joined: 26 May 2005
Posts: 15
Location: maharashtra

PostPosted: Tue Aug 09, 2005 1:13 pm
Reply with quote

Ironmike,
Thanks a lot for your help. I learned a lot from you. Hope you will continue doing it.

Regards,

Dinesh
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts db2 vs static data COBOL Programming 1
No new posts External data queue (changes?) CLIST & REXX 0
No new posts Pull data using date difference betwe... DB2 6
No new posts fast data scrambling PL/I & Assembler 10
No new posts How to save SYSLOG as text data via P... All Other Mainframe Topics 4
Search our Forums:

Back to Top