Navigation:  Reference > Commands >

Write Records From An Array

Print this Topic Previous pageReturn to chapter overviewNext page


This command is used for writing to a group of records from array fields in memory.  Within this single command you can accomplish many tasks that would normally take many more lines of code and more time to execute.



WRTA f/c/e1, f/c/e2,..., f/c/ex Required - The fields in the array whose values are to be saved.  You may also create expressions that can be transferred to the receiving (TO) fields.  The first from field is paired to the first TO field, the second to the second, etc.  There must be the same number of from fields as TO fields.


TO fn/v1, fn/v1,..., fn/vx Required - These are the recipient fields in the record to be saved.  They must be of the same type as the respective from fields.  The first from field is paired with the first TO field, the second to the second, etc.  There must be the same number of TO fields as from fields.


RECA fn/vIf you want to update current records then you must provide an array of record numbers so this command can read the appropriate record before updating the fields and saving it back.  The record number can be obtained through the use of the RCN() function.


       NOTE:  If you read these records using the RDA (Array Read) command you may make one of the from fields the function RCN() and the corresponding TO field an R type array field to hold the record number.


MAXA f/c/eRequired - The number of array elements (or records) to be written.


CNTR fn/v This value is updated by the program during operation so that you may use expressions in the from field list.  Use this field as the array specifier where appropriate.  Must be of type I.


FILE fn/vThe handle/number of the file to be used.  If you do not include this option, the program will look for a default search file set in the SRCH  (Search File) command.  If a default file hasn't been previously set, the program will report an error and the command will be skipped.  This entry will override any default value set in the SRCH command.


FOR lexpr You would use this option to restrict the records written in this command.  If the expression did not resolve to .TRUE., the record would not be written and the program would continue to the next array element.  The process continues until all array elements (number_of_elements) have been checked and written if appropriate.


DISPIf you include this option, each time a record is ready to be written the program will redisplay the screen fields as appropriate.  This will slow down the operation of this command, with the amount of slow-down depending on how many fields are displayed on the screen.








Page url: