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

Is Addressing Issue depends on nature of COBOL call?


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
razesh84

New User


Joined: 05 Apr 2010
Posts: 41
Location: Kolkata,India

PostPosted: Sun Sep 09, 2012 11:13 pm
Reply with quote

Hello all,

Last week I learnt something new & want to share it and also clear my doubt.

Now a cobol program designed to use both above & below the 16MB line memory will(may?) have problem calling a cobol program which is designed to use only memory below the 16MB line.I found its true only when your sub programs are dynamically called.In case of static call,there will be no addressing issue.

I had a main program compiled with[DATA(31),RENT,RMODE(AUTO),NODYNAM] statically calls a subprogram[call 'literal']
compiled with[DATA(24),RENT,RMODE(24)] without any issue.Now per above compiler options dynamic storage for main program will be above the line & for called program below the line.So, my job should abend while calling the subprogram.But the job runs ok when the call is static only abends when it is dynamic.

So my question is, in this scenario where will be dynamic storage allocated for both calling & called programs.
If it is below the line then can I conclude that while compiling any cobol program the COBOL compiler also checks what are the module it calls & their compilation options or something similar happens.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Sun Sep 09, 2012 11:50 pm
Reply with quote

A Statically-Called sub-program always takes on the characteristics of the Caller and this is why you do not experience a S0C4, as the entire load module of the Caller and sub-program are one module.

A Dynamically-Called sub-program (Data (24)), will raise a S0C4 while attempting to address 31-Bit parm-data passed by the Caller, as the sub-program does not take on the caller's characteristics (as opposed to a static call), making the sub-program's characteristics independent of the caller's. Keep in mind if the caller was passing 24-Bit parm-data, the sub-program would be able to address this, regardless whether it was 24-Bit or 31-Bit.

To make a long story short, 24-Bit programs cannot address 31-Bit data.

HTH....
Back to top
View user's profile Send private message
razesh84

New User


Joined: 05 Apr 2010
Posts: 41
Location: Kolkata,India

PostPosted: Mon Sep 10, 2012 12:45 am
Reply with quote

Thanks Bill for the quick reply

Quote:
the entire load module of the Caller and sub-program are one module

so the single load module will be allocated over 16MB line taking caller's attribute.right?

Next question is where the dynamic storage would be allocated for both programs & would that be a one single memory area for both programs or separate area?

I read somewhere in IBM manual if your program is compiled with RENT then the load module & the working storage would acquire separate storage and location of working storage depends on DATA option.

In my case, as my caller & called program are compiled with RENT, so both caller & called program's working storage would be separate to their load module.Now, where it will be allocated over or below the line?Since it is passing data successfully in static calls I assume that both are in the same region[either above or below the line]

can you please confirm ?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Mon Sep 10, 2012 12:55 am
Reply with quote

From the Enterprise COBOL Programming Guide manual, section 1.2.6 Storage and its Addressability:
Quote:
Addressing mode (AMODE) is the attribute that tells which hardware addressing mode is supported by your program: 24-bit addressing, 31-bit addressing, or either 24-bit or 31-bit addressing. This attribute is AMODE 24, AMODE 31, or AMODE ANY, respectively. The object program, the load module, and the executing program each has an AMODE attribute. All Enterprise COBOL object programs are AMODE ANY.

Residency mode (RMODE) is the attribute of a program load module that identifies where in virtual storage the program will reside: below the 16-MB line, or either below or above. This attribute is RMODE 24 or RMODE ANY.

You will also want to read 4.1.3.2.2 When to use a dynamic call with subprograms in the same manual.

Also you need to know that the linkage editor / binder is the FINAL arbiter on AMODE and RMODE and hence you need to review the linkage editor / binder output, not just the compiler output, to determine the final AMODE and RMODE. From 2.4.44 RENT in the same manual:
Quote:
DATA and RMODE settings: The RENT option interacts with other compiler options that affect storage and its addressability. When a reentrant program is to be run with extended addressing, you can use the DATA(24|31) option to control whether dynamic data areas are allocated in unrestricted storage or in storage obtained from below 16 MB. Compile programs with RENT or RMODE(ANY) if they will be run with extended addressing in virtual storage addresses above 16 MB.

To summarize: the interactions between the various compile options, as well as linkage editor / binder options, is complex and not always intuitive.
Back to top
View user's profile Send private message
razesh84

New User


Joined: 05 Apr 2010
Posts: 41
Location: Kolkata,India

PostPosted: Mon Sep 10, 2012 1:26 am
Reply with quote

From the manual 4.1.3.3 Amode switching
Quote:
if you are using a dynamic call from an AMODE 31 COBOL program to an AMODE 24 COBOL program, the AMODE is automatically switched.

Can you please explain the above line

I'll check the linker output tomorrow but as far i remember when i checked load library the main program had AMODE-31/RMODE-ANY & the subprogram had AMODE-24/RMODE-24[after statically called]
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Mon Sep 10, 2012 1:45 am
Reply with quote

Quote:
load library the main program had AMODE-31/RMODE-ANY & the subprogram had AMODE-24/RMODE-24[after statically called]


a SUBprogram statically called has no place in a load library
Back to top
View user's profile Send private message
razesh84

New User


Joined: 05 Apr 2010
Posts: 41
Location: Kolkata,India

PostPosted: Mon Sep 10, 2012 2:08 am
Reply with quote

yes enrico thats true

Well you can say that i'm little puzzled right now icon_confused.gif
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Sep 10, 2012 2:21 am
Reply with quote

Hello,

It will be more understandable when you are back on the system and can test and observe and not rely on memory icon_wink.gif
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top