Step 1. Add a Data Map that Contains an Array Defined with Multiple Occurrences
Step 1. Add a Data Map that Contains an Array Defined with Multiple Occurrences
In this step, you add a data map for a sequential flat file and import a COBOL copybook that defines an array with multiple occurrences into the data map.
On the
Resources
tab in the
Resource Explorer
, click
Add
Data Map
.
In the
Name
dialog box, enter the following information:
In the
Schema Name
box, enter
demo
.
In the
Data Map Name
box, enter
map2array
.
Select the
Import Record Definitions
option.
In the
Access Method
list, select
SEQ
.
Click
Next
.
In the
SEQ Access Method
dialog box, enter the following information:
In the
File Name
box, click the Browse button to browse to the demo2.dat file in the examples directory.
In the
Record Format
area, select the
Field Separator
option and enter the comma (,) character in the
Field Separator
box.
The demo2.dat data file is a comma (,) separated file.
Click
Finish
.
In the
Import Copybook - Source Details
dialog box, enter the following information:
In the
Source
area, select
Local
.
In the
Type
list, select
COBOL
.
In the
Column Range
area, enter
7
in the
Start
box and
72
in the
End
box.
Click
Next
.
In the
Import Copybook - Local Cobol Details
dialog box, enter the following information:
Click the Browse button to browse to the demo2.cob file in the examples directory.
To view the copybook, click
Preview
. The copybook includes the following OCCURS clause to define an array with multiple occurrences:
04 ITEM OCCURS 3 DEPENDING ON ITEMCT PIC X(15).
Close the preview window. In the
Import Copybook - Local Cobol Details
dialog box, click
Next
.
In the
Import Copybook - Configuration Details
dialog box, review the selected actions for imported records, fields, and tables and click
Finish
.
In the
Import Copybook Information
window, review the information for the import and click
OK
.
To import the RECORD_IN record, click
OK
in the
Record Definition
dialog box.
To import the fields in the record, click
OK
in the
Field Definition
dialog box for each field.
To import the RECORD_IN table, click
OK
in the
Table Definition
dialog box.
The
Cobol Import
window displays the imported copybook. The
Copybook Message Log
window displays the results of the import operation.
Close the
Cobol Import
and the
Copybook Message Log
windows.
On the
Resources
tab in the
Resource Explorer
, select the RECORD_IN table and click
File
Database Row Test
.
The PowerExchange Navigator displays an error message that indicates that the RECTYPE field in the RECORD_IN record is an invalid type for a delimited data file. Additionally, the ITEMCT field is an invalid type.
Change the datatype of the RECTYPE and ITEMCT fields by completing the following actions:
In the
Record
window for the RECORD_IN record, double-click the RECTYPE field.
In the
Field Properties
dialog box, select a
Field Type
of NUMCHAR. Enter 2 in the
Length
box. Click
OK.
In the
Record
window, double-click the ITEMCT field.
In the
Field Properties
dialog box, select a
Field Type
of NUMCHAR. Enter 1 in the
Length
box. Click
OK.
On the
Resources
tab in the
Resource Explorer
, select the RECORD_IN table and click
File
Database Row Test
.
On the
Database Row Test
dialog box, click
Go
.
The
Database Row Test Output
window displays the results of the database row test.