Settings of receiving in CSV format

When you convert a received file into CSV format, the host on the receiving side requires the CSV Environment Settings file (hulcsv.info), which defines the delimiters to set off fields as well as the text enclosure for fields.

Set the contents for each file ID that has to be converted. If the file ID is not set, the user's default value is applied. (Refer to User Default Value.) If there is no CSV Environment Settings file or the User Default Value is not set, the default value of each field is set. (Refer to Default value of each field.)

File Name

The name of the CSV Environment Settings file is 'hulcsv.info.' You cannot change this file name.

The CSV Environment Settings file is stored in the path where the system file of HULFT (HULPATH) exists.

Description Format

When there is a number sign (#) at the beginning of a line, it is considered to be a comment line. Blank lines are ignored.

Use a space code (0x20) or tab code (0x09) to separate the fields.

Record Layout

Since the CSV Environment Settings file does not contain any binary data, it can be created by an editor such as Vi. Records can be described multiple times within the CSV Environment Settings file.

Table 2.15 Record Layout

Field Name

Domain Length

Description Value

File ID

50

Uppercase alphanumeric characters (and "_" if desired) within 50 bytes.

Character to Separate Fields

5

One character, TAB, SPACE, or NONE

Space Character Omission

3

YES or NO

All Space Field Processing

3

YES or NO

Character Field Enclosed Character

1

One character or symbol

Suppress Preceding Zeros of Numeric Fields

3

YES or NO

Title Output

3

YES or NO

Note

Use a space code (0x20) or tab code (0x09) to separate the fields. The default value will be set when a description other than YES or NO is specified in the fields for which you need to select YES or NO. Refer to Default value of each field for more information on the default value of each field.

Explanation of each field

The explanation of each field is given below. Refer to Default value of each field for more information on the default value of each field.

File ID (FILEID)

Describe the file ID of the file that is to be converted to the CSV format using uppercase alphanumeric characters (and "_" if desired). Specify a character string within 50 bytes.

Character to Separate Fields (SEPARATE)

Describe a character or a symbol that is used as a delimiter between fields.

One character or symbol:

Use the specified character as a separator.

TAB:

Use a tab code (0x09) as a separator.

SPACE:

Use a space code (0x20) as a separator.

NONE:

No separator.

Space Character Omission (SPACECUT)

Specifies whether to remove trailing spaces in the following cases: a) When Field Type in the Format Information is set to 'X' (Character), 'M' (Variable-length Characters), or 'N' (Double-byte Graphic Characters) and there is a trailing space that comes after a value of a field, b) When data size becomes smaller than the specification in the Format Information after double-byte code conversion.

YES:

Remove trailing spaces that come after the field.

NO:

Do not remove trailing spaces that come after the field.

All Space Field Processing (ALL_SPACECUT)

Specify how to handle fields where only spaces are set if 'X' (Character), 'M' (Variable-length Characters), or 'N' (Double-byte Graphic Characters) is specified for Field Type in the Format Information.

YES:

Remove all space codes.

NO:

Set a single-byte space code as a field value.

The following specifications are valid only when Space Character Omission is set to 'Yes' (Remove trailing spaces that come after the field).

The space codes to be removed are as follows:

  • In the case of Shift-JIS

    • 0x20 (single-byte space code)

    • 0x8140 (double-byte space code)

  • In the case of EUC-JP

    • 0x20 (single-byte space code)

    • 0xA1A1 (double-byte space code)

  • In the case of UTF-8

    • 0x20 (single-byte space code)

    • 0xE38080 (double-byte space code)

  • In the case of GB18030

    • 0x20 (single-byte space code)

    • 0xA1A1 (double-byte space code)

Character Field Enclosed Character (SIEGE)

Specify a text enclosure to be used when 'X' (Character), 'M' (Variable-length Characters), or 'N' (Double-byte Graphic Characters) is specified for Field Type in the Format Information. Only a single-byte character can be used. When you do not want to use any text enclosures, specify 'N.' You cannot use a space code or 'N' as a text enclosure.

Suppress Preceding Zeros of Numeric Fields (ZEROCUT)

When 'B' (Binary), 'S' (Signed external decimal), 'P' (Signed internal decimal), 'F' (Floating point type), or '9' (Unsigned external decimal) is specified for Field Type in the Format Information and the field value is smaller than the predetermined number of display digits (see below), specify whether to pad the field with zeros (0) before a number.

