Chapter Contents |
Previous |
Next |
Moving and Accessing SAS Files across Operating Environments |
Using PROC CPORT at the Source Host to Create Transport Files: OS/390 |
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;
Viewing the SAS Log at 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.
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
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
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.