Moving records between files

David Duncan nacnuddd at gmail.com
Wed Apr 16 21:12:21 PDT 2008


Assuming you are able to select the file A records you want to send in
a batch to file B, you can do what you want with one procedure, say in
file A. (You should be able to incorporate the selecting process into
the procedure too.)

If both files contain the same fields in the same order, use an Export
statement containing in its formula an ?(info("visible") along with an
exportline( function to export your selected file A records into a
text file in the same folder as the file containing the procedure. It
would look like this:

Export "TempFile",?(info("visible"),exportline()+¶,"")

You then switch to file B (Openfile "B", if it's in the same folder as
A or is already open), open the text file and import the data using
the Openfile statement, either using the Openfile append option alone
if there are no numeric fields (Openfile "+Tempfile"), or using
Openfile append option preceded by the Importusing statement if there
are, as the export text file stores numeric values as text and you
have to explicitly reconvert the numeric values with the val( function
in the Importusing parameters. If the file A & B fields are in a
different order from one another Importusing allows you to reorder, or
even skip, fields.

Finally you can delete the intermediate file if you wish using
Filetrash or leave it to be overwritten next time you run the
procedure.

These statements are well documented in the Panorama Programming Reference.

David Duncan


More information about the Qna mailing list