IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Using FILEVAR in SAS for multiple ASCII files


IBM Mainframe Forums -> All Other Mainframe Topics
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Charles Wolters

New User


Joined: 30 Mar 2011
Posts: 48
Location: United States

PostPosted: Fri May 13, 2011 1:15 am
Reply with quote

I have 20 ASCII files all with an identical fixed column layout. In SAS I want to be able to read these and create one SAS data set using one SAS data step. In UNIX and Windows I have used the FILEVAR statement to accomplish this task. Has anybody used the FILEVAR statement in a Z/OS environment? If so , what is the most efficient way to get my 20 ASCII files into a data set that can be processed by SAS? Is the TSO LISTC command the best way to go?

Charles Wolters
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Fri May 13, 2011 1:58 am
Reply with quote

1. ASCII data is rare on a mainframe -- and usually causes problems.

2. Concatenate the files in your JCL and forget using FILEVAR -- SAS Problem Note 41191 suggests not using FILEVAR on z/OS systems.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Fri May 13, 2011 11:42 am
Reply with quote

Quote:

2. Concatenate the files in your JCL and forget using FILEVAR -- SAS Problem Note 41191 suggests not using FILEVAR on z/OS systems.


That is only if beside FILEVAR also a userexit is used, for the rest FILEVAR works fine.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Fri May 13, 2011 11:44 am
Reply with quote

Charles Wolters wrote:
I have 20 ASCII files all with an identical fixed column layout. In SAS I want to be able to read these and create one SAS data set using one SAS data step. In UNIX and Windows I have used the FILEVAR statement to accomplish this task. Has anybody used the FILEVAR statement in a Z/OS environment? If so , what is the most efficient way to get my 20 ASCII files into a data set that can be processed by SAS? Is the TSO LISTC command the best way to go?


Yes, i used FILEVAR a lot of times, and the datasets to process (also around 20) i just typed in. Its not that much work if you use dataset names almost identical.
Back to top
View user's profile Send private message
Charles Wolters

New User


Joined: 30 Mar 2011
Posts: 48
Location: United States

PostPosted: Fri May 13, 2011 6:29 pm
Reply with quote

PeterHolland wrote:
Charles Wolters wrote:
I have 20 ASCII files all with an identical fixed column layout. In SAS I want to be able to read these and create one SAS data set using one SAS data step. In UNIX and Windows I have used the FILEVAR statement to accomplish this task. Has anybody used the FILEVAR statement in a Z/OS environment? If so , what is the most efficient way to get my 20 ASCII files into a data set that can be processed by SAS? Is the TSO LISTC command the best way to go?


Yes, i used FILEVAR a lot of times, and the datasets to process (also around 20) i just typed in. Its not that much work if you use dataset names almost identical.


Thank you for your reply. I am going to develop some SAS code assuming that I manually create a data set of data sets and would appreciate a review.

Charles
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Sat May 14, 2011 12:38 pm
Reply with quote

Here is some sample coding :

Code:

//ROOKSCAN DD  *                                                        00160000
XIBF.EPA.MACHINE.ALL.A1                                                 00170007
XIBF.EPA.MACHINE.ALL.A2                                                 00180007
XIBF.EPA.MACHINE.ALL.A4                                                 00190007
XIBF.EPA.MACHINE.ALL.FA                                                 00200007
XIBF.EPA.MACHINE.ALL.FC                                                 00210007
XIBF.EPA.MACHINE.ALL.FD                                                 00220007
XIBF.EPA.MACHINE.ALL.FE                                                 00230007
XIBF.EPA.MACHINE.ALL.T3                                                 00240007
//SYSIN    DD  *                                                        00250000
**********************************************************************; 00260000
%LET SASFILE=ROOKEPAX;                                                  00270001
**********************************************************************; 00280000
LIBNAME SASDATA 'XIBF.SAS.JCLDATA';                                     00290000
OPTIONS NOCENTER LS=85  PS=64 MEMSIZE=300M NOMPRINT NOSOURCE2;          00300000
**********************************************************************; 00310000
DATA LOADSCAN (KEEP=LOADLIB MBRNAME REFERENC COMPDATE SYSID)            00320000
   ;                                                                    00330000
   FORMAT COMPDATE YYMMDD10.;                                           00340000
   LENGTH DSN $44;                                                      00350000
   INFILE ROOKSCAN;                                                     00360000
   INPUT DSN $;                                                         00370000
   IF SUBSTR(DSN,1,1) = '*' THEN RETURN;                                00380000
   INFILE DUMMY FILEVAR=DSN END=END;                                    00390000
   DO UNTIL(END);                                                       00400000
      INPUT  @1 LOADLIB  $CHAR44.                                       00410000
            @45 MBRNAME  $CHAR8.                                        00420000
            @55 REFERENC $CHAR8.                                        00430000
           @187 COMPDATE JULIAN5.                                       00440000
           @205 SYSID    $CHAR2.;                                       00450000
      OUTPUT;                                                           00460000
   END;                                                                 00470000
RUN;                                                                    00480000
Back to top
View user's profile Send private message
Charles Wolters

New User


Joined: 30 Mar 2011
Posts: 48
Location: United States

PostPosted: Mon May 16, 2011 10:33 pm
Reply with quote

Peter,

Thank you for your code. It is perfectly understandable. I had thought about creating a text file of the data sets that I wanted to concatenate but your approach of using an instream data set is easier.

Charles Wolters
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> All Other Mainframe Topics

 


Similar Topics
Topic Forum Replies
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Multiple table unload using INZUTILB DB2 2
Search our Forums:

Back to Top