Page 1 of 1

(FTP JCL) how to include generation number in output filenam

PostPosted: Mon Sep 06, 2010 5:48 pm
by bullivs
I'm trying to FTP download a mainframe file that includes the generation number in the output filename.

Using this JCL the filename obviously comes out 'D.atasetname(0)'

//INPUT DD *                   
LOCSITE FWF                   
LOCSITE tlsrfclevel=CCCNONOTIFY
ccc                           
TYPE A                         
cd /inbox                     
put 'D.atasetname(0)'         
QUIT                           
//*


ideally, these files need to be downloaded as it appears on the mainframe, ie. D.atasetname.g0001v00

Could you please advise how this is to be done, please?

Re: (FTP JCL) how to include generation number in output filenam

PostPosted: Mon Sep 06, 2010 6:23 pm
by MrSpock
AFAIK, you'd have to resolve the relative GDG address to it's real name first, then include that name in your put statement.

Re: (FTP JCL) how to include generation number in output filenam

PostPosted: Mon Sep 06, 2010 6:33 pm
by bullivs
Hi MrSpock

thanks for the quick reply, appreciated.

This is an automated job that runs nightly, it won't be possible to manually change the dataset name everyday for this.

the user is expecting the generation to be included in the filename. Can you think of any way of achieving this?

Kind Regards

Re: (FTP JCL) how to include generation number in output filenam

PostPosted: Mon Sep 06, 2010 7:24 pm
by Robert Sample
The FTP GET command assumes anything in parentheses is a PDS member name. You cannot get around that limitation.

You can, however, specify //DD:xxxxxxxx as the local file name, and have the GDG relative reference in the JCL for DD name xxxxxxxx.

Re: (FTP JCL) how to include generation number in output filenam

PostPosted: Mon Sep 06, 2010 8:04 pm
by steve-myers
There is a disconnect here, too.

Within a single job - and that's what an FTP server is in z/OS - the the translation of a relative generation in a generation data group to their corresponding fixed generation are fixed from the first appearance of the generation data group in JCL or dynamic allocation. In other words, the first time you allocate a new GDG(+1) in JCL, or in a z/OS FTP server, z/OS will assign the appropriate GnnnnV00, and that will stay fixed for the life of the job (or z/OS FTP server. A subsequent attempt the allocate a GDG(+1) will use the same GnnnnV00, and the allocation will fail because there is already a GnnnnV00 allocated. In TSO you would get message IKJ56871I DATA SET xxxxxx.TESTGDG NOT ALLOCATED, RELATIVE GENERATION NUMBER INCOMPATIBLE FOR SPECIFIED STATUS (assuming xxxxxx.TESTGDG is a proper GDG index). The disconnect here is that an FTP server in z/OS is a job; the PUT requests from clients are processed as a single job in z/OS, not as individual "jobs," even if the PUT requests are separated by many hours, or even days since normally the FTP server is run as a single job in z/OS, usually until the system as a whole is shut down in preparation for an IPL.

Hope this helps.

Re: (FTP JCL) how to include generation number in output filenam

PostPosted: Mon Sep 06, 2010 10:29 pm
by MrSpock
bullivs wrote:the user is expecting the generation to be included in the filename. Can you think of any way of achieving this?


A few. You could code a program or a REXX exec. You could use the IDCAMS PRINT command to display the actual dataset name, and then go from there.

Re: (FTP JCL) how to include generation number in output filenam

PostPosted: Mon Sep 06, 2010 10:39 pm
by steve-myers
MrSpock wrote:... A few. You could code a program or a REXX exec. You could use the IDCAMS PRINT command to display the actual dataset name, and then go from there.

This is assuming the use of the mainframe FTP client to FTP the data to an FTP server on a Unix or possible Windows machine. I suspect the original poster intended to use an FTP client to connect to a mainframe FTP server.

Re: (FTP JCL) how to include generation number in output filenam

PostPosted: Mon Sep 06, 2010 11:23 pm
by NicC
steve-myers wrote:This is assuming the use of the mainframe FTP client to FTP the data to an FTP server on a Unix or possible Windows machine. I suspect the original poster intended to use an FTP client to connect to a mainframe FTP server.


Mr Spock's solution is still vailid in this case - you just have to FTP the IDCAMS output to the PC and process it there to generate the FTP cards for the FTP of the GDG. Rexx and Perl are both widely available for the PC for doing this sort of thing.

Re: (FTP JCL) how to include generation number in output filenam

PostPosted: Mon Sep 13, 2010 11:13 pm
by Gnanasekar80
I have seen jobs in my system which handles this kind of scenario.

As Spoc and Nic suggested, you can create the FTP card dynamically.

ftpcard1
---------
LOCSITE FWF
LOCSITE tlsrfclevel=CCCNONOTIFY
ccc
TYPE A
cd /inbox

ftpcard2
----------
put 'D.atasetname.g000nv00'

ftpcard.increment
---------
put 'D.atasetname.g0001v00'

ftpcard3
----------
QUIT
//*

//step1 exec pgm=sort
//sortin dd dsn=ftpcard2,disp=shr
// dd dsn=ftpcard.increment,disp=shr
//sortout dd dsn=ftpcard2,disp=shr
//sysin dd *
sum fields = generation number position.
/*
//step2 exec pgm=ftp
//sysprint dd sysout=*
//input dd dsn=ftpcard1,disp=shr
// dd dsn=ftpcard2,disp=shr
// dd dsn=ftpcard3,disp=shr
//*

Hope this helps

Gnana