BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Silbad
Calcite | Level 5

Hello everyone,

I'm trying to read all the members of a z/OS PDS to store them in SAS Datasets (or to write them in another files). I'm working on a SEG Unix session (SAS Enterprise Guide 4.1 (4.1.0.1020)) and I access to the PDS through a FILENAME FTP statement with the DIR option.

The DOPEN and DNUM functions don't work, I guess it's because a Unix session can't read z/OS file attributes...

Here is how I managed to do what I want, but not in a perfect way :

/* Filename of the z/OS PDS */
filename pds ftp "'MP01.CTXPDBPX.MTXTPRM2'" mach = "vpbe0000" lrecl = 80 recfm = F dir;

/* Reading of every file corresponding to the combination of P1XXXijk (P1XXX00A, P1XXX00B...) */
data _null_;
  do i = 0 to 9;
    do j = 0 to 9;
      do k = 'A','B','C','D','E','F','G','H','I','J','K','L','M',
             'N','O','P','Q','R','S','T','U','V','W','X','Y','Z';
        fic = 'P1XXX' !! strip(i) !! strip(j) !! strip(k);
        call execute('data tbl_' !! strip(fic) !! ';');
        call execute('infile pds(' !! strip(fic) !! ');');
        call execute('input ligne $EBCDIC80.;');
        call execute('run;');
      end;
    end;
  end;
run;

Obviously, if the file does not exist (which has 90% probability to happen), an error is displayed and it takes quite a long time for the program to test every combination of file names :

NOTE: CALL EXECUTE generated line.
1         + data tbl_P1XXX00A;
2         + infile pds(P1XXX00A);
3         + input ligne $EBCDIC80.;
4         + put ligne;
5         + run;

NOTE: DATA statement used (Total process time):
      real time           1.00 seconds
      cpu time            0.01 seconds
     
NOTE: 220-FTPD1 IBM FTP CS V1R11 at VPBE0000, 08:39:19 on 2012-07-10.
ERROR: Physical file does not exist, P1XXX00A.
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.TBL_P1XXX00A may be incomplete.  When this step was stopped there were 0 observations and 1 variables.
WARNING: Data set WORK.TBL_P1XXX00A was not replaced because this step was stopped.


If someone could help me, either telling me how to list all the members of a PDS, either telling me how to test if the PDS member exists, I would be very thankful to this person ! 😉

Sincerely yours,

Anthony

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

Does the Z/OS ftp server support the DIR command?

Here is the syntax I have used with FTP to a unix server to get the list of files.  Similar syntax should work for z/OS.  You just treat the PDS as if it as the directory name.

filename ftpdir ftp

  cd="dname"

  host="hostname"

  user="username"

  pass="xxxxxxx"

  list

;

View solution in original post

2 REPLIES 2
Tom
Super User Tom
Super User

Does the Z/OS ftp server support the DIR command?

Here is the syntax I have used with FTP to a unix server to get the list of files.  Similar syntax should work for z/OS.  You just treat the PDS as if it as the directory name.

filename ftpdir ftp

  cd="dname"

  host="hostname"

  user="username"

  pass="xxxxxxx"

  list

;

Silbad
Calcite | Level 5

It works ! I used this filename statement associated with the data step below :

filename ftpdir ftp "'MP01.CTXPDBPX.MTXTPRM2'" mach = 'vpbe0000' dir list;

data fic;

  infile ftpdir;

  input;

  fic = _infile_;

run;

The DIR option work on the z/OS ftp server and is useful to get informations about the PDS members. Otherwise, only information about the PDS itself is returned.

Thank you so much ! Smiley Happy

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 2165 views
  • 1 like
  • 2 in conversation