04-07-2015 09:42 PM
I need to access a mainframe dataset (SAS file) from SAS Program.
I cannot pass the Dataset name from JCL as the file name is not fixed.
Eg ... File Name is : HLQ.SLQ.TLQ.A&YYMMDD.
In SAS program I can derive YYMMDD and can be able to make up the File name.
I need assistance for how to refer the file name and access it from SAS program.
I am trying the following :
Getting current date as : 20150407 in SAS program.
%LET FNAME = HLQ.SLQ.TLQ.A&YYMMDD;
FILENAME INFIL "&FNAME"
The above is giving error. File name is resolving properly (HLQ.SLQ.TLQ.A150704) but its giving me error stating Error in the FILENAME statement.
File WORK.INFIL.DATA does not exist.
Can some one please assist how to access the Dataset (File) from SAS Program.
Where as If I pass the the dataset name as HLQ.SLQ.TLQ.A150704 from JCL then its working fine (just putting the DD Name mentioned in JCL at SET is working fine).
04-07-2015 10:46 PM
Thank you Jagadesh & Reeza.
I am able to get the variables resolve now but its giving me error like "Invalid Dataset Name".
Let me give few more details about the Dataset structure.
We have SAS File resides inside MVS file.
MVS File name = HLQ.SLQ.TLQ.A%cmpres(&YYMMDD).
SAS File Name = AB_1XYZ%cmpres(&YYMMDD).
If I pass the hard coded MVS Dataset Name from JCL and refer the same at SET as follows its working fine.
But If I dont pass from JCL and derive the file name in SAS Program as follows, the file name is resolving properly and showing the variables and the file names exactly as expected.
But after SET statement its giving me error as "There is not a default input data set (_Last_ is _Null_).
Error 211-185: Invalid dataset name.
I am giving SET as follows:
Can you please assist for this. Thank you very much for your support.
04-08-2015 02:39 AM
You're missing the %let here, so the macro variable is never defined.
04-08-2015 10:32 AM
Sreeni ok libname (sas-dataset tables) and files (raw text files) filenames are different type data. You solved that.
As you are working on a mainframe there are a lot small differences with all approaches.
- Libnames and filenames cannot share the same name as with Windows/Unix. You have seen the JCL and an IO-definition cannot be duplicated.
- Going into production with a Scheduler (eg OPC) the requirement will be to have that dataset in JCL. OPS is supporting supplying scheduled dynamic dates.
By that the scheduler is able to plan and avoiding locking situations.
If you are for that than you can do something similar in the develop environment.