Create a Format Map to Import a CSV File
The data import file type allows you to define a layout of the specific data coming in that will be written to a fixed position native file. The program parse the incoming data, based on the delimiter, and pad the incoming field to the length you specify. Data is written to a fixed position record based the on the layout you define.
When importing numbers, you must consider the sign byte and, when bringing in a fractional number, the decimal point. Examples: if you bring in a 4-digit number, the field length written to the text file needs to be 5 to accommodate the sign byte. If you bring in a 4.2 number, the length should be 6 to accommodate the sign byte and the decimal point.
The interim work file is named 02m+batch_name. The Output file name and Output directory you specify is what the interim work file will be renamed to after the input file had been imported.
The record length is fixed at 2048 and the fie is created as a text (i.e., native) file.
If you specify an update program, it will be called after the import is competed. It will need to use the Output file name and directory.
When you run Format Mapping Maintenance (XMAP), these fields are displayed:
Field Name |
Displays |
Format no |
The name or number of the format |
Description |
The description of the format |
Type |
Mapping type: |
Type |
File type: |
Choose the appropriate options:
To |
Do This |
Add a file format |
Click Add. |
Delete a format |
Highlight the line and click Delete. See Delete. |
Copy a format |
Highlight the line and click Copy. See Copy. |
Display a format |
Highlight the line and click Select or double click the line. |
Print the list of formats |
Click Print. See Print. |
Exit the program |
Click Exit. |
Enter/review data in these fields:
Field Name |
Type / Max Length |
Action / Description |
Format number |
Required |
Enter a name or number for this format. This field cannot be changed after the format is created. |
Description |
Required |
Enter the description of the CSV file you are mapping. |
Mapping type |
Required |
Select C Custom to map a CSV file. |
Type |
Required |
Select D Data import. |
Output file name |
Required |
Enter a name for the file that will be created. |
File type |
Display |
The file created is T Text (i.e., native) type. |
Record length |
Display |
The file size is 2048. |
Key size |
Display |
The key size is 0. |
Output directory |
Optional |
Enter a native directory on which the file will be created. |
File seq size |
Required |
Accept the 0 default. |
Delimiter |
Optional |
Enter T for Tab. |
Update program |
Optional |
Enter the name of a program to be called after the import is complete. |
Log report |
Optional |
Not currently used. |
Choose the appropriate options:
To |
Do This |
Change a field |
Move the cursor to the field and make changes. Click Apply to accept or click Cancel to abandon changes. |
Delete a saved record |
Click Delete. See Delete. |
Enter or change the file layout |
Click Layout. See Enter Mapping File Layout. |
Accept the data |
Click OK. The program returns to the Format number field if this was a newly added format; it returns to the list of formats if you viewed or maintained an existing format. |