BookmarkSubscribeRSS Feed
Swapnil_21
Obsidian | Level 7

We need to extract data from z/os mainframe. We are able to download the datasets. However, data looks unreadable. 

Here is the code we are using 

%let PROD_UX=ram189prd.gwd.grpinf.net 5668;
%let MF=PROD_UX;
signon &MF. user="abcd" password="welcome2sas";
libname rwork slibref=work server=PROD_UX;
rsubmit &MF.;
data test2x /*view=test2x*/;

 

 


infile "PZLN.VMO00.POL1501" dsd;
input @1 KEY $8.
@9 STATUS1 $1.
@10 STATUS2 $1.
@19 RECTIME $8.
@27 CKEY $13.
@40 RECADTE $8.
@48 RECATME $8.
@56 CERTRTRN $1.
@57 MEDDIABC $1.
;
run;
endrsubmit;

 

Dataset is generated , however it looks  like this 

 

Here is Proc contents output 

 
Data Set Name RWORK.TEST2X Observations 304317
Member Type DATA Variables 9
Engine REMOTE9 Indexes 0
Created 02/04/2025 04:57:48 Observation Length 49
Last Modified 02/04/2025 04:57:48 Deleted Observations 0
Protection   Compressed NO
Data Set Type   Sorted NO
Label      
Data Representation MVS_32    
Encoding open_ed-1146 United Kingdom (OpenEdition)  

 

 

 

I am running the code on SAS Studio. How do i encode this dataset in readable format. Any help is appreciated

8 REPLIES 8
Ksharp
Super User

Firstly, check your sas session 's encoding by :

%put &=sysencoding. ;

Is it "open_ed-1146"?
If not add encoding= option to specify right encoding, and also check option recfm= and termstr=

infile "PZLN.VMO00.POL1501" dsd encoding='utf8'  recfm=s370 termstr=nl;

Swapnil_21
Obsidian | Level 7
It is open_ed-1146. However, your options dont work. it fails . Here is the log 144 data test2x /*view=test2x*/;
145 infile "PZLN.VMO00.POL1501" dsd encoding='utf8' recfm=s370v termstr=nl;
-------
23
ERROR 23-2: Invalid option name TERMSTR.
146 input @1 KEY $8.
147 @9 STATUS1 $1.
148 @10 STATUS2 $1.
149
150 @19 RECTIME $8.
151 @27 CKEY $13.
152 @40 RECADTE $8.
153 @48 RECATME $8.
154 @56 CERTRTRN $1.
155 @57 MEDDIABC $1.
156 ;
157 run;
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.TEST2X may be incomplete. When this step was stopped there were 0 observations and 9 variables.
WARNING: Data set WORK.TEST2X was not replaced because this step was stopped.
NOTE: The DATA statement used 0.00 CPU seconds and 26458K.
NOTE: The address space has used a maximum of 1004K below the line and 33612K above the line.
NOTE: Remote submit to PROD_UX complete.
SASKiwi
PROC Star

Since you appear to be viewing the SAS dataset from your local SAS session via a remote LIBNAME so what is the encoding on both your remote and local SAS sessions? Run this in both and post the results:

proc options option = encoding;
run;

Also try downloading the dataset to your local SAS session using PROC DOWLOAD to see if that works OK.

 

Swapnil_21
Obsidian | Level 7
I have run this in both.
My remote is open_ed-1146
and local is utf-8
Swapnil_21
Obsidian | Level 7
Remote is open_ed-1146
Local is utd-8
SASKiwi
PROC Star

Try viewing downloaded data and is it now readable?

 

rsubmit &MF.;
proc download data = test2x;
run;
endrsubmit;
Tom
Super User Tom
Super User

Try asking SAS to transcode the data before trying to view it.

You might try adding the INENCODING option to the LIBNAME statement.

 

You might also check what types of bytes the text file actual has.  If the values are ASCII codes and not EBCDIC you might need to use the $ASCII informat instead of the $ informat in the INPUT statement.  You could try asking SAS to dump a few lines to the log.

data _null_;
  infile "PZLN.VMO00.POL1501" obs=5;
  input;
  list;
run;

 

PS Your INFILE statement and INPUT statements are at conflict with each other.  You don't need to specify DSD if you plan to read the data using FORMATTED mode INPUT statement.  And if the file is delimited then do not use formatted style in the INPUT statement, that will read through the delimiters, instead read the values in LIST mode.

 

Ksharp
Super User
Since your
Remote is open_ed-1146
Local is utd-8
, you could just try option encoding='utf8' :

infile "PZLN.VMO00.POL1501" dsd encoding='utf8' ;

hackathon24-white-horiz.png

Join the 2025 SAS Hackathon!

Calling all data scientists and open-source enthusiasts! Want to solve real problems that impact your company or the world? Register to hack by August 31st!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 8 replies
  • 1288 views
  • 0 likes
  • 4 in conversation