ftpdatasetmainframetso

How to send my most recent dataset by FTP?


I am using IBM Mainframe TSO to view files from a dataset. I recently have been told to start FTPing the latest generation dataset everyday to a folder on my desktop. The problem is that the FTP script I have only lets me FTP a file with the exact name I put. Everyday the dataset changes.

How can I write a script that will FTP the latest generation? Please see example below of how the dataset changes:

Dataset

8/30/18 - KIBI.AL242422.REPORT.G6441V00
8/31/18-  KIBI.AL242422.REPORT.G6442V00
9/1/18 -  KIBI.AL242422.REPORT.G6443V00
9/4/18 -  KIBI.AL242422.REPORT.G6444V00
9/5/18 -  KIBI.AL242422.REPORT.G6445V00

command.bat

ftp -i -s:Command.txt
quit

command.txt

open sc01.sample.com
USER NAME
PASSWORD
get 'KIBI.AL242422.REPORT.G6441V00'

Solution

  • What your referring to are Generation Data Groups. You can refer to the files in relative form where (0) is the most current. (-1) is the previous generation, etc. In your case you want to access the dataset by relative reference. In your FTP client do the following:

    cd KIBI

    get AL242422.REPORT(0)

    The system will determine which of the datasets is the one you want. Its a nice feature.