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

Dynamically calling an Assembler program from JCL


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: Fri Aug 19, 2011 12:19 pm
Reply with quote

Hi,

I am aware that we can call a COBOL program dynamically from JCL using DYNAM option, passed in PARM as below:

//STEPNAME EXEC PGM=IGYCRCTL,PARM=DYNAM

Can we do the same in assembler as below:

//STEPNAME EXEC PGM=ASMA90,PARM=DYNAM

We assume that the required load libraries are mentioned in the STEPLIB. I am aware how we can make a call dynamic using the code in the program but here our purpose is to make this call dynamic using the JCL.

Thanks,
Alok Agarwal
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Fri Aug 19, 2011 12:42 pm
Reply with quote

Hello,

JCL cannot issue a "call". Load modules (nothing to do with pl/1 or assembler) are invoked by the EXEC statement in JCL.

If this could be done, how might it be used?
Back to top
View user's profile Send private message
alokagarwaljgd

New User


Joined: 02 Jun 2006
Posts: 28

PostPosted: Fri Aug 19, 2011 1:20 pm
Reply with quote

Correct. What I meant was we can dynamically load a sub-program using JCL by using compiler option DYNAM as mentioned above. If we want to do the same thing in Assembler, can we code as below?

//STEPNAME EXEC PGM=ASMA90,PARM=DYNAM
Back to top
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1315
Location: Vilnius, Lithuania

PostPosted: Fri Aug 19, 2011 1:34 pm
Reply with quote

Have you actually bothered to read a manual to see if the High Level Assembler supports a parameter with the value 'DYNAM'?

The question is rhetorical... (But both you and I know the answer!)
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Fri Aug 19, 2011 1:41 pm
Reply with quote

Hello,

I mis-read your first post - sorry 'bout that icon_redface.gif

I don't know the answer to your question about assembler, but what happens when you try this? As long as you are working in a test environment with a new module name, there shouldn't be a problem.

I suspect you may need to use a LOAD and provide the entry point as a PARM. Been quite a while, so i may be way off. . . icon_neutral.gif
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Aug 19, 2011 1:43 pm
Reply with quote

alokagarwaljgd wrote:
Hi,

I am aware that we can call a COBOL program dynamically from JCL using DYNAM option, passed in PARM as below:

//STEPNAME EXEC PGM=IGYCRCTL,PARM=DYNAM

Can we do the same in assembler as below:

//STEPNAME EXEC PGM=ASMA90,PARM=DYNAM

We assume that the required load libraries are mentioned in the STEPLIB. I am aware how we can make a call dynamic using the code in the program but here our purpose is to make this call dynamic using the JCL.

Thanks,
Alok Agarwal


I think you are confused.

What the DYNAM parameter does, when passed to the Cobol Compiler is to make all "CALL 'literal'" calls in the program being compiled "dynamic calls". The only possible "static" calls are "CALL 'literal'" and this is how you get the compiler to generate code to do a "dynamic call" to the sub-program specified in each literal.

If you have an Assembler program and you want to do a dynamic call, it is different as you are doing the code, there is no compiler involved. So, look at the macros.

The "dynamic" part is only relevant once the call is processed from a load-module. EXEC PGM=XXX, XXX calls "YYY", Cobol, compiled with DYNAM, and YYY will be "dynamically loaded" (once, unless you arrange otherwise) from the libraries specified on the STEPLIB (or you get S806).

Unless you can be explicit about what you are trying to achieve, without all your somewhat "off" pre-conceptions about how things work, I don't think you'll be able to find much help.

Terminology is important for understanding. If you do not understand the terminology, don't use it but fully explain in English. If you misuse terminology everyone ends up up-the-creek and upset over time wasted.
Back to top
View user's profile Send private message
alokagarwaljgd

New User


Joined: 02 Jun 2006
Posts: 28

PostPosted: Fri Aug 19, 2011 3:47 pm
Reply with quote

Quote:
Have you actually bothered to read a manual to see if the High Level Assembler supports a parameter with the value 'DYNAM'?

The question is rhetorical... (But both you and I know the answer!)


Yes, I did search for "DYNAM" it in POO- Dz9zr008 but didn't get the required info. - would request you to provide a link where I can know "if the High Level Assembler supports a parameter with the value 'DYNAM'?

It is quite possible that you know the answer but definitely not me else, I would not have the question in first place itself.

Hi Bill,
I am sorry, if there was a confusion. What I was trying to understand is as in case of COBOL, the DYNAM parameter can be used for dynamically loading the sub-program(compiled with DYNAM), can we do the dynamic loading in the same manner for Assembler also?

Quote:
If you have an Assembler program and you want to do a dynamic call, it is different as you are doing the code, there is no compiler involved. So, look at the macros.


