ADELIA |
|
|
|
|
(I/B) |
|
|
|
|
Warning: This instruction can only be used in Adelia/400.
Section for use
All
Syntax
INSERT SpecificModule
Description
This instruction allows the insertion of external modules written in the same language as the 3GL which is to be generated (RPG).
When defining the modules, they can be stored in two ways:
either in a manner accessible by all models,
or directly associated with a model.
HA#DC3 | Module inserts by models |
||
|
|||
|
|||
Select options and press ENTER. |
|||
1=Select |
|||
|
|||
Opt |
Code |
Description |
|
_ |
BUPSAV |
Compute customer sales value |
|
_ |
DELCUS |
Delete records in customer file |
|
_ |
DSPCUS |
Display customer file |
|
_ |
DSPCU2 |
Display customer file and prospect file |
|
_ |
DSPPMC |
Display payment codes |
|
_ |
DSPPM2 |
Display payment codes |
|
_ |
PRTCUS |
Print customer list |
|
_ |
PRTSV |
Print sales values |
|
_ |
PRTSV2 |
Print sales values |
|
_ |
PRTSV3 |
Print sales values |
|
|
|||
F3=Exit F12=Cancel |
RPG modules by model
The module name (optional) must not exceed 8 characters. It is preceded by a specification of the type: /MOD ModuleName , with the "/" being in position 1.
When generating RPG
The source file containing the modules is called QRPGSRCX.
There are standard insertion points which can be directly associated with the model and which do not require the use of the INSERT instruction.
/MOD PGMFILE |
File specifications. |
/MOD PGMTABC |
Arrays loaded at compilation (values). |
/MOD PGMI |
E and I specifications (in that sequence). |
/MOD PGMDS |
Data structure specifications. |
/MOD PGMO |
Output specifications. |
Example
Here is an example of a RPG module (general modules):
/MOD TESTN
C* |
Control module for the instruction RPG TESTN |
C* |
INPUT: 30-character alpha variable to test @TEST |
C* |
OUTPUT: 1-character alpha variable W@CR which may |
C* |
have one of 4 values: |
C* |
A if digits preceded by blank characters |
C* |
B if entirely blank |
C* |
C if all digits |
C* |
D if not numeric |
C* |
|
C* |
Set variables to blank to store indicators |
C |
MOVE ' ' W@30 1 |
C |
MOVE ' ' W@31 1 |
C |
MOVE ' ' W@32 1 |
C* |
Set return code to blank |
C |
MOVE ' ' W@CR 1 |
C* |
Set the variable corresponding to indicator to '1' |
C |
30 MOVE '1' W@30 1 |
C |
31 MOVE '1' W@31 1 |
C |
32 MOVE '1' W@32 12 |
C* |
Set 3 indicators to OFF |
C |
SETOF 303132 |
C* |
Test variable for blank |
C |
@TEST IFEQ *BLANK |
C |
SETON 32 |
C |
ELSE |
C* |
Test first character of variable for blank |
C |
MOVEL@TEST W@@T1 1 |
C |
W@@T1 COMP ' ' 31 |
C* |
Transfer variable to a 30-character field |
C |
MOVEL*ZEROS W@@T1 1 |
C |
MOVEL@TEST W@@T |
C* |
Numeric test of the variable |
C |
TESTN W@@T 30 |
C |
END |
C* |
The 3 indicators OFF indicate error |
C |
N30N31N32 MOVE 'E' W@CR |
C* |
30 is ON so the field only contains digits |
C |
30 MOVE 'C' W@CR |
C* |
1 is ON so the field begins with blank characters |
C |
31 MOVE 'A' W@CR |
C* |
32 is ON so the field contains only blank characters |
C |
32 MOVE 'B' W@CR |
C* |
Reactivate correct value of indicators |
C |
W@30 COMP '1' 30 |
C |
W@31 COMP '1' 31 |
C |
W@32 COMP '1' 32 |
In the Adelia prototype:
* Numeric test of telephone number
VARIABLE_TESTN = Z_TELEPHONE_NBR
INSERT TESTN
* If return code is 'E', send message 0011
*
PREPARE_MSG 0011 Z_TELEPHONE_NBR
IF RET_CODE_TESTN = 'E'
ERROR
END
The variables are defined as follows:
@TEST |
VARIABLE_TESTN |
30 |
*NODEF |
W@CR |
RET_CODE_TESTN |
1 |
*NODEF |