When using NCL, files are referenced by a logical file identifier or file ID. The file ID provides a logical connection to the physical data set. A file ID must be assigned using the UDBCTL command before a file can be referenced by an NCL procedure.
Suppose, for example, that you want to process a file called HELPDESK.DATA, which is defined by using the ALLOCATE command with a DD name of HELPDB1 and all NCL procedure references to the physical file are to be made to the symbolic name HELPDESK.
Before the file HELPDESK.DATA can be processed by NCL, a UDBCTL command must be executed specifying the symbolic name by which this file will be referenced from NCL procedures. This UDBCTL command relates the DD name of the data set with its symbolic name and is coded:
UDBCTL OPEN=HELPDB1 ID=HELPDESK options
For a particular NCL procedure to access the file that has now been assigned the symbolic, or logical name of HELPDESK, the procedure must contain an &FILE OPEN statement specifying the file that is to be processed:
&FILE OPEN ID=HELPDESK FORMAT=DELIMITED
This approach offers considerable flexibility when it becomes necessary to change the system configuration, since all NCL procedures reference files using their logical file ID and are therefore shielded from external changes.
Should a data set become full, a single UDBCTL command can simultaneously migrate all NCL procedures to reference a new data set without change to the NCL procedures. Consider our example using the HELPDESK file. It might be desirable at the end of the day to swap to another data set and perform other processing on the previous day's data while continuing to record new problems in another file. You would allocate multiple data sets and use a UDBCTL command at the appropriate time to swap to an alternative data set. For example:
UDBCTL STOP=HELPUDB1(stop current use) UDBCTL OPEN=HELPUDB2 ID=HELPDESK(swap to new file)
The NCL procedures continue to use the same ID on the &FILE statement, but now use a different physical data set as the UDBCTL command has changed the logical relationship:
&FILE OPEN ID=HELPDESK FORMAT=DELIMITED
(NCL procedure is unchanged)
| Copyright © 2011 CA. All rights reserved. | Tell Technical Publications how we can improve this information |