7

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'
halfer
  • 19,824
  • 17
  • 99
  • 186
btava001
  • 131
  • 7
  • What is the client you are using? You should be able to access 'KIBI.AL242422.REPORT(0)' and the host would resolve that for you. – Hogstrom Sep 06 '18 at 13:43
  • 1
    Will this work? In the FTP Client `cd /KIBI` and then `get AL242422.REPORT(0)`. Are you pulling from the mainframe or pushing? What client are you using? – Hogstrom Sep 06 '18 at 14:05
  • 1
    @Hogstrom if he is using windows cmd and zOS using the relative GDG as you suggested will work. I do this everyday. It will resolve the relative name to the fully qualified name – SaggingRufus Sep 06 '18 at 14:17
  • 1
    Hi Hogstrom this worked. Thank you very much! Just had to add the "(0)' – btava001 Sep 06 '18 at 14:36

1 Answers1

9

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.

Hogstrom
  • 3,581
  • 2
  • 9
  • 25
  • 1
    As an aside the reader should be extremely aware that without the subscript you will get them ALL as a concatenation. – mckenzm May 13 '22 at 03:13