View Full Version : Unclear what the keyword EXTPGM is used for.
Guest.Visitor
01-01-1995, 02:00 AM
Could someone please explain what the keyword EXTPGM does and how it is used. After reading the IBM documentation can still not get an example to compile. Says name not defined. Regards
Guest.Visitor
06-25-2000, 05:21 PM
"The EXTPGM keyword indicates the external name of the program whose prototype is being defined." - The Manual. There are two ways that you use it that I can think of. First is to indicate that a prototype is describing a dynamic program call. This is the prototyped version of the olde CALL opcode. The other is to define the "main" procedure parameters for a module. This is the prototyped version of the olde *ENTRY PLIST. eg. <PRE> *------------------------------------------------------------------------- D ExecCmd PR EXTPGM( 'QCMDEXC' ) D Command 32702A CONST OPTIONS( *VARSIZE ) NOOPT D CommandLen 15P 5 CONST NOOPT D IGC 3A CONST OPTIONS( *NOPASS ) NOOPT C CALLP ExecCmd( 'DSPJOB' : 6 ) C C RETURN *------------------------------------------------------------------------- </PRE> The EXTPGM tells the compiler that when it sees CALLP ExecCmd, it is to do a call to *PGM object QCMDEXC. <PRE> *------------------------------------------------------------------------- D Main PR EXTPGM( 'TEST1' ) D 32A CONST D Main PI D Cmd 32A CONST D ExecCmd PR EXTPGM( 'QCMDEXC' ) D Command 32702A CONST OPTIONS( *VARSIZE ) NOOPT D CommandLen 15P 5 CONST NOOPT D IGC 3A CONST OPTIONS( *NOPASS ) NOOPT C CALLP ExecCmd( Cmd : %SIZE(Cmd) ) C C RETURN *------------------------------------------------------------------------- </PRE> In this case you create a program called TEST1 ( this must match the name in extpgm(...) ) with this source member as the entry point (and in this case only) module. It accepts a single 32 character parameter, assumes it is a CL command and executes it. To run the second one from command line this should work: CALL TEST1 'WRKJOB' silly2
Powered by vBulletin® Version 4.1.5 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.