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.
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?
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
Hello,
I mis-read your first post - sorry 'bout that
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. . .
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
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.
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?
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
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.
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
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?
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
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.
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
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...
Joined: 30 Aug 2010 Posts: 5 Location: Tobyhanna, PA, USA
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.