Chapter Contents

Previous

Next
Moving and Accessing SAS Files across Operating Environments

Representing EBCDIC as ASCII or Hexadecimal Data


Interpreting EBCDIC as ASCII Data

CMS and OS/390 hosts store character data in EBCDIC format. The following example shows SAS code that interprets the first portion of a transport file as ASCII data.

Note:   This program does not convert the file to ASCII. It only interprets the first five records in the file as ASCII values and writes them to the SAS log. The transport file remains unchanged.  [cautionend]

Code That Interprets an EBCDIC File as ASCII
//PEEK JOB (,X101),'SMITH,B.',TIME=(,3) /*JOBPARM FETCH //STEP1 EXEC SAS //transport-file DD DSN=USERID.XPT6.FILE,DISP=SHR //SYSIN DD * data _null_; infile tranfile obs=5; input theline $ascii80.; put theline; run; /*

Log output indicates whether the XPORT engine or PROC CPORT created the transport file.

ASCII Text Displayed by the XPORT Engine shows the first 40 characters in ASCII text of a transport file that the XPORT engine creates.


ASCII Text Displayed by the XPORT Engine
HEADER RECORD*******LIBRARY HEADER RECORD!!!!!!!00

ASCII Text Displayed by PROC CPORT shows the first 40 characters in ASCII text of a transport file that PROC CPORT creates.


ASCII Text Displayed by PROC CPORT
**COMPRESSED** **COMPRESSED** **COMPRESSED** **COM

Note:   If you set the NOCOMPRESS option to PROC CPORT, compression is suppressed, which prevents the display of the preceding text in a transport file.  [cautionend]
For technical details about the transport format that is used for a data set, see Technical Support article TS-140, The Record Layout of a SAS Transport Data Set.


Interpreting EBCDIC as Hexadecimal Data

Use an appropriate utility on your host to browse a transport file in hexadecimal format. For OS/390, you can use ISPF (which is an interactive structured programming facility), for browsing a transport file in hexadecimal format.

Alternatively, use the following SAS program to display in hexadecimal format the first twenty 80-byte records of a transport file

Code That Interprets an EBCDIC File as Hexadecimal
data _null_; infile 'transport-file'; input; list; put '-------------------'; if _n_ > 20 then stop; run;

Hexadecimal Translation of Text Created by the XPORT Engine shows the hexadecimal text of the first 40 characters in a transport file that the XPORT engine creates:


Hexadecimal Translation of Text Created by the XPORT Engine
484541444552205245434F52442A2A2A2A2A2A2A 4C5920484541444552205245434F524421212121

This hexadecimal representation is equivalent to ASCII Text Displayed by the XPORT Engine.

Hexadecimal Translation of Text Created by PROC CPORT shows the hexadecimal text of the first 40 characters in a transport file that PROC CPORT creates.


Hexadecimal Translation of Text Created by PROC CPORT
2A2A434F4D505245535345442A2A202A2A434F4D 50442A2A202A2A434F4D505245535345442A2A20

This hexadecimal representation is equivalent to ASCII Text Displayed by PROC CPORT.


Chapter Contents

Previous

Next

Top of Page

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