ÜD SPEC Keywords

oVARYING

D varstr s 50A VARYING
C eval varstr = 'Amit Jaiswal'

Here, the maximum
length of the variable varstrwill be 50, but the
actual length can vary as per the value assigned to this variable. Here the
current size of variable will be the size of string “Amit Jaiswal”.

o*VARSIZE*VARSIZE has nothing to do with the data type of the variable. All it
does is disable the compiler's validity checking of the length.

oEXPORT & IMPORT

Exportindicates that the variable
has been defined (stored) in this module and will be used by some other module
which is importing this variable using Import
keyword.

Importindicates that the variable
has been defined (stored) in some other module and will be used here.

When we run the program SENDPGM then at runtime it checks if the
parameters are appropriately passed or not. If we change PARM “MSGID” to some other data type or
change its length, we will get the error but not at compile time. We will get
the error at run time and our program cannot continue further.

To make sure that the program doesn’t crash at run time, we detect the error at compile time itself by using prototyping.
This is depicted in Case2 below.

üCase2: Program with prototyping

To use prototyping, we do the following
modifications in the calling program SENDPFM.

Now when we compile
the program, we get the below error at compile
time.

**Error: The type and attributes of the parameter do not
match those of the prototype.

But the error that we have got here is at compile time
that is what we wanted.

oEXTPROC

If
you've built modules with commands like CRTRPGMOD, CRTCLMOD, CRTCBLMOD, and
CRTCMOD, you're accustomed to calling them with the CALLB op code. Just as you
can with CALL, you can replace CALLB with CALLP.