Problem:
Resolution:
Note that the technique is not case sensitive, but is more selective than a global edit, as the variable value will only be substituted where the compiler detects a valid variable location. For example, in the following program the string "IM" will be replaced with "200" wherever the context implies the presence of a variable name, but not in the name of the variable LETTER_IM, which is left unchanged, nor in the initial value of the variable BB_LETTER.DATA.
The precompiler can be invoked manually with the command MFPP, or automatically when using the MFPLX command, by passing the "-macro" option.
STATVAR: procedure options(main);
dcl sysprint stream print;
/*
Normal variable declaration and initialisation
*/
DCL AU FIXED BIN(15) INIT(155);
/*
Automatic structure with dynamic structure array bound
and iteration factor
*/
DCL 1 AA_LETTER (AU) ,
3 LETTER_ID CHAR (8) INIT((AU)((8)'A')),
3 DATA CHAR (16) INIT((AU)('AutoDataAutoData'));
/*
PreProcessor variable declaration and assignment
*/
�L IM CHAR;
%IM = '200';
/*
Static structure with dynamic element array bound,
and iteration factor
*/
DCL 1 BB_LETTER STATIC,
3 LETTER_ID (IM) CHAR (8) INIT((IM)((8)'B')),
3 DATA (IM) CHAR (16) INIT((IM)('StaticIMStaticIM'));
/*
Static structure with dynamic length and repetition factor
*/
DCL 1 CC_LETTER STATIC,
3 LETTER_IM CHAR (im) INIT((IM)'C');
PUT SKIP EDIT ('Array bounds are :- ')(A);
PUT SKIP EDIT ('AA_LETTER = ',
HBOUND(AA_LETTER.LETTER_ID,1))(COL(24),A,F(5));
PUT SKIP EDIT ('BB_LETTER = ',
HBOUND(BB_LETTER.LETTER_ID,1))(COL(24),A,F(5));
put skip;
PUT SKIP DATA(AA_LETTER(1));
PUT SKIP DATA(AA_LETTER(au));
put skip;
PUT SKIP DATA(BB_LETTER.LETTER_ID(1),BB_LETTER.DATA(1));
PUT SKIP DATA(BB_LETTER.LETTER_ID(im),BB_LETTER.DATA(im));
put skip;
PUT SKIP DATA(CC_LETTER.LETTER_IM);
end STATVAR;
#EnterpriseDeveloper
#MFDS
#OpenPLI
#Enterprise