Chapter Contents

Previous

Next
Moving and Accessing SAS Files across Operating Environments

OS/390 TSO to UNIX File Transport


Using PROC CPORT at the Source Host to Create Transport Files: OS/390

The following example shows a SAS program that creates three data sets in OS/390 format and translates them to transport format.

SAS Program That Creates Data Sets and Transport Files: OS/390
[1]/* Specify tport file */ filename tport ftp 'tport.dat' cd='mydir' /* Specify directory */ host='myhost.mycompany.com' /* Specify your host */ user='myuser' /* Specify user */ pass='mypass' /* Specify password */ rcmd='site umask 022' /* Set permissions to */ /* -rw-r--r-- */ recfm=s /* binary transfer */ debug; /* write ftp messages */ /*-----------------------------------*/ /* Allocate the SAS test library. */ /*-----------------------------------*/ [2] libname trantest '.trantest.lib' disp=(new,catlg,delete); /*---------------------------------------*/ /* Creates data set GRADES which */ /* contains numeric and character data. */ /*---------------------------------------*/ [3] data trantest.grades; input student $ test1 test2 final; datalines; Fred 66 80 70 Wilma 97 91 98 ; /*-----------------------------------*/ /* Creates data set SIMPLE which */ /* contains character data only. */ /*-----------------------------------*/ data trantest.simple; x='dog'; y='cat'; z='fish'; run; /*------------------------------------*/ /* Creates data set NUMBERS which */ /* contains numeric data only */ /*------------------------------------*/ data trantest.numbers; do i=1 to 10; output; end; run; /*------------------------------------*/ /* Uses PROC CPORT to write the */ /* transport file. This transport */ /* file is written to UNIX by using */ /* the FTP access method. */ /*------------------------------------*/ [4] proc cport library=trantest file=tport; run; /*------------------------------------*/ /* Reads the transport file on UNIX */ /* by using the FTP access method. */ /* Uses PROC CIMPORT to transfer and */ /* to import the data sets to the */ /* WORK library. */ /*------------------------------------*/ [5] proc cimport infile=tport library=work; run;
  1. The FILENAME statement assigns the libref TPORT to the physical location TPORT.DAT, which stores the entire library to be created. The FTP access method option specifies the attributes of the file transfer operation. The RCMD= command and SITE UMASK 022 argument set the user file access permissions on the target host. The RECFM= option and the S argument specify a binary transfer. For details about the FTP access method options, see the syntax for the FILENAME statement in SAS Language Reference: Dictionary.

  2. The LIBNAME statement assigns TRANTEST to the physical location syspref.TRANTEST.LIB, which stores the data sets to be created. The DISP= option specifies the status of the data set at the beginning and the end of the job. NEW indicates that a new data set is to be created. CATLG specifies that the system should place an entry in the system catalog for normal job termination. DELETE specifies that the data set be deleted at the end of the step for abnormal job termination.

  3. The next three DATA statements create the SAS data sets.

  4. PROC CPORT reads the library data sets from the OS/390 host and writes the transport data to the UNIX target host.

  5. PROC CIMPORT reads the transport file from the UNIX target host and writes the SAS data sets to the WORK library.


Viewing the SAS Log at the OS/390 Source Host

The SAS log is presented in three parts. The following example shows the successful creation of data sets on the OS/390 source host.

Source Host OS/390 SAS Log: Part 1 of 3
[1] NOTE: SAS (r) Proprietary Software Version 7 (TS00.00P1P102298) Licensed to SAS INSTITUTE INC., Site 0000000001. [2] NOTE: This session is executing on the OS/390 V02R04M00 platform. NOTE: Running on IBM Model 9672, IBM Model 9672, IBM Model 9672. +++++ [3] filename tport ftp 'tport.dat'/* Specify tport file */ cd='mydir' /* Specify directory */ host='myhost.mycompany.com' /* Specify your host */ user='myuser' /* Specify user */ pass='mypass' /* Specify password */ rcmd='site umask 022' /* Set permissions to */ /* -rw-r--r-- */ recfm=s /* binary transfer */ debug; /* write ftp messages */ /*----------------------------------------------------*/ /* Allocate the SAS test library. */ /*----------------------------------------------------*/ [4] libname trantest '.trantest.lib' disp=(new,catlg,delete); NOTE: Libref TRANTEST was successfully assigned as follows: Engine: V7 Physical Name: JOE.TRANTEST.LIB /*--------------------------------------*/ /* Creates data set GRADES which */ /* contains numeric and character data. */ /*--------------------------------------*/ [5] data trantest.grades; input student $ test1 test2 final; datalines; NOTE: The data set TRANTEST.GRADES has 2 observations and 4 variables. ; /*-----------------------------------*/ /* Creates data set SIMPLE which */ /* contains character data only. */ /*-----------------------------------*/ data trantest.simple; x='dog'; y='cat'; z='fish'; run; NOTE: The data set TRANTEST.SIMPLE has 1 observations and 3 variables. /*------------------------------------*/ /* Creates data set NUMBERS which */ /* contains numeric data only. */ /*------------------------------------*/ data trantest.numbers; do i=1 to 10; output; end; run; NOTE: The data set TRANTEST.NUMBERS has 10 observations and 1 variables.
  1. The source host runs SAS Version 7, which means that the SAS session default library engine is V7.

  2. The IBM source host runs OS/390 V02R04M00.

  3. The FILENAME statement identifies the external file and specifies the attributes of the FTP access method, which transfers the transport file over the network.

  4. The LIBNAME statement assigns the libref TRANTEST to the location for the files in native format on the OS/390 source host.

  5. The data sets TRANTEST.GRADES, TRANTEST.SIMPLE, and TRANTEST.NUMBERS are created in the library that is referenced by TRANTEST.

