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
 

 

Call a PL/1 module using Variable name

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler
View previous topic :: :: View next topic  
Author Message
HameedAli

Active User


Joined: 16 Apr 2009
Posts: 151
Location: India

PostPosted: Fri Feb 12, 2010 10:34 am    Post subject: Call a PL/1 module using Variable name
Reply with quote

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
View user's profile Send private message

MBabu

Active User


Joined: 03 Aug 2008
Posts: 401
Location: Mumbai

PostPosted: Fri Feb 12, 2010 11:23 am    Post subject:
Reply with quote

See FETCH
Back to top
View user's profile Send private message
HameedAli

Active User


Joined: 16 Apr 2009
Posts: 151
Location: India

PostPosted: Wed Feb 17, 2010 2:07 pm    Post subject: Reply to: Call a PL/1 module using Variable name
Reply with quote

Even Fetch requires the actual Program name of PL/1.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Wed Feb 17, 2010 2:09 pm    Post subject: Reply to: Call a PL/1 module using Variable name
Reply with quote

did You look at the declare part of the manuals ?
that' s where the issue is explained!
Back to top
View user's profile Send private message
HameedAli

Active User


Joined: 16 Apr 2009
Posts: 151
Location: India

PostPosted: Thu Feb 18, 2010 4:51 pm    Post subject: Reply to: Call a PL/1 module using Variable name
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Thu Feb 18, 2010 6:25 pm    Post subject: Reply to: Call a PL/1 module using Variable name
Reply with quote

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
View user's profile Send private message
HameedAli

Active User


Joined: 16 Apr 2009
Posts: 151
Location: India

PostPosted: Thu Feb 18, 2010 10:46 pm    Post subject: Reply to: Call a PL/1 module using Variable name
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Fri Feb 19, 2010 1:56 am    Post subject: Reply to: Call a PL/1 module using Variable name
Reply with quote

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
View user's profile Send private message
HameedAli

Active User


Joined: 16 Apr 2009
Posts: 151
Location: India

PostPosted: Fri Feb 19, 2010 10:46 am    Post subject: Reply to: Call a PL/1 module using Variable name
Reply with quote

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
View user's profile Send private message
kiran.zadbuke

New User


Joined: 13 Aug 2008
Posts: 1
Location: India

PostPosted: Fri Mar 05, 2010 6:19 pm    Post subject:
Reply with quote

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
View user's profile Send private message
prino

Active Member


Joined: 07 Feb 2009
Posts: 984
Location: Oostende, Belgium

PostPosted: Fri Mar 05, 2010 10:38 pm    Post subject:
Reply with quote

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
View user's profile Send private message
MBabu

Active User


Joined: 03 Aug 2008
Posts: 401
Location: Mumbai

PostPosted: Sat Mar 06, 2010 3:44 am    Post subject:
Reply with quote

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 icon_rolleyes.gif .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
View user's profile Send private message
prino

Active Member


Joined: 07 Feb 2009
Posts: 984
Location: Oostende, Belgium

PostPosted: Sat Mar 06, 2010 3:57 am    Post subject:
Reply with quote

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
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 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 Copybook structure in Load module Vai123 COBOL Programming 7 Fri Sep 16, 2016 8:29 pm
No new posts Format to pipe delimited with variabl... pshongal SYNCSORT 6 Wed Sep 14, 2016 2:48 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