YES:

Remove zeros (0) before a number.

NO:

Pad the field with zeros (0) before a number.

Table 2.16 Conversion Rules for CSV Format Conversion

Receive File (After Conversion)

CSV Data

Field Type

Byte Count

Specified Display Digits

F

Floating point type

4

21

8

30

P

Signed internal decimal

1–2

12

3–5

12

6–10

21

B

Binary type

2

12

4

12

8

21

S

Signed external decimal

1–4

12

5–9

12

10–18

21

= Remarks =
  • When 'F' (Floating point) is specified for Field Type, the number of digits after the decimal point is fixed to 9 digits. If the data exceeds the specified display digit count, handling of the number of digits below the decimal point will depend on the value of the data.

  • When 'P' (Signed internal decimal) type or 'S' (Signed external decimal) type is converted into '9' (Unsigned external decimal) type using the attribute conversion function, the predetermined number of display digits depends on the digits in the data. When it is not converted, it depends on the byte count of the field.

  • Signs ('-' only) and decimal points are included in the predetermined number of display digits.

  • Binary type data is processed as a signed data format.

Title output (TITLE)

Specify whether to output field names of the Format Information in the first line as the title line. However, the output of the title line is possible only when Transfer Type in the Send Management Information is 'F' (FORMAT).

YES:

Output the title line

NO:

Do not output the title line

User Default Value

When multiple file IDs with the same setup details exist in the CSV Environment Settings file, the same settings can be configured with one file ID by setting the file ID 'DEFAULTF' as the default value. If the file ID to be converted does not exist in the CSV Environment Settings file, the value 'DEFAULTF' is set.

When 'DEFAULTF' is not set in the CSV Environment Settings file, the Default value of each field is set.

Default value of each field

The default value of each setting value is given below. When the matching file ID does not exist or when the file does not exist, the default value is set as the setting value.

Table 2.17 Default Values for CSV Format Conversion

Field Name

Default Value

Explanation of Default Value

Character to Separate Fields

, (Comma)

Separate fields with commas (,)

Space Character Omission

YES

Remove trailing spaces that come after the field

All Space Field Processing

YES

Delete all spaces

Character Field Enclosed Character

" (Double quotes)

Enclose the field value with double quotes (")

Suppress Preceding Zeros of Numeric Fields

YES

Cut the '0' before the numerical value

Title Output

NO

Do not output the title line

CSV Format File

When the CSV format receive is executed, the CSV format file is created in the same directory as the Receive file. The file name of the CSV-format file will be '<receive file name>.csv.'

Setting Example

An example of the CSV Environment Settings file is given below.

# HULFT10 CSV Environment Settings File 
# 
# FILEID        : Receive File ID 
# SEPARATE      : Delimiter  *SPACE, TAB, NONE can also be used. 
# SPACECUT      : Space cut 
# ALL_SPACECUT  : All-space process 
# SIEGE         : Text enclosure 
# ZEROCUT       : Pre-zero cut 
# TITLE         : Title line output 
# 
# Default Value : SEPARATE        = , 
#               : SPACECUT        = YES 
#               : ALL_SPACECUT    = YES 
#               : SIEGE           = " 
#               : ZEROCUT         = YES 
#               : TITLE           = NO 
# 
#FILEID  SEPARATE  SPACECUT  ALL_SPACECUT  SIEGE  ZEROCUT  TITLE 
#|       |         |         |             |      |        |
SAMPLE   ,         YES       YES           "      YES      NO 
NAME     ,         YES       YES           "      YES      YES 
NAME2    ;         NO        NO            '      YES      NO 
ADDRESS  :         YES       NO            '      NO       NO 
DEFAULTF ;         NO        YES           N      YES      YES

Note

  • Do not set 'I' (Image (No Conversion)) to the field type of Format Information, since an error occurs during CSV Format Conversion processing.

    This is because 'I' (Image (No Conversion)) indicates an image (not converted at the time of transfer), and the data may contain the above-mentioned text enclosures or delimiters.

  • During CSV conversion, if there is a NULL character (0x00) in the data, data will be processed only up to that point.

  • If "Unrecoverable Mode" (1) is specified for Transfer-Related File Deletion Mode (trnsfr_file_del) in the System Environment Settings, and you need to delete data that is received during the processing, you cannot recover the deleted data.