And what I understand now is that, no option such as DYNAM/NODYNAM exists in case if we are compiling an assembler sub-program.

I am aware of the process of making a dynamic call in assembler i.e. using the LOAD macro.

Please let me know if my understanding (underlined above) is correct. In case my above understanding is incorrect, can you please give an example of JCL using DYNAM/NODYNAM parameter for assembler program?

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

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Aug 19, 2011 4:10 pm
Reply with quote

Perhaps if you were to read the HLASM Programmer's Guide you would learn the difference between compile and assembly.

You are treated with distain, because you show us no respect.
one is expected to at least have looked at the language references and programming guides
for a programming language.
after that, based on the terminology used,
it is obvious if the TS has done any homework
or expects a solution - the code -
without expending any effort to understand.

The REDBOOK series of ABC's of z/OS Programming would be a good place for you to start.

it is tiresome to answer questions that are obviously based on little or no knowledge,
and the expectation that everything is so simple,
just need a little explanation.

an example:

there is a big difference between JCL EXEC Parms that affect the processing methodologies,
and a Program Parm that only the program uses.

not knowing that,
showed a huge lack of understanding.
expecting us to provide you a solution/answer in just a few words,
when the background information is contained in many volumes,
shows little or no respect for our knowledgebase.

actually, your arogance turned me off. but, nevertheless,
i remain civil in my comment.
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: Fri Aug 19, 2011 4:13 pm
Reply with quote

If you use your method to Dynamically load a given module (regardless of the language), in a STEP for subsequent use in the next STEP, how would you establish addressability to this pre-loaded module? How have you obtained the load address?

As you've said, the MVS Load Macro will perform this for you natively in Assembler or as a called sub-program from a HLL.

As a footnote, COBOL/370 introduced PROCEDURE-POINTER (not to be confused with POINTER), which is very similar to the Load Macro, but should NEVER be used in CICS (like the Load Macro).

But, I'm still scratching my head as to what this buys you?

Bill
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Fri Aug 19, 2011 4:52 pm
Reply with quote

Quote:
what I understand now is that, no option such as DYNAM/NODYNAM exists in case if we are compiling an assembler sub-program.
A COBOL program with NODYMAN using a literal call (CALL 'ABC' USING ...) is done in Assembler via the V-type addressing constant. A COBOL program with DYNAM, or using a variable call (CALL WS-PROG USING ....) is done in Assembler via the CALL macro. You cannot do this via options when assemlbing your program, you must write actual Assembler code to handle either situation. This is one reason many people prefer higher-level languages such as COBOL -- so they don't have to deal with all the details.

You should go to the Beginners and Students Forum instead of this one, as it would be more suited for the questions you are asking.

You need to read, digest, and understand several THOUSAND pages of manuals -- such as the Principles of Operation SA22-7832, Assembler Services References (SA22-7606, SA22-7607), and the Assembler Services Guide SA22-7605 -- in order to figure out why your understanding (and your question) is so wrong.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Aug 19, 2011 5:42 pm
Reply with quote

alokagarwaljgd wrote:
[...]
what I understand now is that, no option such as DYNAM/NODYNAM exists in case if we are compiling an assembler sub-program.
[...]


Alok,

Others have covered this already. There is a very big difference between a Compile and an/the Assembler.

With a compiler, you write more-or-less English-like code, which the compiler takes and generates the necessary instructions without you having to deal with it much more. Compilers have "options" so that in certain circumstances you can influence the code that is generated, like in the example of DYNAM/NODYNAM for a Cobol CALL 'literal'.

When writing in Assembler you have to do everything yourself, subject to the availability of macros, but still you have to chose those and what parameters to give them.

You Compile a "high-level language".

You Assemble assembler.

You cannot Compile assembler. If you could, the "Compiler" would generate identical code, just with less obvious names...
Back to top
View user's profile Send private message
Roger W Suhr

New User


Joined: 30 Aug 2010
Posts: 5
Location: Tobyhanna, PA, USA

PostPosted: Tue Oct 04, 2011 9:12 am
Reply with quote

Nope that is incorrect.

In COBOL the PARM=DYNAM tells the compiler that dynaic calls to subprograms MAY be coded in te program to be compiled. This allows the compiler to optimize the object code for the possible presence of dynamically calle routines. The actual linkage is determined by the syntax of the CALL command.

There ias no such parm for the assembler. Assembler does not check whether subroutiines are to be linked statically (CALL macro), or dynamically (LINK or LOAD macro) to the program.
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 Error to invoke MPP program through B... IMS DB/DC 3
No new posts Dynamically build sort control statem... SYNCSORT 18
No new posts Using API Gateway from CICS program CICS 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Calling Java method from batch COBOL ... COBOL Programming 5
Search our Forums:

Back to Top