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

Static and Dynamic call in Assembler


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

New User


Joined: 02 Jun 2006
Posts: 28

PostPosted: Tue May 18, 2010 2:39 pm
Reply with quote

Hi,

1) Can anybody please tell me what are static and dynamic calls in Assembler and how to achieve them?

2) How can we distinguish whether a call is static/dynamic in Assembler just by seeing the code?

Any help provided for the above questions is really appreciated.

Thanks,
Alok Agarwal
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Tue May 18, 2010 7:01 pm
Reply with quote

You got to LOAD before you BALR if it's dynamic......
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: Tue May 18, 2010 7:07 pm
Reply with quote

A Static Call, utilizes a VCON, which contains the address of the target sub-program, resolved at Link Edit time. In other words, the sub-program and the calling load module are merged as one. A BASR R14,R15 is used to call the static sub-program.

Code:

         L     R15,=V(SUBPROG)
         BASR  R14,R15

A Dynamic Call, utilizes an ADCON or simply loading the external sub-program into memory, via the MVS LOAD Macro, then using the load-point address (returned in R0) in a subsequent BASR.

Code:

         LOAD  EP=SUBPROG
         LR    R15,R0
         BASR  R14,R15

In both examples, once control is returned from the sub-program, R14 will contain the address of the "NSI" (Next Sequential Instruction) and R15 should contain a return-code value, set by the sub-program. The building of the R1 parmlist has been omitted as this should be an exercise for the poster.

In addition (amongst others), there's also the CALL and LINK Macro as well as the EXTRN directive.

Although BALR is still used quite extensively, BASR should be used going forward.

Bill
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 Using Dynamic file handler in the Fil... COBOL Programming 2
No new posts Error while running web tool kit REXX... CLIST & REXX 5
No new posts JCL Dynamic System Symbols JCL & VSAM 3
No new posts Call program, directly from panel CLIST & REXX 9
No new posts Build dataset list with properties us... PL/I & Assembler 4
Search our Forums:

Back to Top