The following example shows the creation of the transport file and its transfer across the network by using the FTP access method.

OS/390 Source Host SAS Log: Part 2 of 3
/*--------------------------------------------*/ /* Uses PROC CPORT to write the library */ /* TRANTEST data sets to the transport file */ /* via the FTP access method. */ /*--------------------------------------------*/ [1] proc cport library=trantest file=tport; run; [2] NOTE: 220 myhost FTP server (Version 4.162 Tue Nov 1 10:50:37 PST 1988) ready. NOTE: <<< 220 myhost FTP server (Version 4.162 Tue Nov 1 10:50:37 PST 1988) ready. NOTE: >>> USER hostftp NOTE: <<< 331 Password required for hostftp. NOTE: >>> PASS XXXXXXX NOTE: <<< 230 User hostftp logged in. NOTE: >>> PORT 10,253,1,2,30,208 NOTE: <<< 200 PORT command NOTE: >>> TYPE I NOTE: <<< 200 Type set to I. NOTE: >>> CWD transfer NOTE: <<< 250 CWD command successful. NOTE: >>> PWD NOTE: <<< 257 "/mydir" is current directory. NOTE: >>> site umask 022 NOTE: <<< 200 UMASK set to 022 (was 027) NOTE: >>> STAT NOTE: <<< 211- myhost FTP server status: NOTE: <<< Version 4.162 Tue Nov 1 10:50:37 PST 1988 NOTE: <<< Connected to sdcmvs.mvs.sas.com NOTE: <<< Logged in as hostftp NOTE: <<< TYPE: Image; STRUcture: File; transfer MODE: Stream NOTE: <<< PORT (10,253,1,2,30,208) NOTE: <<< 211 End of status NOTE: >>> STOR tport.dat NOTE: <<< 150 Opening BINARY mode data connection for tport.dat. NOTE: User hostftp has connected to FTP server on Host myhost.unx.com. NOTE: Proc CPORT begins to transport data set TRANTEST.GRADES NOTE: The data set contains 4 variables and 2 observations. Logical record length is 32. NOTE: Proc CPORT begins to transport data set TRANTEST.NUMBERS NOTE: The data set contains 1 variables and 10 observations. Logical record length is 8. NOTE: Proc CPORT begins to transport data set TRANTEST.SIMPLE NOTE: The data set contains 3 variables and 1 observations. Logical record length is 10. NOTE: <<< 226 Transfer complete. NOTE: >>> QUIT
  1. PROC CPORT copies the files that are identified in the LIBRARY= option (from OS/390 format) to the library that is identified in the FILE= option (in transport format).

  2. The FTP access method connects to the UNIX target host across the network and writes the file referenced by the libref TPORT to the UNIX target host.

The following example shows the successful import of the transport file to native format on the UNIX target host and a verification of the method that was used for creating the transport file on the OS/390 source host.

OS/390 Source Host SAS Log: Part 3 of 3
/*---------------------------------------------*/ /* Use FTP access method to read the transport */ /* file. Use PROC CIMPORT to import the test */ /* data sets to library WORK. */ /*---------------------------------------------*/ [1] proc cimport infile=tport library=work; run; [2] NOTE: 220 myhost FTP server (Version 4.162 Tue Nov 1 10:50:37 PST 1988) ready. NOTE: <<< 220 myhost FTP server (Version 4.162 Tue Nov 1 10:50:37 PST 1988) ready. NOTE: >>> USER hostftp NOTE: <<< 331 Password required for hostftp. NOTE: >>> PASS XXXXXXX NOTE: <<< 230 User hostftp logged in. NOTE: >>> PORT 10,253,1,2,30,210 NOTE: <<< 200 PORT command NOTE: >>> TYPE I NOTE: <<< 200 Type set to I. NOTE: >>> CWD transfer NOTE: <<< 250 CWD command successful. NOTE: >>> PWD NOTE: <<< 257 "/mydir" is current directory. NOTE: >>> site umask 022 NOTE: <<< 200 UMASK set to 022 (was 027) NOTE: >>> STAT NOTE: <<< 211- myhost FTP server status: NOTE: <<< Version 4.162 Tue Nov 1 10:50:37 PST 1988 NOTE: <<< Connected to sdcmvs.mvs.sas.com NOTE: <<< Logged in as hostftp NOTE: <<< TYPE: Image; STRUcture: File; transfer NOTE: <<< MODE: Stream PORT (10,253,1,2,30,210) NOTE: <<< 211 End of status NOTE: >>> RETR tport.dat NOTE: <<< 150 Opening BINARY mode data connection for tport.dat (2320 bytes). NOTE: User hostftp has connected to FTP server on Host myhost.unx.com . NOTE: Proc CIMPORT begins to create/update data set WORK.GRADES NOTE: Data set contains 4 variables and 2 observations.Logical record length is 32 NOTE: Proc CIMPORT begins to create/update data set WORK.NUMBERS NOTE: Data set contains 1 variables and 10 observations. Logical record length is 8 NOTE: Proc CIMPORT begins to create/update data set WORK.SIMPLE NOTE: Data set contains 3 variables and 1 observations. Logical record length is 10 NOTE: <<< 226 Transfer complete. NOTE: >>> QUIT
  1. PROC CIMPORT copies the file that is identified in the INFILE= option (from transport format) to the library that is identified in the LIBRARY= option (in native OS/390 format).

  2. To validate the accuracy of the method that was used for importing the transport file into native format on the UNIX target host, the FTP access method returns the transport file TPORT.DAT to the OS/390 source host across the network. On the local host, PROC CIMPORT copies the transport file into native format. A successful execution of PROC CIMPORT on the source host verifies that a valid transport file was created at the UNIX target host.


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.