跌打滚爬中的小菜鸟...
分类: 系统运维
2012-10-31 19:04:59
四者是层次关系:
一个程序由一个或者多个Module链接而成;
一个Module则是由一个Source文件编译而成,
一个Source File是由一个mainline Procedure和若干subprocedures构成,或者直接由subprocedure构成。一般一个程序只能有一个mainline Procedure。
关于Procedure Subprocedure Module的理解:
The procedure specification is used to name and delineate RPG subprocedures. Zero or more subprocedures can be included in a source file. The term source file, as used in this text, refers to a single container of RPG source. It relates directly to an AS/400 source file member or to a plain ASCII text file on another computer operating system. When a source file is compiled, an object of type *MODULE is created. A machine-readable RPG program is created by linking (referred to as program binding) one or more modules.
Machine-readable RPG IV programs consist of one or more mainline procedures and zero or more subprocedures. The mainline procedure is the entry point of an RPG program. It is the area traditionally referred to as the mainline calculations, but also includes the file, input, definition, and output specifications. The mainline procedure is the same as the program name. Hence, when an RPG program is called, the mainline procedure is being evoked.
Subprocedures are isolated by beginning and ending procedure specifications. These subprocedures can be called through the CALLP or CALLB operations. In addition, when a procedure is prototyped, it is also considered a function, and can be evoked similarly to RPG built-in functions.
一个机器可识别的程序由一个或多个mainline procedures和零个或多个subprocedure组成。
一个机器可识别的程序由一个或多个Module Link而成,一个Module是由一个Source File编译而成,一个Source File可以包含零个或多个subprocedure。
P表定义的都是subprocedure。
关于多Module Program:
RPG IV programs consist of one mainline procedure and zero or more subprocedures. A source file can contain just the mainline procedure, the mainline procedure and one or more subprocedures, or only subprocedures. When only subprocedures exist within a source file, the header specification within that source file should include the NOMAIN keyword. This keyword instructs the compiler to avoid automatically inserting the RPG runtime support for the program logic cycle. The program logic cycle typically is not required and it adds unnecessary overhead to the compiled object.
一个程序能且仅能含有一个mainline procedure,如果该程序由多个Module Link而成,则只能有一个Module含有mainline procedure,其他Module则只能subprocedure。
Modules are defined at the source file level. RPG programs can call other programs dynamically or statically. They also can call subprocedures; however, all subprocedures require the static call interface.