Use this command to change a field previously defined within a program. This command will work only with DEFINE'd fields. The command will allow you to change any part of the field: size, type, etc., even the number of array elements. It is generally used in situations where you don't know how large a field you might need and don't want to take up space before it is needed. Also, you can REMVA (Remove Array) an allocated field during runtime. This capability is useful when you know you need to chain to other programs and might not have enough room if the field is at a set size.
|ALLOC fn/v||Required - The name of the field being allocated. This field must be previously defined within the program.|
|TYPE f/c/e||Required - The type of the field being allocated. Must conform to standard field type requirements. Note: Must me in quotes ''|
|SIZE f/c/e||The display size of the field being allocated. Must conform to standard field display size requirements. If this is not included then the default values for the type of field are used.|
|DEC f/c/e||If the field is of type N you can specify the number of decimal characters. If this isn't included the default value is 0. This will affect the displayed value of the field and you should take great care to make sure the proper value is used.|
|ARRAY f/c/e||The number of array elements for this field.|
|UP f/c/e||If this is a type 'A' field you may specify whether all characters entered to it are to be automatically forced into upper case. To accomplish this, make this value 'Y'.|
Typically you would include a group of single character alpha fields in a program. At time of need, these fields could be changed using this command. To see if the command succeeded, check both the size of the field and the number of array elements allocated using the appropriate functions available. These fields are allocated into available memory and DO NOT take any space away from temporary data space used while resolving expressions. You want to start with as small a field as possible since the space originally used by that field will be unusable.
when we use alloc we must put the type value in ''
ALLOC myfield type 'N' size 10 dec 2 array 10
if you forget the '' you will get an error when you compile.