Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Reading a file in SAS

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
new2cobol

New User


Joined: 04 Jan 2006
Posts: 77
Location: Bangalore

PostPosted: Thu Mar 16, 2006 3:12 am    Post subject: Reading a file in SAS
Reply with quote

I have to read a file in SAS and extract a value in SAS.

The file is of the format:

AB_DATE=20061011
AB_FILENAME=ABC.CDF.EFGH.FILE
AB_DIR=/ABC/DEF
etc...

Now I need to extract the file name, which has the key AB_FILENAME.
the pice of code I tried was,

Code:
 
INPUT file DLM = '=' DSD;
INPUT @4 Key $ Value $;


Now, when I select value for the key = 'FILENAME' (I had to put @4 because SAS does not recognise '_' ) i get the value as the first 8 charecters of the name.

I tried
Code:
 
INPUT file DLM = '=' DSD;
INPUT @4 Key $. Value $CHAR18.;


Which gave me an error, and
Code:
 
INPUT file DLM = '=' DSD;
INPUT @4 Key $ Value $18;


Which returned only 1 charecter!

How can I get the whole file name in the variable??

HELP!!!
Back to top
View user's profile Send private message

manyone

New User


Joined: 09 Mar 2006
Posts: 9

PostPosted: Fri Mar 17, 2006 1:22 am    Post subject:
Reply with quote

//* you need the LENGTH statement at the beginning to specify field sizes
//SAS EXEC SAS
//INP DD *
WORD=VALUE
AB_DATE=20061011
AB_FILENAME=ABC.CDF.EFGH.FILE
AB_DIR=/ABC/DEF
//SYSIN DD *
DATA INP;
LENGTH KEY $16 VALUE $16;
INFILE INP DLM='=' DSD;
INPUT KEY $ VALUE $;
PROC PRINT;
//
Back to top
View user's profile Send private message
new2cobol

New User


Joined: 04 Jan 2006
Posts: 77
Location: Bangalore

PostPosted: Fri Mar 17, 2006 6:49 am    Post subject: Re: Reading a file in SAS
Reply with quote

Thanks!!!

I found the solution in another way... I dropped all lines which did not have FILENAME in the key, and declared length for key and value.

Code:

INPUT @4 KEY $ @;
IF KEY ~= 'FILENAME' THEN DELETE;
INPUT @4 KEYNAME $.
          VALUE   $ 14-80. ;


And did the rest of the processing, but thanks a lot!!!

Always open to learn something new.....
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 2 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 4 Fri Mar 24, 2017 11:51 am
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Formatting VB File Learncoholic DFSORT/ICETOOL 3 Mon Mar 20, 2017 12:29 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us