Previous Page | Next Page

Examples of Moving SAS Files

Example: z/OS to Windows File Transport


Using PROC CPORT at the Source Computer to Create Transport Files

This example shows a SAS program that copies two data sets and two catalogs from a library in z/OS format and writes them to a default output file in transport format.

SAS Program That Copies Data Sets and Catalogs to a Transport File

filename tport 'joe.mytest.data' disp=rep;
libname test 'joe.mytest.sas';
proc cport library=test file=tport;
run;

The LIBNAME statement assigns the libref TEST to the physical location JOE.MYTEST.SAS, which points to the library to be transported. JOE is the userid that is associated with the SAS session in which the transport operation is performed. The FILENAME statement assigns the fileref TPORT to the transport file JOE.MYTEST.DATA. DISP=REP will create a new file or replace an existing file.


Viewing the SAS Log at the Source Computer

This example shows a SAS log that documents the successful execution of the SAS program shown in SAS Program That Copies Data Sets and Catalogs to a Transport File.

Source Computer SAS Log File

filename tport 'joe.mytest.data';
libname test 'joe.mytest.sas'; 
proc cport lib=test file=tport; 
run;  
WARNING: No output file is specified. Default output
file JOE.SASCAT.DATA is used.

NOTE: Proc CPORT begins to transport data set TEST.CITY                      
NOTE: The data set contains 7 variables and 72 observations.                 
NOTE: Transporting data set index information.

NOTE: Proc CPORT begins to transport catalog TEST.FORMATS  
NOTE: The catalog has 3 entries  
NOTE: Transporting entry REGFMT  .FORMATC
NOTE: Transporting entry SALEFMT .FORMATC                                   
NOTE: Transporting entry SIZEFMT .FORMATC 

NOTE: Proc CPORT begins to transport catalog TEST.TEST 
NOTE: The catalog has 11 entries  
NOTE: Transporting entry ABOUT   .CBT 
NOTE: Transporting entry APPEND  .CBT                                       
NOTE: Transporting entry BOOKMENU.CBT                                       
NOTE: Transporting entry DEFAULT .FORM        
NOTE: Transporting entry HELP    .HELP        
NOTE: Transporting entry CLIST   .LIST        
NOTE: Transporting entry ENTRYTYP.LIST        
NOTE: Transporting entry SPELLALL.PMENU       
NOTE: Transporting entry SPELLSUG.PMENU       
NOTE: Transporting entry ADDON1  .PROGRAM     
NOTE: Transporting entry ADDON2  .PROGRAM      
NOTE: Proc CPORT begins to transport data set TEST.VARNUM        
NOTE: The data set contains 10 variables and 100 observations.

Note:   Default output filenames are operating environment-specific.  [cautionend]

PROC CPORT reads the contents of the entire library that is referenced by the libref TEST and writes to the default transport file. The remaining series of notes indicate that PROC CPORT transports the data set TEST.CITY, the catalog TEST.FORMATS, the catalog TEST.TEST, and the data set TEST.VARNUM into the transport file JOE.MYTEST.DATA.


Verifying Transport Files

You should verify the integrity of your transport files at the source computer before the files are transferred to the target computer. A successful verification at the source computer can eliminate the possibility that the transport file was created incorrectly. Also, after you transfer a file to the target computer, you can compare the transport file that was sent from the source computer with the file that was received at the target computer. For details, see Strategies for Verifying Transport Files.


Transferring Transport Files to the Target Computer

Verify the file attributes of the transport files before they are transferred to the target computer. This example shows typical output for TSO.

Using TSO LISTD Command to Verify the Attributes of the Transport File

listd "userid.mytest.data"
USERID.MYTEST.DATA
--RECFM-LRECL-BLKSIZE-DSORG
  FB    80    8000    PS
--VOLUMES--
  APP009

After you verify the attributes of the transport files, you can use FTP to transfer them over the network. Change the default DCB attributes as necessary in the FTP dialog. In this example, because the user on the source computer has permission to write to the target computer, the FTP put command is used to write the transport file to the target computer.

This example shows the FTP commands that you specify at the source computer to write the transport files to the target computer.

FTP Dialog for File Transfer

ftp mypc   1  
 EZA1450I MVS TCP/IP FTP V3R2
 EZA1554I Connecting to SPIDER 10.24.2.32, port 21
 220 spider FTP server (Version 4.162 Tue Nov 1
  10:50:37 PST 1988) ready.
 EZA1459I USER (identify yourself to the host):
userid password
 EZA1701I >>>USER joe
 331 Password required for joe.
 EZA1701I >>>PASS ********
 230 User joe logged in.   
 EZA1460I Command:  2 
binary
 EZA1701I >>>TYPE i
 200 Type set to I.
 EZA1460I Command:  3  
