Transporting Catalogs across Operating Environments

Transporting Catalogs using CPORT and CIMPORT

Use the CPORT and CIMPORT procedures to transport catalogs and catalog entries from one machine to another machine running in a different operating environment. In addition to graphics output stored in GRSEG catalog entries, SAS/GRAPH software produces several other files that you can transport from host environment to host environment. These other files include
  • colors maps
  • templates
  • fonts
  • device descriptions.
To transport catalog entries that contain graphics output (catalog entries of type GRSEG), follow these steps:
  1. Use the CPORT procedure to create a transport file from the catalog entries in the current host environment. A transport file is a sequential file that contains the catalog in SAS transport format. To create a transport file, you must specify a catalog to be converted and a fileref for the transport file.
    To retain the original order of the GRSEG entries in the catalog, use SELECT= in the PROC CPORT statement to export individual graphs in the order in which they were created. Otherwise, when you use the GREPLAY procedure to list the graphics entries in the imported catalog, the procedure will list the entries in alphabetical order, rather than the order in which they were created.
    Note: Only the GREPLAY procedure can list catalog entries in the order in which they were created. All other procedures list entries in alphabetical order.
    To export a catalog that contains groups of entries created using the GREPLAY procedure, you must use SELECT= in the PROC CPORT statement to select the names of the groups, rather than the names of individual graphs, to be included in the transport file. If you export the entire catalog without using SELECT=, the groups are not maintained in the catalog created when you import the transport file in the new host environment.
    When you use the CPORT procedure, messages in the SAS log identify the catalog entries that have been placed in the transport file. If the catalog entry was created by replaying several graphs into a template, the log messages list the names of all of the entries that contributed to the templated graph.
  2. Move the transport file to the target machine, if necessary. You must move the transport file in binary format. If you do not move the transport file in binary format, the CIMPORT procedure cannot read the file that you create.
  3. Once you have moved the transport file to the target machine, import the transport file into a catalog in the new host environment using the CIMPORT procedure. The entries are imported in the order specified in SELECT= in the PROC CPORT statement used to create the transport file.
    The SELECT= option in the PROC CIMPORT statement does not affect the order of the imported entries.
Note: You must use the CIMPORT procedure from the current version of the SAS System. The CIMPORT procedure in a previous release cannot read a transport file created by the CPORT procedure in the current version.
For details about using the CPORT and CIMPORT procedures, see the Base SAS Procedures Guide.

Example of Transporting GRSEGs

This example shows how to port three entries from the catalog MYLIB.GRAPHS.
First, the CPORT procedure writes selected graphs from MYLIB.GRAPHS to the transport file TRANFILE. The SELECT option names the graphs to be ported.
libname mylib "SAS-data-library";
filename tranfile "external-file";

proc cport file=tranfile
     catalog=mylib.graphs
     select=(GPLOT.GRSEG GPLOT1.GRSEG GPLOT3.GRSEG);
run;
Once the transport file has been moved to the new host environment using communications software or tape, the CIMPORT procedure creates a new catalog called MYLIB.GRAPHS on the new machine.
libname mylib "SAS-data-library";
filename tranfile "external-file";

proc cimport catalog=mylib.graphs
     infile=tranfile
     select=(GPLOT.GRSEG GPLOT1.GRSEG  GPLOT3.GRSEG);
run;

Example of Transporting Color Maps and Templates

To transport color maps (catalog entries of type CMAP) and templates (catalog entries of type TEMPLATE) from one host environment to another, use the CPORT and CIMPORT procedures. For example, you could export a color map from the NEWLIB.CMAPS catalog using the following statements:
filename tranfile "external-file";
libname newlib "SAS-data-library";

proc cport file=tranfile catalog=newlib.cmaps select=(mymap.cmap);
run;
After moving the transport file to the new host environment, you can import the color map using the following statements:
filename tranfile "external-file";
libname newlib "SAS-data-library";

proc cimport infile=tranfile catalog=newlib.cmaps;
run;

Example of Transporting Fonts

To transport fonts (catalog entries of type FONT) from one operating system to another, use the CPORT and CIMPORT procedures. For example, you could export a font from the GFONT0.FONTS catalog using the following statements:
filename tranfile "external-file";
libname gfont0 "SAS-data-library";

proc cport file=tranfile 
     catalog=gfont0.fonts 
     select=(figures.font);
run;
After moving the transport file to the new host environment, you can import the font using the following statements:
filename tranfile "external-file";
libname gfont0 "SAS-data-library";

proc cimport infile=tranfile catalog=gfont0.fonts;
run;

Example of Transporting Device Attributes and Device Entries

To transport device entries (catalog entries of type DEV) from one operating environment to another, use the CPORT and CIMPORT procedures. For example, you could export a device entry from the GDEVICE0.DEVICES catalog using the following statements:
filename tranfile "external-file";
libname gdevice0 "SAS-data-library";

proc cport file=tranfile 
     catalog=gdevice0.devices 
     select=(cgm.dev);
run;
After moving the transport file to the new host environment, you can import the device entry using the following statements:
filename tranfile "external-file";
libname gdevice0 "SAS-data-library";

proc cimport infile=tranfile catalog=gdevice0.devices;
run;