Specifying a File Name

This document covers the following topics:

The format of a file is determined by its extension.


Downloading Data Using a Dialog Box

You can download data to a file, a printer or directly to Excel.

If you download data to a file and no file name has been associated with the work file number used in a Natural program, a dialog box prompts you for a file name at execution time. The Natural work file number is shown in brackets in the title bar.

Download Data

Start of instruction set To download data to a file

  1. Make sure that the download destination File is selected.

  2. In the File name text box, enter the name of the file in which the data are to be stored on the PC.

    If you do not specify a path, the file is stored in the current directory.

  3. Choose the desired file type from the Save as type drop-down list box.

  4. Specify the format that is to be used.

    If the Use DOS (OEM) download format check box is not marked, the ANSI character set is used. This character set is used by all Windows applications.

    If this check box is marked, the DOS character set is used. This character set is used by most MS-DOS applications.

  5. Choose the Download button.

    The data are downloaded to the specified file.

Start of instruction set To download data to a printer

  1. Leave the File name text box empty.

  2. Select the Printer option button.

    Download Data to Printer

  3. Optionally: choose the Setup button to select another printer or define another orientation (e.g. landscape).

  4. Mark the Interpret control characters check box, if  you want to download a Natural report containing control characters. Valid control characters are:

    Control Character Function
    1 New page
    blank Single blank line
    0 Double blank line
    - Triple blank line
  5. Choose the Download button.

    The data are downloaded to the specified printer.

Start of instruction set To download data directly to Excel

  1. Leave the File name text box empty.

  2. Select the Excel application option button.

    Download Data to Excel

  3. Choose the Download button.

    When download is complete, Excel is automatically started and the data are shown in an untitled Excel workbook.

  4. Save the downloaded data in Excel.

    Note:
    A format file (extension ncf) is not created in this case.

Uploading Data Using a Dialog Box

If no file name has been associated with the work file number used in a Natural program, a dialog box prompts you for a file name at execution time. The Natural work file number is shown in brackets in the title bar.

Upload Data

Start of instruction set To upload data to a file

  1. In the Upload Data dialog box, select the file to be uploaded.

  2. Specify the upload format that is to be used.

    If the Use DOS (OEM) download format check box is not marked, the ANSI character set is used. This character set is used by all Windows applications.

    If this check box is marked, the DOS character set is used. This character set is used by most MS-DOS applications.

  3. Choose the Upload button.

Specifying a File Name Using the SET Command

Natural programs download or upload data by referring to the number of a work file or printer file. This number must be an integer between 1 and 32. You can define up to 32 work files and up to 31 printer files.

A file name can be associated with several numbers for work files and printer files. The number of a work file or printer file, however, can only be associated with one file name.

Start of instruction set To associate a file name with the number of a work file or printer file

  • Issue the SET command using the following syntax:

    SET PCFILE x DOWN DATA filename
    SET PCFILE x UP DATA filename
    SET PCFILE y DOWN REPORT filename

    where x is a valid work file number, y is a valid printer file number, and filename is a valid file name. There is no warning if a file with that name already exists.

    filename can be specified either with or without the path to the file. For example:

    SET PCFILE 7 DOWN DATA C:\test\mydata.ncd

    filename can also contain the name of an existing environment variable. The environment variable must be enclosed in percent signs (%). The environment variable may contain only a file name, only a path without a file name, both path and file name, or any part of filename. For example:

    SET PCFILE 7 DOWN DATA %TEMP%\mydata.ncd

    When the current value of the environment variable TEMP in the above example is "C:\Users\Jack\AppData\Local\Temp", the path and file name for the download is set to "C:\Users\Jack\AppData\Local\Temp\mydata.ncd". When the environment variable contains only a path (as in the above example), make sure to specify a backslash (\) before the file name.

    If an environment variable with the given name is not found, the name including the percent signs remains as specified. For example, SET PCFILE 7 DOWN DATA %UNKNOWN%\mydata.ncd would set the path and file name for this download to "%UNKNOWN%\mydata.ncd".

    When you download data directly to your local printer, you must specify PRN, LPT1, LPT2 or LPT3 as the file name. If the first character in the downloaded data is to be interpreted as a printer control character, you must specify *PRN, *LPT1, *LPT2 or *LPT3 as the file name.

    The file name remains associated with the specified work file number until you leave Entire Connection or until the SET command is issued to reset the work file.

    Note:
    To associate a file name with a printer file number, use DOWN REPORT.

Start of instruction set To reset the work file or printer file

  • Issue the SET command without specifying a file name.

    The following commands reset the file numbers defined above:

    SET PCFILE x DOWN DATA
    SET PCFILE x UP DATA
    SET PCFILE y DOWN REPORT

    where x is a valid work file number, and y is a valid printer file number.

Start of instruction set To specify an XSL style sheet type and name for download to XML

  • Issue the SET command using the following syntax:

    SET PCFILE x DOWN CONVERT stylesheet-type stylesheet-name

    where x is a valid work file number, stylesheet-type is the type of the style sheet (for example, "text/xsl") and stylesheet-name is a valid file name. There is no warning if a file with that name does not exist.

    Example:

    SET PCFILE 7 DOWN CONVERT text/xsl employ.xsl

    This inserts the following the style sheet definition in all downloaded XML files:

    <?xml-stylesheet type="text/xsl" href="employ.xsl"?>

    The style sheet type and name remain associated with the specified work file number until you leave Entire Connection or until the SET command is issued to reset the work file.

Start of instruction set To reset the XSL style sheet type and name for download to XML

  • Issue the SET command without specifying a style sheet type and name:

    SET PCFILE x DOWN CONVERT

    where x is a valid work file number.

Creating a File Name Dynamically

You can instruct Entire Connection to dynamically create a file name at download time. In this case, the file name consists of the date and time the file was created. The format is DDHHMMSS (DD = day, HH = hour, MM = minute, SS = second).

Start of instruction set To create a file name dynamically

  • Issue the following command:

    SET PCFILE x DOWN DATA ~~RANDOM.ext

    You can specify an extension (optional). You must not specify a drive or directory.