DATA Step, Macro, Functions and more

Problem reading box charactor from the mainframe

Reply
Frequent Contributor
Frequent Contributor
Posts: 81

Problem reading box charactor from the mainframe

Here is my problem

I am reading a flat file on the mainframe using SAS spawner. One of the input reading field is
@0198 DESCRIPT $CHAR45.
.
When I read it, one of the following filed value on the file(input file) is
toifcitrixc14p. Endpoint Unreachble
After I read, I see the value in the SAS dataset is
toifcitrixc14p'box' Endpoint Unreachble
Note that , here I write box instead of box character because I am not able write a box char.

When I put the following option

infile info lrecl=700 pad ignoredoseof.


I see the following error message.

3 infile info lrecl=700 pad ignoredoseof;
-------------------
23
ERROR 23-2: Invalid option name IGNOREDOSEOF.



Can any one help me out, how to ignore this box char when I read the file. because when I write back to text file, it shift all fields after the filed DESCRIPT.



Thanks

Inpan
Trusted Advisor
Posts: 2,116

Re: Problem reading box charactor from the mainframe

The "box" is a character that can't be printed in your current character set. It is probably a tab character.

You can find the hex code for the character by using a PUT statement and formatting DESCRIPT using the HEX format. Then you can manipulate or remove it using the various character functions in SAS.

Doc Muhlbaier
Duke
Frequent Contributor
Frequent Contributor
Posts: 81

Re: Problem reading box charactor from the mainframe

Thank so much Duke.
I know I can use Compress function to suppress the box char, if I find the hex value of the box char. But is it possible to find any options to ignore globally any special char like this when I read any input that have special char because I don't know if other variable have the same issue.




Thanks

Inpan
Respected Advisor
Posts: 4,173

Re: Problem reading box charactor from the mainframe

Hi Inp

If I understand that right then you want to have SAS to solve an issue which you have with your data.
It sounds to me as if you will need some data cleansing after reading the data. You could use translate for that - translating a defined set of special characters to blanks.
More general would be to use Perl Regular Expressions (have a look at PRXCHANGE), "\s" matches all whitespace characters - that is what most probably then shows up as a 'box'. So just translate all whitespace characters to blanks.

Something close to the following should do the job:
data ...
PID=PRXPARSE ('s/\s/ /io');
infile .... truncover;
input @;
call PRXCHANGE(PID,-1,_infile_);
input @1 var1 @3var2;
...

Your file and all the processing happens on the Mainframe (EBCDIC) but you see the result in an 'ASCII environment (EG?). It could be (less likely) that there is some problem with the translation (trantab) between this two environments.

To see the special character in your Mainframe file use your Mainframe editor and type on the command line "Hex on"; a tab (the most likely problem char) would have the Hex value 05.

HTH
Patrick

P.S: forget about 'pad', just use 'truncover' Message was edited by: Patrick
Frequent Contributor
Frequent Contributor
Posts: 81

Re: Problem reading box charactor from the mainframe

Hi Pat,
Thank you so much ; Your solution resoved my problem, sorry for my late response.


Thanks


Inpan
Ask a Question
Discussion stats
  • 4 replies
  • 286 views
  • 0 likes
  • 3 in conversation