PROC CPORT and PROC CIMPORT |
Verifying the Content of the Transport File |
If the person who restores the transport file at the target computer is different from the person who creates the transport file at the source computer, make sure you obtain information about the transport file in advance of the file restore operation. Here is an example of the type of information that might be useful for restoring the transport file to native format at the target computer:
Type of Source Operating Environment and SAS Release Used | Strategy Used to Create Transport File | Transport Filename | Data Sets | Catalogs | Catalog Entries |
---|---|---|---|---|---|
z/OS | PROC CPORT | TPORT.DAT | TEST.CITY | TEST.FORMATS | REGFMT |
You can find out the strategy that was used to create the transport file by using a text editor or by using an operating environment read or view command to read the transport file. The XPORT engine and PROC CPORT create transport files whose headers look different. For details, see File Headers: Finding Out the Method Used to Create the Transport File.
Also, you can use these SAS procedures to list the contents of the transport file: PROC CATALOG, PROC CONTENTS, and PROC DATASETS. For details about these procedures, see the Base SAS Procedures Guide.
Restore the Transport File Using PROC CIMPORT |
Restore a transport file that contains one or more SAS data sets or one or more SAS catalogs by using PROC CIMPORT.
This example uses the CIMPORT procedure to import multiple data sets from a transport file.
filename importin 'transport-file'; libname target 'SAS-data-library'; proc cimport infile=importin library=target memtype=data; run;
In the preceding example, the fileref IMPORTIN points to the location where the transport file was transferred to the target computer. The libref TARGET points to a new location where the transport file will be copied. The PROC CIMPORT statement copies as its source the file that is identified in the INFILE= option to the location identified in the LIBRARY= option. The PROC CIMPORT statement implicitly translates the transport file into the target computer native format.
Because the LIBRARY= option permits both data sets and catalogs to be copied to the library, you need to specify MEMTYPE=DATA to restrict the operation only to data sets in the library. Omitting the MEMTYPE= option permits both data sets and catalogs, in the file referenced by the fileref IMPORTIN, to be copied to the location referenced by the libref TARGET.
In order to subset the destination member in PROC CIMPORT, use either the SELECT statement, the EXCLUDE statement, or the MEMTYPE= option. Here is an example of subsetting:
filename importin 'transport-file'; libname target 'SAS-data-library'; proc cimport infile=importin library=target memtype=data; select grades; run;
In the preceding example, the libref TARGET and the MEMTYPE= option point to the new location where the transport file will be copied. The fileref IMPORTIN points to the location where the transport file was transferred to the target computer. The PROC CIMPORT statement copies as its source the file that is identified in the INFILE= option to the location identified in the LIBRARY= option. The PROC CIMPORT statement implicitly translates the transport file into the target computer native format.
The SELECT statement selects only the data set GRADES for the library TARGET.
To import catalogs from a transport file make sure that you use compatible destination member types in PROC CPORT and PROC CIMPORT.
If destination members are incompatible, you receive either an error or a warning message. See Preventing and Fixing Problems for recovery actions that can be taken to fix common errors. For details about PROC CPORT and PROC CIMPORT syntax, see the Base SAS Procedures Guide.
This example uses the CIMPORT procedure to import multiple catalogs from a transport file. To import multiple catalogs, specify the LIBRARY= option and MEMTYPE=CATALOG in PROC CIMPORT.
filename importin 'transport-file'; libname target 'SAS-data-library'; proc cimport infile=importin library=target memtype=catalog; run;
In the preceding example, the fileref IMPORTIN points to the location where the transport file was transferred to the target computer. The libref TARGET points to a new location where the transport file will be copied. The PROC CIMPORT statement copies, as its source, the file that is identified in the INFILE= option to the location identified in the LIBRARY= option. Because the destination is a library, only the libref is specified. The MEMTYPE= option restricts the import to catalogs. PROC CIMPORT implicitly translates the transport file into the target computer native format.
This example uses the CIMPORT procedure to import a single catalog from a transport file. To import a single catalog, specify the CATALOG= option in PROC CIMPORT.
filename importin 'transport-file'; libname target 'SAS-data-library'; proc cimport infile=importin catalog=target.testcat; run;
This example uses the CIMPORT procedure to import a single catalog entry type from a transport file. To import a single catalog entry type, specify the ET= option and the CATALOG= option in PROC CIMPORT.
filename importin 'transport-file'; libname target 'SAS-data-library'; proc cimport infile=importin catalog=target.testcat et=list; run;
This example uses the CIMPORT procedure to import selected catalog entries from a transport file. Use a SELECT statement to specify the names of the catalog entries that you want. In this example, SELECT TESTNPGM.LIST ONE.SCL explicitly names the selected catalog entries. Also, the CATALOG= option in PROC CIMPORT must be specified.
filename importin 'transport-file'; libname target 'SAS-data-library'; proc cimport infile=importin catalog=target.testcat; select testnpgm.list one.scl; run;
As an alternative, you can use the EXCLUDE statement in PROC CIMPORT to omit explicitly catalog entries that you do not want.
Copyright © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.