You can create an entity using a COBOL flat file that has a companion COBOL copybook (schema).
Before you issue the loaddata
command, create a loader connection for
your COBOL data source. The loader connection specifies where the data source files are
located and allows the loaddata
command to connect to the data source
and initiate the data import process.
Copybook and data file directories do not need to be specified when they are referenced within the loader connection you set up.
Required Syntax
loaddata <loader_connection> datafile <filename> schemafile <copybook_filename>
where,
<loader_connection> |
Name assigned by the repository administrator to the loader connection created for the COBOL data source. |
<filename> |
Name of the COBOL flat file that contains the data. |
<copybook_filename> |
Name of the schema file that corresponds to the COBOL flat file you specified as the data file. |
Optional Parameters
Parameter |
Description |
---|---|
username <user_name> |
User ID required to validate the connection to the data source. Use this parameter only if a login name and password are required. Do not use the username and password parameters if the mtb_admin user is the data file owner. |
password <password> |
Password required to validate the connection to the data source. Use this parameter only if a login name and password are required. |
jobname <job_name> |
Job ID or name of the data load job. |
charset <charset> |
Character encoding used by the COBOL data and copybook files. The
options are: |
endian <value> |
Indicates the byte order. The options are
|
upacked <value> |
Indicates the structure of the data. Set to |
align <value> |
Indicates one- or two-byte data alignment. The options are
|
redefines <value> |
Indicates how to manage REDEFINES clauses in a copybook. The
options are Type all to account for all REDEFINES clauses in a copybook. If this option is selected and the system encounters a REDEFINES clause, it removes the REDEFINES clause and keeps both representations of the data in the copybook. The data file will be populated to match the copybook. Type first to ignore all REDEFINES clauses in the copybook. |
terminator <value> |
Indicates how records in the data file are terminated. The options are lf (linefeed), cr (carriage return), crlf (linefeed and carriage return) and none. Typically, COBOL data files are fixed length and have no record delimiter. However, if COBOL data is exported from the original application and transferred into other file systems (especially UNIX), they could contain record delimiters added by the export or transfer process. If the file originated from: Windows, type crlf UNIX, type lf IBM mainframe, type none. |
encoding <value> |
Indicates the character encoding used by the data file. The options are EBCDIC and ASCII. EBCDIC data is translated into a correct ASCII representation on load. Generally, UNIX COBOL files will be ASCII and IBM mainframe data will be EBCDIC. |
national <value> |
National Character encoding used by the data file. If your COBOL copybooks define national data items holding Unicode strings (such as PIC clause containing N and USAGE NATIONAL) or your compiler options from the data source are set to NSYMBOL (NATIONAL) or CODEPAGE, you should specify the National Character encoding standard of the data source. |
columns <names> |
Indicates the names of the columns from which to import data. |
skip <number> |
The number of rows to skip before starting to import data rows. All rows after the skipped rows will be loaded to the repository. For example, if your file has 300 rows and you select to skip the first 99, the system will load 200 rows, starting with the 100th row. |
first <number> |
Number of records from the beginning of the file (to load (for example, the first 1000 records). |
random <percentage> |
The degree to which you want to randomly sample a percentage of records from the file. |
Example
The command uses a loader connection named cobolconn
, provides a
username and password to access the data directories, and then loads data from three
columns in the testcp932.dat data file.
loaddata cobolconn username myuser password mypsd encoding cp932 datafile testcp932.dat schemafile testcp932.cpy columns {{Ref Id} Source Amount}
When multiple columns are represented within a space-delimited line of column names, be sure to enclose them in braces ({}). If a column name contains whitespace, enclose the column name in braces ({}) also.