put 'joe.mytest.data' c:\tport.dat
 EZA1701I >>>SITE VARrecfm Lrecl=80  4  
  Recfm=FB BLKSIZE=8000
 500 'SITE VARRECFM Lrecl=80 Recfm=FB BLKSIZE=23440':
  EZA1701I >>>PORT 10,253,1,2,129,50
 200 PORT command
 EZA1701I >>>STOR c:\tport.dat  5  
 150 Opening BINARY mode data connection for c:\tport.dat
 226 Transfer complete.  6  
 EZA2517I 6071600 bytes transferred in 13 seconds.
  Transfer rate 466.18 Kbytes/sec.
 EZA1460I Command:  7  
quit
 EZA1701I >>>QUIT
 221 Goodbye.
 READY

[1] From the z/OS source computer, the user invokes FTP to connect to the Windows target computer MYPC.

[2] The transport file attribute BINARY indicates that the z/OS transport file should be transferred from the source computer in BINARY format.

[3] The FTP put command copies the transport file named JOE.MYTEST.DATA from the source computer to the target computer physical location C:\TPORT.DAT.

[4] The FTP file attribute commands indicate a record length of 80 bytes, a fixed record type, and a block size of 8000.

[5] TPORT.DAT is saved to drive C.

[6] Messages indicate that the transfer was successful. For details about listing a file size, see Verifying the Size of a Transport File.

[7] The user quits the FTP session.


Using PROC CIMPORT at the Target Computer to Import Transport Files into Native Format

This example shows a SAS program that translates the transport file from transport format into native format.

SAS Program That Imports Transport Files into Native Format

libname newlib 'c:\mylib';
proc cimport infile='c:\tport.dat' library=newlib;
run;

This LIBNAME statement assigns the libref NEWLIB to the physical location c:\mylib , which stores the entire V7 library. PROC CIMPORT reads the entire content of the transport file that is identified in the INFILE= option and writes it to the output location that is identified in the LIBNAME= option.

As an alternative to importing the entire contents of the library into native V7 format, you can select or exclude specific entities from the transport library.

Here are examples:

Selecting One or More Data Sets

filename target 'c:\tport.dat';
libname newlib 'c:\mylib';
proc cimport infile=target library=newlib;
   select varnum;
run;

In the preceding example, the fileref TARGET points to the location where the transport file was transferred to the target computer. The libref NEWLIB points to the location to store the selected member. PROC CIMPORT reads the entire content of the transport file that is identified in the INFILE= option and writes only the member that is identified in the SELECT statement. The data set VARNUM is written to the library NEWLIB in Windows format.

Selecting a Catalog Entry Type

filename target 'c:\tport.dat';
libname newlib 'c:\mylib';
proc cimport infile=target library=newlib
   memtype=catalog et=program;
run;

In the preceding example, PROC CIMPORT reads the entire content of the transport file that is identified in the INFILE= option and writes only members of type CATALOG and entries of type PROGRAM to the library NEWLIB in Windows format.

Selecting Catalog Entries

filename target 'c:\tport.dat';
libname newlib 'c:\mylib';
proc cimport infile=target library=newlib memtype=cat;
   select spellsug.pmenu addon1.program;
run;

In the preceding example, PROC CIMPORT reads the entire content of the transport file that is identified in the INFILE= option and writes only the entries SPELLSUG.PMENU and ADDON1.PROGRAM of member type CATALOG to the library NEWLIB in Windows format.


Viewing the SAS Log at the Target Computer

This example shows a SAS log that documents the successful execution of the SAS program that is shown in SAS Program That Imports Transport Files into Native Format.

Target Computer Log File

NOTE: Proc CIMPORT begins to create/update data set NEWLIB.CITY
NOTE: The data set index REGION is defined.
NOTE: Data set contains 7 variables and 72 observations.
NOTE: Proc CIMPORT begins to create/update catalog NEWLIB.FORMATS
NOTE: Entry REGFMT.FORMATC has been imported.
NOTE: Entry SALEFMT.FORMATC has been imported.
NOTE: Entry SIZEFMT.FORMATC has been imported.
NOTE: Total number of entries processed in catalog NEWLIB.FORMATS: 3

NOTE: Proc CIMPORT begins to create/update catalog NEWLIB.TEST
NOTE: Entry ABOUT.CBT has been imported.
NOTE: Entry APPEND.CBT has been imported.
NOTE: Entry BOOKMENU.CBT has been imported.
NOTE: Entry DEFAULT.FORM has been imported.
NOTE: Entry HELP.HELP has been imported.
NOTE: Entry CLIST.LIST has been imported.
NOTE: Entry ENTRYTYP.LIST has been imported.
NOTE: Entry SPELLALL.PMENU has been imported.
NOTE: Entry SPELLSUG.PMENU has been imported.
NOTE: Entry ADDON1.PROGRAM has been imported.
NOTE: Entry ADDON2.PROGRAM has been imported.
NOTE: Total number of entries processed in catalog NEWLIB.TEST: 11

NOTE: Proc CIMPORT begins to create/update data set NEWLIB.VARNUM
NOTE: Data set contains 10 variables and 100 observations.

PROC CIMPORT creates the data set NEWLIB.CITY, the catalog NEWLIB.FORMATS, the catalog NEWLIB.TEST, and the data set NEWLIB.VARNUM at the target computer in Windows format.

Previous Page | Next Page | Top of Page