Import the file definition for the destination application data from a COBOL copybook. The description of the enrollment file in the enrollment database is contained in the COBOL copybook whose format displays below:
ENROLL.CBL01 HLTH_INS_ENRL. 10 EMPLOYER_ID PIC X(5). 10 EMPLOYER_NAME PIC X(20). 10 SUBSCRIBER_ID PIC X(12). 10 COVERAGE_EFFECTIVE_DATE PIC 9(8). 10 COVERAGE_TERMINATION-DATE PIC 9(8). 10 SUBSCRIBER_SSN PIC X(9). 10 SUBSCRIBER_LAST_NAME PIC X(15). 10 SUBSCRIBER_FIRST_NAM PIC X(15). 10 SUBSCRIBER_MI PIC X(1). 10 SUBSCRIBER_DOB PIC 9(8). 10 ADDRRESS_1 PIC X(25). 10 ADDRRESS_2 PIC X(25). 10 CITY PIC X(25). 10 STATE PIC X(2). 10 ZIP_CODE PIC X(10). 10 DEPENDENT_SSN PIC X(9). 10 DEPENDENT_FIRST_NAME PIC X(15). 10 DEPENDENT_LAST_NAME PIC X(15). 10 DEPENDENT_MI PIC X(1). 10 DEPENDENT_DOB PIC 9(8).
Changing field attributes in the imported COBOL
data
Select Record/Tables on the toolbar or Workspace. The Records/Tables window displays, with three records – the two records you manually entered (ENRL_SUB and ENRL_DEP) and the record you just imported (HLTH_INS_ENRL).
When ECMap imports a record definition, the program automatically
populates the text boxes on the Fields tab – Record Name, Field
Name, Field Description, Start Position, Field Length, and Field Type.
Right-click HLTH_INS_ENRL and choose Record Properties from the drop-down menu. The Record Properties window displays. Select the Optional tab. For the Record Type field, select the dropdown list box and choose Destination. Select OK to exit the Record Properties window.
Double-click HLTH_INS_ENRL to display the fields in the record.
Right-click EMPLOYER_ID and choose Field Properties from the drop-down menu. Select the Options tab of the Field Properties window to make it active and check Fixed String. Select the text box and type 13579. Select Next to display the Field Properties window for the next field in the record, EMPLOYER_NAME.
On the Options tab of the Field Properties window for EMPLOYER_NAME, check Fixed String. Select the text box and type Big Manufacturing Co. Select OK.
Right-click COVERAGE_EFFECTIVE_DATE and choose Field Properties from the drop-down menu. The Field Properties window displays. It has two tabs – Fields and Options.
For Field Type on the Fields tab, select DT-DATE from the drop-down list. Two additional text boxes appear – Date Format and Century Minimum Type.
COBOL date fields are imported with a Field Type of
UI. They must be changed to DT and a date format selected.
For Date Format, select MMDDYYYY from the drop-down list.
In the Century Minimum Type field, select Use global century minimum. Select Next to display the Field Properties window for the next field – COVERAGE_TERMINATION_DATE.
The Y2K logic in ECMap allows the default values specified
in the map definition process to be overridden on a field-by-field
basis.
For Field Type on the Fields tab, select DT-DATE from the drop-down list. Two additional text boxes appear – Date Format and Century Minimum Type.
For Date Format, select MMDDYYYY from the drop-down list. In the Century Minimum Type field, select Use global century minimum. Select OK to exit the Record Properties window.
If you choose different date formats for your input
and output data, ECMap automatically makes the conversion for you.
Right-click SUBSCRIBER_DOB and choose Field Properties from the drop-down menu. The Field Properties window displays.
For Field Type on the Fields tab, select DT-DATE from the drop-down list. Two additional text boxes appear – Date Format and Century Minimum Type.
For Date Format, select MMDDYYYY from the drop-down list. In the Century Minimum Type field, select Use global century minimum.
Select OK to exit the Record Properties window.
Right-click DEPENDENT_DOB and choose Field Properties from the drop-down menu. The Field Properties window displays.
For Field Type on the Fields tab, select DT-DATE from the drop-down list. Two additional text boxes appear – Date Format and Century Minimum Type.
For Date Format, select MMDDYYYY from the drop-down list. In the Century Minimum Type field, select Use global century minimum.
Select OK to exit the Record Properties window.
On the Records/Tables window, choose Close from the File menu to return to the main ECMap window.
Importing record definitions from a COBOL copybook
From the Application Files menu on the main ECMap window, select Import Definition.
From the Import Definition submenu, select COBOL. The COBOL Record Definition Import window displays. ECMap automatically enters the names of the Project and Map.
Select Browse next to the COBOL Definition Import File/File Name. The Choose COBOL Import File window displays.
Locate c:\Program Files\Sybase\ECMap\maps\data\enroll.cbl and double-click it. You return to the COBOL Record Definition Import window and the program automatically enters the full directory path in the COBOL Definition Import File/File Name text box.
This specifies the location of the file (directory and file) containing the COBOL record definitions.
In the Options section of the window, select Add Application Record, File Name, and Directory. This populates the File Location/File Name and the File Location/Directory with the file name and directory path of the imported record definition.
In the File Location section of the window, select the File Name text box and change enroll.cbl to enroll.seq. Then, select the Directory text box and change the directory to c:\QT\OUTPUT. This specifies the location of the file (directory and file) containing the COBOL application data.
Select Continue. If a file with this name:
Does not exist, the New File window displays. Go to the next step.
Already exists, the Select COBOL Records window displays. Go to Step 9. (A file with this name would already exist, for example, if you repeat this sequence of steps.)
On the New File window, ECMap automatically enters the enroll.seq as the File Name. Select SEQUENTIAL-ASCII as the File Type from the drop-down list. The File Description is an optional field. Select OK. The Select COBOL Records window displays.
The file enroll.cbl contains the
COBOL record definitions. The file enroll.seq contains
the COBOL data.
Select 01 HLTH_INS_ENRL to select it and select LOAD. The View Log dialog box appears with the message “Run Complete”. The definition of the record HLTH_INS_ENRL has been imported into ECMap and is associated with the file enroll.seq. The file enroll.seq is associated with the directory c:\QT\OUTPUT. Select Yes on the View Log dialog box.
The COBOL Import Log window displays, with a listing of the extracted records and a summary of any syntax errors in the file.
Select OK. In the excobol dialog box, the message “Extract Run Completed Successfully” displays.
Select OK on the excobol dialog box to return to the COBOL Record Definition Import window.
Select Cancel to exit from the COBOL Record Definition Import window to return to the main ECMap window.
Linking records to files and directories
When you imported the COBOL record definition, you chose Add Application Record, File Name, and Directory. This automatically linked the records (to be read using the imported definitions) with a file and directory. ECMap uses this directory path to locate the application data when the map is run. When you manually entered record definitions, you told ECMap how to read the records, but not how to find the data. Now, link the records (to be read with the definitions you manually entered) with a file and a directory.
Select Applications Directory on the toolbar or Workspace. The Directories (Mailboxes) window displays. The directory path you set up when you imported the COBOL record definitions displays – c:\QT\OUTPUT.
Double-click a directory to display the files it contains. Double-click a file to display the records it contains. Double-click a record to display the fields it contains.
On the Directories (Mailboxes) window, right-click Application Directories and choose New Directory. The New Directory window displays. For Directory, Browse for or enter c:\Program Files\Sybase\ECMap\ maps\data. Select OK to return to the Directories (Mailboxes) window.
Select c:\..\maps\data and choose Open from the Application Files menu at the top of the window. The Files/ Databases window displays beside the Directories (Mailboxes) window.
Right-click Files on the Files/Databases window and choose New File. The New File window displays. Select in the File Name text box and enter HR_ENRL.SEQ. For File Type, choose SEQUENTIAL-ASCII from the drop-down list. File Description is optional. Select OK to close the New File window.
Select HR_ENRL.SEQ and choose Open from the Record menu at the top of the Files/Databases window. The Records/Tables window displays beside the Directories (Mailboxes) and Files/Databases windows.
On the Records/Tables window, all three record definitions associated with this map are displayed.
Drag ENRL_SUB from the Records/Tables window and drop it on HR_ENRL.SEQ on the Files/Databases window. Now, drag ENRL_DEP from the Records/Tables window and also drop it on HR_ENRL.SEQ on the Files/Databases window. You have associated the records with a file.
Drag HR_ENRL.SEQ from the Files/Databases window and drop it on c:\Program Files\Sybase\ECMap\maps\data on the Directories (Mailboxes) window. You have associated the file with a directory.
You have now linked your input records with a file and a directory. On all three windows, you can double-click to display files in a directory, records in a file, and fields in a record.
Choose Close from the File menu on each of these three windows to close them and return to the main ECMap window.
Mapping the source data to the destination data
Mapping in ECMap is an easy drag-and-drop procedure. On the Any-to-Any mapping window, the source records are on the left, the destination records are on the right, and the mapping results are at the bottom of the window. Between the source and destination records, there is a temporary mapping workspace where you can map multiple records at one time.
To make sure that you have “grabbed” the element that you want to drag-and-drop, a small icon of a page must appear when you highlight the element. If the small page icon does not appear until after your cursor moves onto the section of the window with application data, you did not “grab” the element and you cannot drop it onto a record field to map the element to the field.
Create your mapping instructions with one of these methods:
Drag record fields from the source data and dropping them on record fields in the destination data one at a time
Enter multiple source and destination record fields in the temporary mapping workspace and mapping them simultaneously with the select of a button.
Select Mapping on the toolbar or Workspace. The Rule Definition – New window displays. For Rule Number, enter 20. For Rule Definition, enter Mapping Commands. Select OK and the Any-to-Any Map window displays. Under Rules in the upper right corner of the window, 20 displays in the Number text box and 1 displays in the Line text box. You are ready to begin entering the individual mapping commands.
Individually mapping fields from the ENRL_SUB
record
Mapping in an any-to-any map takes place in one rule, and each instance of mapping is a command in this rule. Each time you map a field, ECMap assigns a new line number to the command that is being created.
To individually map fields in the ENRL_SUB record, drag a Source field from the right side of the window and drop it onto a Destination field on the left side of the window. The results show up in the Mapping section in the bottom middle of the window.
Double-click ENRL_SUB under Source and HLTH_INS_ENRL under Destination to display the fields in the records.
Drag the SUBSCR_ID field of the ENRL_SUB record under Source and drop it on the SUBSCRIBER_ID field of the HLTH_INS_ENRL record under Destination.
Drag SSN and drop it on SUBSCRIBER_SSN.
Drag NAME_LAST and drop it on SUBSCRIBER_ LAST _NAME.
Drag NAME_FIRST and drop it on SUBSCRIBER_ FIRST _NAME.
Drag NAME_MI and drop it on SUBSCRIBER_MI.
Drag ADDR1 and drop it on ADDRESS_1.
Drag ADDR2 and drop it on ADDRESS_2.
Drag CITY and drop it on CITY.
Drag STATE and drop it on STATE.
Drag ZIP_5 and drop it on ZIP_CODE.
Drag DT_OF_BIRTH and drop it on SUBSCRIBER_DOB.
Drag COVG_START_DT and drop it on COVERAGE_EFFECTIVE_DATE.
Drag COVG_END_DT and drop it on COVERAGE_TERMINATION-DATE.
Under Source, close the ENRL_SUB record by selecting the minus button next to it. Double-click the ENRL_DEP record to open it.
Mapping multiple fields simultaneously from the
ENRL_DEP record:
In addition to individual drag-and-drop mapping, you can also map multiple fields at one time. First, you double-click the Source fields that you want to map, and they appear under Source in the temporary mapping workspace in the middle of the window. Then, you double-click the Destination fields you want to map, and they appear under Destination in the temporary mapping workspace. Finally, you select => between the two sides of the temporary mapping workspace and each Source field is mapped to the Destination field directly across from it. The results of all the mappings show up in the middle section at the bottom of the window.
From the ENRL_DEP record under Source, double-click:
SSN
NAME_LAST
NAME_FIRST
NAME_MI
DT_OF_BIRTH
There are five Source entries in the temporary mapping workspace.
From the HLTH_INS_ENRL record under Destination, double-click:
DEPENDENT_SSN
DEPENDENT_LAST_ NAME
DEPENDENT_FIRST_NAME
DEPENDENT_MI
DEPENDENT_DOB
There are five Destination entries in the temporary mapping workspace.
Select => between the two sides of the temporary mapping workspace. Each Source field is mapped to the Destination field directly across from it. The temporary mapping workspace is now blank, and the results of all the mappings show up in the middle section at the bottom of the window. Select X in the upper right corner of the Any-to-Any Map window to close that window and return to the main ECMap window.
Creating the map flow
The map flow defines the relationship between the source application data and the destination application data. Levels and rules are the tools you use to create flow. You just created one rule – 20 Mapping Commands – when you mapped your data. Now, create the rules to read and write the data. Also create the levels that tell ECMap when to perform these rules.
Select Map Flow on the toolbar or Workspace. The Any-to-Any Map Flow window displays. From the Option menu at the top of the window, select Multiple Files so that it is unchecked.
To toggle between checking and unchecking an option,
simply select the option.
Adding rules
From the View menu at the top of the Any-to-Any Map Flow window, choose Rules. The Rule Definitions window displays.
From the File menu of the Rule Definitions window, choose New Rule. The Rule Definition – New window displays:
For Rule Number, enter 10.
For Rule Definition, enter Read Subscriber Record.
Select OK to return to the Rule Definitions window.
ECMap usually offers you more than one way to perform
an action. For example, whenever you can choose New from a File
menu, you can also right-click an object on the window
to display a drop-down menu that allows you to add a new
object.
Right-click rule 10: Read Subscriber Record and choose New Command from the drop-down menu. The Rule Command - New window displays. The Rule Number and Line Number are automatically entered by ECMap.
In the Command text box on the Rule Command - New window, choose Sequential I/O from the drop-down menu. Four additional text boxes appear:
Select the I/O Command up arrow and choose Read Record.
Select the Application Directory up arrow to display the Directories (Mailboxes) window.
Double-click c:\Program Files\Sybase\ECMap\maps\data, then double-click HR_ENRL.SEQ, and finally double-click ENRL_SUB.
When you double-click ENRL_SUB, the program automatically enters the directory, file, and record you double-clicked in the Application Directory, Application File, and File Record text boxes.
Select OK on the Rule Command – New window to close both that window and the Directories (Mailboxes) window.
From the File menu of the Rule Definitions window, choose New Rule. The Rule Definition – New window displays:
For Rule Number, enter 30.
Rule Definition, enter Read Dependent Record.
Select OK to close the Rule Definition - New window.
Right-click rule 30: Read Dependent Record and choose New Command from the drop-down menu. The Rule Command - New window displays.
In the Command text box on the Rule Command - New window, choose Sequential I/O from the drop-down menu. Four additional text boxes appear.
Select the I/O Command up arrow and choose Read Record.
Select the Application Directory up arrow to display the Directories (Mailboxes) window.
Double-click c:\Program Files\Sybase\ECMap\maps\data, then double-click HR_ENRL.SEQ, and finally double-click ENRL_DEP (the record you want to read). When you double-click ENRL_DEP, the program automatically enters the directory, file, and record you double-clicked in the Application Directory, Application File, and File Record text boxes.
Select OK on the Rule Command – New window to close both that window and the Directories (Mailboxes) window.
From the File menu on the Rule Definitions window, choose New Rule. The Rule Definition – New window displays.
For Rule Number, enter 40.
Rule Definition, enter Write Output Record.
Select OK to close the Rule Definition - New window.
Right-click rule 40: Write Output Record and choose New Command from the drop-down menu. The Rule Command – New window displays.
In the Command text box on the Rule Command – New window, choose Sequential I/O from the drop-down menu.
For the I/O Command, choose Write Record. Select the Application Directory up arrow to display the Directories (Mailboxes) window.
Double-click c:\qt\OUTPUT, the double-click enroll.seq, and finally double-click HLTH_INS_ ENRL (the record you want to write). When you double-click HLTH_INS_ENRL, the program automatically enters the directory, file, and record you double-clicked in the Application Directory, Application File, and File Record text boxes.
Select OK on the Rule Command – New window to close both that window and the Directories (Mailboxes) window.
Choose Close from the File menu of the Rule Definitions window to close that window and return to the Any-to-Any Map Flow window.
Adding levels
Our source file is read sequentially, and the record type field determines when to break to a new level.
From the File menu of the Any-to-Any Map Flow window, choose New. Choose Add Master Level from the New submenu.
The Any-to-Any Record Flow window displays side-by-side with the Any-to-Any Map Flow window. It has two tabs – Required and Advanced. In this exercise, enter information only on the Required tab.
On the Required Tab of the Any-to-Any Record Flow window, identify the following:
Under Levels, select the Current up arrow. The Levels window displays to the left, superimposed over the Any-to-Any Map Flow window.
From the File menu of the Levels window, choose New. The New Level window displays. In the first text box, enter 100 as the level code. In the second text box, enter Read and Map Subscriber Record. Select OK to close to the New Level window.
On the Levels window, double-click 100 Read and Map Subscriber Record. The program enters 100 in the Current text box under Levels.
Under Record Type, Mandatory has already been selected and cannot be changed.
Under Records, select the Current up arrow. The Records/Tables window displays to the left, superimposed over the Any-to-Any Map Flow window.
On the Records/Tables window, double-click ENRL_SUB, and the program enters it in the Current text box under Records.
Under Rules, select the I/O up arrow. The Rule Definitions window displays to the left, superimposed over the Any-to-Any Map Flow window.
On the Rule Definitions window, double-click rule 10: Read Subscriber Record. The program automatically enters 10 in the first I/O text box and Read Subscriber Record in the second I/O text box. Leave the default 0: DO Nothing rule as both the Before rule and as the After rule.
Select OK on the Any-to-Any Record Flow of Level 100 window to return to the Any-to-Any Map Flow window.
From the File menu on the Any-to-Any Map Flow window, choose New. Choose Add Child Level from the New submenu. The Any-to-Any Record Flow window displays.
On the Advanced Tab of the Any-to-Any Record Flow window:
Under Levels, select the Current up arrow. The Levels window displays to the left, superimposed over the Any-to-Any Map Flow window.
From the File menu on the Levels window, choose New. The New Level window displays. In the first text box, enter 200 as the level. In the second text box, enter Read Dependent Record and Map. Select OK to close the New Level window.
On the Levels window, double-click 200 Read Dependent Record and Map. The program enters 200 in the Current text box under Levels.
As the Record Type, choose Optional (No Msg).
Under Records, select the Current up arrow. The Records/Tables window displays to the left, superimposed over the Any-to-Any Map Flow window.
On the Records/Tables window, double-click ENRL_DEP, and the program enters it in the Current text box under Records. Close the Records/Tables window.
Under Rules, select the I/O up arrow. The Rule Definitions window displays.
On the Rule Definitions window, double-click rule 30: Read Dependent Record. The program automatically enters 30 in the first I/O text box on the Any-to-Any Record Flow window and Read Dependent Record in the second I/O text box.
On the Rule Definitions window, double-click rule 20: Mapping Commands. The program automatically enters 20 in the first Before text box on the Any-to-Any Record Flow window and Mapping Commands in the second Before text box.
On the Rule Definitions window, double-click rule 40: Write Output Record. The program automatically enters 40 in the first After text box on the Any-to-Any Record Flow window and Write Output Record in the second After text box. Close the Rule Definitions window.
Select OK on the Any-to-Any Record Flow of Level 200 window to close that window and return to the Any-to-Any Map Flow window. Choose Close from the File menu of the Any-to-Any Map Flow window to return to the main ECMap window. Close all other open windows.