Date: Mon, 17 May 1999 08:46:03 -0400
Reply-To: RAITHEM <RAITHEM@WESTAT.COM>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: RAITHEM <RAITHEM@WESTAT.COM>
Subject: (MVS) Re: (MVS) Wondering in Washington (DC) About FILENAME F
Content-Type: text/plain; charset=US-ASCII
Dear SAS-L-ers,
A couple of weeks ago, I posted a question regarding using the FILENAME SCL
function in a DATA step to allocate an OS data set in an OS/390 (MVS)
environment. The complete posting can be found beneath the Sig line, below. I
would like to thank Tom Lewis, Andrew Kowalcyzk, Jack Shoemaker, Tammie L
Kirkland, and Melvin Klassen for taking the time to suggest solutions. Your
contributions were greatly appreciated!
I sent the problem to SAS Institute's Technical Support group via EMITS, and the
work-around that I settled on is pretty much what they recommended. Here is the
response that I got:
>Hi Michael,
>
> As with all input sources(sas libraries and external files)in the Data
>Step, they must be allocated at compile time. Unfortunately the SCL function
>(now data step function too) is an execution time statement. So, the file
>gets allocated but won't be available until the next step after a step
>boundary...kind of like CALL SYMPUT. Is there some reason that you need to use
>the filename function vs. dynamic allocation on the infile statement. If you
>need to have a fileref available for subsequent steps then you can do both
>the filename function and the infile allocation as follows....
>
>data ....;
>rc=filename('fileref','my.external.file',...);
>infile 'my.external.file';
>.
>.
>.
>run;
I hope that the above will be of help to anybody else out there in SAS-L-Landia
that is working on the same issue!
I hope that this answer proves helpful now, and in the future!
Of course, all of these opinions and insights are my own, and do not reflect
those of my organization or my associates.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Michael A. Raithel
"The man who wrote the book on performance."
E-mail: raithem@westat.com
Author: Tuning SAS Applications in the MVS Environment
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
I often wonder if he is listening; has he ever heard a word I've said? Look at
him in the mirror dreaming; what is happening in his head? -- The Who
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<<<<Michael's original posting>>>>
Dear SAS-L-ers,
Well; color me clueless! Last night, I encountered a problem with a SAS program
that I was modifying at a client site. I thought that a fresh look at it today
would clear up the problem, but no go! I am still clueless.
The operating system is OS/390 running SAS 6.09E, TS455. My program is testing
for the existence of an OS file. If it exists, then the SAS program will
allocate the file and read it in; if not, then an empty SAS data set is
created--for a mondo-big concatenation, further along. The file _DOES_ exist,
but I get an: ERROR: NO LOGICAL ASSIGN FOR FILENAME W2, error when I execute
the code snippet, below:
/***************************************************/
/* BEGINNING OF THE MACRO */
/***************************************************/
%MACRO W2FILES;
*********************************************************;
* STEP4.9.1: PROCESS PAYROLL RECORDS *;
*********************************************************;
DATA PAYW2(KEEP=COSTCTR6 DIV SERVICE);
LENGTH CC6 $7
COSTCTR6 $8
DIV $2
SERVICE $3
;
%IF %SYSFUNC(FILEEXIST(MIKES.W2.FLATFILE)) %THEN %DO;
RC=FILENAME('W2PAY','MIKES.W2.FLATFILE',,'DISP=SHR');
INFILE W2PAY;
INPUT CC6 $ 1-7;
COSTCTR6 = UPCASE(CC6) || ' ';
DIV=UPCASE(SUBSTR(CC6,1,2));
SERVICE='APA';
%END;
%ELSE DELETE;;
RUN;
...... more SAS Code....
%MEND W2FILES;
For some reason, the FILENAME SCL function is not being resolved correctly.
And, I cannot figure out why. I did get a workaround by coding the following:
/***************************************************/
/* BEGINNING OF THE MACRO */
/*************************************************/
%MACRO W2FILES;
*********************************************************;
* STEP4.9.1: PROCESS PAYROLL RECORDS *;
*********************************************************;
DATA PAYW2(KEEP=COSTCTR6 DIV SERVICE);
LENGTH CC6 $7
COSTCTR6 $8
DIV $2
SERVICE $3
;
%IF %SYSFUNC(FILEEXIST(MIKES.W2.FLATFILE)) %THEN %DO;
INFILE "MIKES.W2.FLATFILE";
INPUT CC6 $ 1-7;
COSTCTR6 = UPCASE(CC6) 33 ' ';
DIV=UPCASE(SUBSTR(CC6,1,2));
SERVICE='APA';
%END;
%ELSE DELETE;;
RUN;
....etc...
While the work-around gets the job done, it is less than satisfying to not know
why the FILENAME function did not work. Can anybody shed some light on this
phenomena? I have a feeling that I am missing something really basic here, but
can't put my (typing) finger(s) on it!
I hope that this question proves helpful now, and in the future!
Of course, all of these opinions and insights are my own, and do not reflect
those of my organization or my associates.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Michael A. Raithel
"The man who wrote the book on performance."
E-mail: raithem@westat.com
Author: Tuning SAS Applications in the MVS Environment
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
They call me the seeker; I've been searching low and high; but I won't get to
get what I'm after 'till the day I die... -- The Who
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++