EXTERNAL Examples


Example 1:

 

JULNDATE

EXTERNAL

 

This instruction defines JUNLDATE as the name of a separately compiled module and the ROUTINE name used when it is called.

 

Example 2:

 

JDATE

EXTERNAL

"JULNDATE"

 

This instruction defines JULNDATEas the name of a separately compiled module that is referenced in the program as JDATE. The actual ROUTINE name in the separately compiled module is JULNDATE.

 

Example 3:

 

JDATE

EXTERNAL

"DATES;JULNDATE"

 

This instruction defines DATES as the name of a separately compiled module with a ROUTINE named JULNDATE that is referenced in the program as JDATE. The actual ROUTINE name in the separately compiled program is JULNDATE.

 

Example 4:

 

JDATE1

EXTERNAL

"DATE1|DATES;JULNDATE"

 

This instruction defines DATE1 as an alias for DATES that is the name of a separately compiled module with a ROUTINE named JULNDATE that is referenced in the program as JDATE1. The actual ROUTINE name in the separately compiled program is JULNDATE. If both JDATE1 in this example and JDATE in the previous example were both called from the same program, the external module DATES would be loaded twice thus enabling multiple instances of the same routine.

 

Example 5:

 

.

 

 

.Program: EXTTEST.PLS

.

 

 

.Associate a local label (JDATE1) with

. a label (JULNDATE) in an

. external module (DATES.PLC)

.

 

 

JDATE1

EXTERNAL

"DATES;JULNDATE"

.

 

 

.Call the External Routine

.

 

 

  

CALL

JDATE1

  

STOP

 

.

 

 

.Program: DATES.PLS

.

 

 

REPLY

DIM

1

.

 

 

JULNDATE

ROUTINE

 

  

KEYIN

*HD,*R,"JULNDATE routine called.",REPLY

  

RETURN

 

 

These two programs show the relationship between the main program EXTTEST) and the external module (DATES). Both modules may be compiled separately. The EXTERN statement in EXTTEST provides the correct linkage to the JULNDATE routine. It also defines the local label (JDATE1) used in the calling program. Execution of EXTTEST will result in a CALL to the JULNDATE routine in DATES.

 



PL/B Language Reference EXTEND Examples FILE Examples