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 Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm


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