Help using Base SAS procedures

What format to use when reading mainframe dataset

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 124
Accepted Solution

What format to use when reading mainframe dataset

Greetings.  I'm using PC SAS to connect to the mainframe and reading a file.  All is well, with the exception of one field in the dataset.  The mainframe SAS job shows looks like below...

CD-REV-SRC          138  2 A 

CD-CYCLE            154  2 B 

CD-TOWN             156  4 A

So, I know I need to use @138 CD_REV_SRC $2. for the fist and third variables, but I cannot figure out what I need to use as the format for the second variable with the "B".  Any ideas?  If I use $2. I get some strange looking characters.  If I use simply 2., I get missing values.  The below is what I'm trying, and all variables come back okay other than the "B".  Thank you.

data work.ontime;

INFILE ezt;

input

@1   ID_BA      PD6.

@7  CD_BUS    $4.

@16  DT_BILL    $10.

@48  AT_SVC_UNIT_BILLED PD6.2

@100 CD_RATE    $3.

@138 CD_REV_SRC   $2.

@154 CD_CYCLE   $2.    <<<--- this one is the problem

@201 FL_MORE_REV_REC  $1.;

run;

Greg


Accepted Solutions
Solution
‎09-07-2012 02:10 PM
Super User
Super User
Posts: 6,502

Re: What format to use when reading mainframe dataset

Perhaps B stands for Binary?  Did you try IB or PIB informats?

Do you have any other reports or listings that you can look at to confirm that you read the values properly?

If those formats do not work then read it in as a string using $CHAR and print it using $HEX and post some example values.

View solution in original post


All Replies
Solution
‎09-07-2012 02:10 PM
Super User
Super User
Posts: 6,502

Re: What format to use when reading mainframe dataset

Perhaps B stands for Binary?  Did you try IB or PIB informats?

Do you have any other reports or listings that you can look at to confirm that you read the values properly?

If those formats do not work then read it in as a string using $CHAR and print it using $HEX and post some example values.

Frequent Contributor
Posts: 124

Re: What format to use when reading mainframe dataset

Thank you so much Tom.  IB worked like a charm.  It does make sense that it is binary since the field only contains values between 1 and 21. 

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 319 views
  • 0 likes
  • 2 in conversation