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

Difference between Entry and External Entry in PL/1


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   This topic is locked: you cannot edit posts or make replies.
View previous topic :: View next topic  
Author Message
satish.ms10

Active User


Joined: 10 Aug 2009
Posts: 184
Location: India

PostPosted: Tue Aug 25, 2009 6:07 pm
Reply with quote

Hi

I have some subroutines declared in my PL/1 program as below.

DCL RPFREAD ENTRY(*,*);
DCL RPFOPEN ENTRY(*);
DCL SGMGS EXTERNAL ENTRY(*,*);

Can any one explain the difference between Entry and External Entry statements in PL/1?
Back to top
View user's profile Send private message
Srihari Gonugunta

Active User


Joined: 14 Sep 2007
Posts: 295
Location: Singapore

PostPosted: Tue Aug 25, 2009 6:38 pm
Reply with quote

An external procedure is one whose text is not contained in any other block. The source text of an external procedure can be compiled separately from that of a calling procedure. The differences between internal and external procedures are as follows:

Before an external procedure can be invoked (except through an entry variable), its name must be declared within the procedure that invokes it. The DECLARE statement for the external entry name must also provide a list of parameter descriptors that give the data types of the parameters that the procedure requires, if any, as well as a RETURNS attribute for a function procedure.

You cannot explicitly declare internal procedures. The procedure name is implicitly declared by its occurrence in the PROCEDURE or ENTRY statement.

External procedures can reference the same variable only if it is declared (implicitly or explicitly) with the EXTERNAL attribute in all of them.
An internal procedure, on the other hand, can reference internal variables declared in any procedure in which it is contained.
Any procedure can call an external procedure.

An internal procedure can be called only by the procedure that contains it or by other procedures at the same level of nesting within the containing procedure. The only exception is invocation through an entry variable.
Back to top
View user's profile Send private message
prino

Senior Member


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

PostPosted: Tue Aug 25, 2009 7:09 pm
Reply with quote

Srihari Gonugunta wrote:
Before an external procedure can be invoked (except through an entry variable), its name must be declared within the procedure that invokes it. The DECLARE statement for the external entry name must also provide a list of parameter descriptors that give the data types of the parameters that the procedure requires, if any, as well as a RETURNS attribute for a function procedure.


  • it does not have to be declared, the compiler is in many instances smart enough to assume that it is dealing with external entries
  • a list of parameters is never compulsory
  • if no returns attribute is given, normal PL/I rules for identifier names are followed
Back to top
View user's profile Send private message
satish.ms10

Active User


Joined: 10 Aug 2009
Posts: 184
Location: India

PostPosted: Tue Aug 25, 2009 7:47 pm
Reply with quote

Thanks Prins,

Still I am not clear with the ENTRY and EXTERNAL ENTRY keywords.

Can you please clarify the difference between ENTRY and EXTERNAL ENTRY with an example?

Thanks in advance.
Back to top
View user's profile Send private message
sai.dara

New User


Joined: 24 Aug 2007
Posts: 12
Location: Hyderabad

PostPosted: Tue Aug 25, 2009 8:27 pm
Reply with quote

are you familiar with JCLs

External Entry is similar to Cataloged Procs and Entry is similar to Instream procs.

External Entry statement says that there is a submodule which will be used in this module. This external module is already coded, compiled and tested. Its definition is not coded in the current module. This helps in modularising your code, re usability of your code and thus easily maintained.

in your example it is DCL SGMGS EXTERNAL ENTRY(*,*);

Where as in

DCL RPFREAD ENTRY(*,*);
DCL RPFOPEN ENTRY(*);

these two submodules are defined/coded in the current module.
They are not visible outside this module.

is this clear ?

Thanks,
Sai
Back to top
View user's profile Send private message
satish.ms10

Active User


Joined: 10 Aug 2009
Posts: 184
Location: India

PostPosted: Wed Aug 26, 2009 9:45 am
Reply with quote

Hi Sai,


But all the three modules which I mentioned are coded outside of the current/main module.

Main module is just calling all the three submodules with CALL statement. It seems your answer need to correct.

Can anyone explain please?
Back to top
View user's profile Send private message
prino

Senior Member


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

PostPosted: Wed Aug 26, 2009 10:45 am
Reply with quote

Sai's answer is utter billshut and he obviously didn't even try to compile something like:
Code:
PRINO: PROC OPTIONS(MAIN) REORDER;
DCL IN ENTRY();
IN: PROC;
END IN;
END PRINO;


because it results in a

Code:
IBM1306I E          2  Repeated declaration of IN is invalid and will be
                       ignored.

error message.

The simple answer is that ENTRY declares are IMPLICITELY external, so there isn't one feck difference between

Code:
dcl entry entry;
and
Code:
dcl entry entry ext;
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Aug 26, 2009 3:33 pm
Reply with quote

why do You post the same question in multiple forums ?

choose one and stick to it
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   This topic is locked: you cannot edit posts or make replies. View Bookmarks
All times are GMT + 6 Hours
Forum Index -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts Timestamp difference and its average ... DB2 11
No new posts how to use Tso outtrap external function All Other Mainframe Topics 8
No new posts Difference when accessing dataset in ... JCL & VSAM 7
No new posts What is the difference between Taskty... Compuware & Other Tools 2
No new posts Difference between VALIDPROC and CHEC... DB2 3
Search our Forums:

Back to Top