rssunt.gif (12308 bytes)


Question:

How to convert a SAS data set from the mainframe to SAS for Windows?

Answer:

There are two methods in transferring a SAS file to other platforms: using XPORT engine and PROC CPORT.  This FAQ focuses on the former method, which performs transportation of data file only.  For the second method, which does the SAS catalogs, consult the SAS manual SAS Companion for the MVS Environment. Version 6, Second Edition (pp. 134-7) (SAS/MVS hereafter).

To move SAS data sets from one environment to another, it is necessary to convert the file into a transport file format.  The following introduces a four-step procedure to transfer the file from MVS to local host (PC) via CMS.

1.  Convert the SAS file into a transport file format using the following program:

//IDXXORTZ JOB (IDXX,2,20),'YOURNAME',CLASS=A,PASSWORD=XXXXXX,
// USER=IDXX
/*ROUTE PUNCH UNTVM1.IDXX
/*ROUTE PRINT UNTVM1.IDXX
// EXEC IEFBR14
//TRANS DD DSN=USER.IDXX.TEST.TRANS,UNIT=SYSDA,
//      VOL=SER=ACAD03,DISP=(OLD,DELETE)
// EXEC SAS
//TRANS DD DSN=USER.IDXX.TEST.TRANS,UNIT=SYSDA,
//    VOL=SER=ACAD03,DISP=(NEW,KEEP),
//    SPACE=(CYL,(50,20),RLSE),
//    DCB=(RECFM=FB,LRECL=80,BLKSIZE=8000)
//DATA1 DD DSN=USER.IDXX.TEST.SAS,UNIT=SYSDA,
//    VOL=SER=ACAD03,DISP=SHR
//SYSIN DD *
LIBNAME TRANS XPORT;
PROC COPY IN=DATA1 OUT=TRANS MEMTYPE=DATA;
run;

This program converts a SAS system file located on MVS system disk (ACAD03) into a transport file on the same disk.  The IEFBR14 procedure cleans up any file previously created in the same name. Note that the boldfaced DCB (Data Control Block) specification, which fixes the LRECL (Logical Record Length) to 80, is the key for the file conversion.   The new transport file MUST BE a sequential file in 80 columns.

2. To download this file to CMS, use the following IEBGENER program:

//IDXXORTZ JOB (IDXX,12,999),'YOURNAME',
//        CLASS=N,PASSWORD=XXXXXX,USER=IDXX
/*JOBPARM CARDS=9999999
/*ROUTE PRINT UNTVM1.IDXX
/*ROUTE PUNCH UNTVM1.IDXX
//STEP1  EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=A
//SYSIN DD DUMMY
//SYSUT1 DD DSN=USER.IDXX.TEST.TRANS,DISP=(OLD,KEEP),UNIT=SYSDA,
//          VOL=SER=ACAD03
//SYSUT2 DD SYSOUT=B
 

This program downloads the transport file from the MVS system disk ACAD03 to the CMS environment and the PUNCH output (the SAS transport file) will be routed to the user's READER LIST.  Preparing for large data set, this program specifies CLASS=N and a large number for the JOBPARM parameter.  It is recommended to create a temporary disk before receiving the file to CMS.  To create a temporary disk in CMS, type:

tempdisk

at the Ready mode.  Specify the number of cylinders for temporary storage.  By default, the temporary 193 disk will be created as the E disk.  Copy the file from the READERLIST to E disk by receiving the transport file into TEST TRANSPRT E1.  At the command column, type:

RECEIVE / TEST TRANSPRT E1

3.  Use FTP to download the transport file to any local host (UNIX or PC).  For detailed instructions, consult the RSS document Transferring Files to and From CMS (http://www.unt.edu/rss/docs/cmsftp.htm). Specify the binary mode for file transferral.

4.  Import the SAS transport file into SAS for Windows (v 6.12) using the following program:

libname trans xport 'c:\temp\test.tra';  /* transport file */
libname new 'c:\temp'; /* output library */
proc copy in=trans out=new;
run;

Note that the first libname statement points to the transport FILE instead of a directory.  The file name of the original transport file has been truncated to test.tra.  The XPORT keyword specifies the engine type of the library.  The new SAS system file (v 612 for Windows) will be created under the directory ‘c:\temp' with the file name test.sd2.

Reference:

SAS Institute Inc., SAS Companion for the MVS Environment, Version 6, Second Edition, Cary, NC: SAS Institute Inc., 1996. 503 pp.

Research and Statistical Support (RSS). Transferring Files to and From CMS. (http://www.unt.edu/rss/docs/cmsftp.htm)