Navigation:  Reference > Commands >

Add

Print this Topic Previous pageReturn to chapter overviewNext page

 

This command will add fields to the internal field list.  These fields may be a part of a file that has been opened or just for stand alone purposes.  This file could have been specified in the original program or could have been opened during the execution of the program.  Once the field is added you can access it almost as though it had been named in the original program.  An 'F' type pointer is returned and by using the field redirector (&) you can access that field for any purpose, including = (EQUAL).

 

 

ADD f/c/e Required - The name of the field being added.  Must conform to standard field name requirements.

 

TYPE f/c/eRequired - The type of the field being added.  Must conform to standard field type requirements.

 

SIZE f/c/eThe display size of the field being added.  Must conform to standard field display size requirements.  If this is not included then the default values for the type of field is 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 could affect the displayed value of the field.  Because of this, 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'.

 

FILE file_num The file number/handle for the field being added if it is part of a record.

 

KEY f/c/e If this field is a key you can specify the key number here.

 

OFST f/c/e If this field is part of a record then this is the starting location within the record.  The offset value for the first field in the record is 0.

                       NOTE:  In the TAS Professional data dictionary the offsets for the fields are properly set for this option; i.e., the first field in the record has an offset value of 0.

 

FPTR fn/vRequired - The field that will receive the pointer to the field being added.  Since you cannot access the field by name (it isn't known before being added), this pointer is returned and will allow you to execute all required commands through the use of the field redirector.  For example:

 

               ADD ... FPTR fldptr[cntr] ...

 

       where fldptr is of type F and an array.  Cntr is an integer (type I) field that is set to the appropriate value.  The field can be used later in an EQUAL command:

 

               &fldptr[cntr] = 'ABC'

 

 

COMMENTS

A basic concept in every TAS Professional program is that all fields have been specified when the program is compiled.  This restricts the possibilities of what might be done.  To get around this limitation this command has been added.  If the field being added is NOT from a file the program automatically allocates data space for it from that remaining available.  This DOES NOT take space from the temporary data space used when resolving expressions.

 

NOTE:  You need to specify, within the source file,  how many  'extra' fields can be added at runtime.  This is done through the use of the #ADD_FLDS compiler directive.  For more information please see the section in Chapter 4, Compiler Information on Compiler Directives.

 

 

 

 


Page url: http://www.cassoftware.com/tas/manual/add.htm