BookmarkSubscribeRSS Feed
Calcite | Level 5


Im trying to read SAS output created in mainframe. It was created with proc CPORT.

the file was then mailed by mainframe team. they downloaded it as Binary file.  Now im trying to read this file in proc cimport in sas eg windows.


Im using the below code


%let schemacode = /opt/shares/sas/production/znative_sas/SAS_CODES/tmp/Safety_SAS;

%put &schemacode;


filename filenm  "&schemacode/'FFU.SF010010.T36A'";




getting error as unregocnized file format



Super User
Then do not transport this file via binary mode.
If you are using FTP to transport then do not use BINARY command, just use PUT or MPUT command .
Calcite | Level 5

will try with that .. just checking is it recommended to read it through ftp?

Super User Tom
Super User

"mailed"?  That might not be such a good idea.  Are you sure the file was mailed as a BINARY file?  If it tried to transcode EBCDIC to ASCII or treated it as lines then it would have corrupted the file.


Read the first 160 to 240 bytes of the file and see what they look like.

filename filenm  "&schemacode/'FFU.SF010010.T36A'";
data _null_;
  infile filenm lrecl=80 recfm=n obs=3 ;

The first record should look exactly like the one I get when I dump SASHELP.CLASS to a CPORT file.

1039  proc cport data=sashelp.class file=cport; run;

NOTE: PROC CPORT begins to transport data set SASHELP.CLASS
NOTE: The data set contains 5 variables and 19 observations.
      Logical record length is 40.
NOTE: PROCEDURE CPORT used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds

1040  data _null_;
1041    infile cport lrecl=80 recfm=f obs=3;
1042    input;
1043    list;
1044  run;

NOTE: The infile CPORT is:
      (system-specific pathname),
      (system-specific file attributes)

RULE:     ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0

2   CHAR  LIB CONTROL X64_10PR¼. SAS9.4¼ƒI¼¥D901SASHELP CLASS¼™VC5¼‚RC19¼ˆRL40¼ˆ1¼‡S 0  0
    ZONE  44424445544253353355B02545323B84BA43335454445244455B9543B85433B85433B83B85232232
    NUMR  C9203FE42FC0864F1002C603139E4C39C5490131385C003C133C9635C22319C82C40C81C73000000

3   CHAR   12 NO¼„0¼‰1¼•ansi¼‚¼.¼‚¼Î¼ÎStudent Data¼ÂSPAN CONTROL -7¼‚40¼…1¼†40¼ŠL¼ˆ40¼Ž¼&¼
    ZONE  233244B83B83B96676B8B0B8BCBC577666724676BC554424445544223B833B83B833B84B833B8B2B
    NUMR  0120EFC40C91C51E39C2C2C2CECE34545E404141C2301E03FE42FC0D7C240C51C640CACC840CEC6C
NOTE: 3 records were read from the infile (system-specific pathname).
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
Calcite | Level 5

Thanks, i tried checking it is keep on running and not stopping the execution

Super User Tom
Super User

Make sure to use OBS=3 and RECFM=F.  

If it still takes more than a micro second then you either have a typo somewhere causing unbalanced quotes or the file you are reading is frozen some how.


You need to follow the instructions in this SAS Note:


The important things are:

  • Create a transport file using CPORT on the mainframe with these characteristics: LRECL=80 RECFM=FB BLKSIZE=8000. This creates an ASCII-formatted file.
  • Transfer the file from mainframe to PC / Server using the BINARY method. This will retain the ASCII format so it can be read correctly on the target machine.




The early bird rate has been extended! Register by March 18 for just $695 - $100 off the standard rate.


Check out the agenda and get ready for a jam-packed event featuring workshops, super demos, breakout sessions, roundtables, inspiring keynotes and incredible networking events. 


Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 4 in conversation