Calling the file.export.export RAD application

  • KM01150938
  • 04-Sep-2014
  • 04-Sep-2014

This document has not been formally reviewed for accuracy and is provided "as is" for your convenience.

Summary

The file.export RAD application is intended to be used with a schedule record or interactively. However, the file.export.export RAD application can be used without user intervention or run by a background process without the need of a schedule record.

Question

How do you export data to a text file using an export (descriptor) record without user interaction or a scedule record?

Answer

Use the file.export.export RAD application, passing these parameters:
target.file - the file variable for the data to be exported
name - the drive specification and name of the export text file to be created
text - create: to indicate that the text file should be created
record - the file variable for the export (descriptor) record

If the file variables are not available at the time of the call to the file.export.export, they can be generated by rtecalls.

Here is an example to export the records of vendor table where the vendor name starts with "In"

1. Initialize the file variable for the vendor table:
    $L.a=rtecall("rinit", $L.rca, $vendor, "vendor")

2. Select the vendor records:
    $L.b=rtecall("select", $L.rcb, $vendor, "vendor#\"In\"")

3. Initialize the file variable for the export table:
    $L.c=rtecall("rinit", $L.rcc, $exportrec, "export")

4. To avoid the need for the  \" syntax, use a variable to set a charater criterion for the name of the export (descriptor) record:
     $expname="VendorDataSet"

5. Select the export record:
    $L.d=rtecall("select", $L.rcd, $exportrec, "dataset.name=$expname")

6. Call file.export.export with these parameters
    target.file ... $vendor
    name ... c:\\temp\\vendor.txt
    text ... create
    record ... $exportrec

Note: An easy place to test this is in a Service Manager script record.