Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 opening a dataset after reading it fr... arunsoods DFSORT/ICETOOL 5 Wed Oct 04, 2017 3:54 pm
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts Garbage on output file Hervey Martinez SYNCSORT 4 Wed Sep 27, 2017 12:50 am
No new posts File Aid tool to compare numeric data balaji81_k Compuware & Other Tools 2 Tue Sep 26, 2017 3:35 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us