Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Static and Dynamic call in Assembler

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler
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    Post subject: Static and Dynamic call in Assembler
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: 2150
Location: At my coffee table

PostPosted: Tue May 18, 2010 7:01 pm    Post subject:
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: 2502
Location: Atlanta, Georgia, USA

PostPosted: Tue May 18, 2010 7:07 pm    Post subject: Reply to: Static and Dynamic call in Assembler
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    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts A not very Christmassy PL/I tale, wit... prino PL/I & Assembler 3 Mon Dec 26, 2016 1:01 am
No new posts REXX DB2: Dynamic allocation of DB2.D... BHAS CLIST & REXX 3 Mon Dec 19, 2016 8:26 pm
No new posts Cobol EZASOKET call to SETSOCKOPT fails Andi1982 COBOL Programming 6 Thu Oct 06, 2016 7:12 pm
No new posts Strange EXEC function call in z/VM Willy Jensen CLIST & REXX 3 Wed Oct 05, 2016 2:07 pm
No new posts COBOL DB2 - CALL statement - high CPU... TS70363 DB2 15 Sun Sep 11, 2016 6:07 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us