View previous topic :: View next topic
|
Author |
Message |
HameedAli
Active User
Joined: 16 Apr 2009 Posts: 151 Location: India
|
|
|
|
Hi! Folks
Help me out in the following.
'PGMNAME' is the name of a PL/1 module.
Code: |
SOURCE = 'PGMNAME';
CALL SOURCE;
|
I checked in the manuals, it seems like, I will be only able to call a PL/1 modules, if I only pass the Program name directly to the call.
Is it possible to call the PL/1 module 'PGMNAME' using SOURCE? |
|
Back to top |
|
|
MBabu
Active User
Joined: 03 Aug 2008 Posts: 400 Location: Mumbai
|
|
|
|
See FETCH |
|
Back to top |
|
|
HameedAli
Active User
Joined: 16 Apr 2009 Posts: 151 Location: India
|
|
|
|
Even Fetch requires the actual Program name of PL/1. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
did You look at the declare part of the manuals ?
that' s where the issue is explained! |
|
Back to top |
|
|
HameedAli
Active User
Joined: 16 Apr 2009 Posts: 151 Location: India
|
|
|
|
I checked http://publibfp.boulder.ibm.com/epubs/pdf/ibm3pg70.pdf
In that XINFO in Page 74. I found this
For instance, given the program:
Code: |
defs: proc;
dcl (b,c) ext entry;
dcl x ext fixed bin(31)
init(1729);
dcl y ext fixed bin(31) reserved;
call b(y);
fetch c;
call c; end; |
Here we are still declaring the external entities and calling the Program by name and not by variable name. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
I can guarantee that it is possible to do it !
I should have a sample somewhere, if I can find it I will post it...
I do not remeber the exact syntax but it was an array of subroutines names
and they were called according to some kind of record type...
something along the lines of ( check the syntax on the manuals anyway)
Code: |
DCL 1 RECORD,
2 RECTYPE FIXED BIN(31)
2 .....
2 ..... ;
DCL FARRAY(....) EXTERNAL INIT('a,'b,'c',.....);
........
READ ....
CALL FARRAY(RECTYPE) ......
|
|
|
Back to top |
|
|
HameedAli
Active User
Joined: 16 Apr 2009 Posts: 151 Location: India
|
|
|
|
Sure, enrico-sorichetti.
I will be counting on you.
Would be of great help, if the following is achieved.
'PGMNAME' is the name of a PL/1 module.
Code: |
SOURCE = 'PGMNAME';
CALL SOURCE;
|
Provided I don't define the PGMNAME as an external entity, because in my requirement I will get to know the program to be called in the runtime. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Hi Hameed!
sorry for having given misleading info, the fingers were faster than the brain
or I execeeded my allowable multiprogramming level
the array I had ben working with/talking about was not an array of pli procedure names,
it was an array of pointers to assembler subroutines entry points
which was dynamically filled by a small assembler stub.
probably, the same result could be obtained for pl/1 procedures, but it would need a bit of investigation
and a study of the ASM to PL/I interlanguage communication facilities.
sorry again for the wrong info |
|
Back to top |
|
|
HameedAli
Active User
Joined: 16 Apr 2009 Posts: 151 Location: India
|
|
|
|
enrico-sorichetti, you need not feel sorry.
Most of the time, the guys in the forum have helped with exact answers.
So, I will not be disappointed for this. |
|
Back to top |
|
|
kiran.zadbuke
New User
Joined: 13 Aug 2008 Posts: 1 Location: India
|
|
|
|
Helllo Hameed,
Please declare your variable as below in program,
DCL SOURCE ENTRY VARIABLE;
DCL PGMNAME ENTRY EXTERNAL;
SOURCE = PGMNAME;
CALL SOURCE;
Please try above code. Thanks!
Cheers,
Mr.Kiran |
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1306 Location: Vilnius, Lithuania
|
|
|
|
kiran.zadbuke wrote: |
Please declare your variable as below in program,
DCL SOURCE ENTRY VARIABLE;
DCL PGMNAME ENTRY EXTERNAL;
SOURCE = PGMNAME;
CALL SOURCE;
Please try above code. |
Great way to make your presence know on these fora, giving an answer that is completely and utterly wrong. You might want to read the initial posting again, try to understand the question and only then reply. |
|
Back to top |
|
|
MBabu
Active User
Joined: 03 Aug 2008 Posts: 400 Location: Mumbai
|
|
|
|
If you can use a very short assembler program, i believe there is a way to declare a function based on a pointer. Then you just LOAD (SVC 6) the program using assembler (passing in the name) and call it from the PL/I program. Been many years since I used PL/I (over 25) so this may not be accurate, but the theory is sound .I used a PL/I-like language for many years that did this quite well - I don't know if PL/I itself does it. Of course, this is for dynamic loads, not statically linked subroutines. For statically linked, you'd need to use addr() and some sort of table lookup.
Note that if you dynamically load and run programs, be aware of the security implications. Don't allow someone to just pass in a program name and run it. That is an easily exploited security hole.
Disclaimer: Sorry, but this is all conjecture at the end of a very long week. I haven't looked anything up or done any research. |
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1306 Location: Vilnius, Lithuania
|
|
|
|
From the PL/I Language Reference V3R9M0 (SC27-1460-09):
Code: |
dcl A entry;
dcl B entry ext('C');
dcl T char(20) varying;
T = 'Y';
fetch A title('X'); /* X is loaded */
fetch A; /* A is loaded */
fetch B title('Y'); /* Y is loaded */
fetch B; /* C is loaded */
fetch B title(T); /* Y is loaded */ |
|
|
Back to top |
|
|
|