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 Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am
No new posts File processing vishwakotin Mainframe Interview Questions 9 Fri Apr 28, 2017 11:38 am
No new posts Occurrence of various strings within ... TS70363 JCL & VSAM 1 Thu Apr 27, 2017 8:18 pm


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