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



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

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

Postby bullivs » Mon Sep 06, 2010 5:48 pm

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?
bullivs
 
Posts: 2
Joined: Mon Sep 06, 2010 5:32 pm
Has thanked: 0 time
Been thanked: 0 time

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

 

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

Postby MrSpock » Mon Sep 06, 2010 6:23 pm

AFAIK, you'd have to resolve the relative GDG address to it's real name first, then include that name in your put statement.
User avatar
MrSpock
Global moderator
 
Posts: 810
Joined: Wed Jun 06, 2007 9:37 pm
Location: Raleigh NC USA
Has thanked: 0 time
Been thanked: 2 times

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

Postby bullivs » Mon Sep 06, 2010 6:33 pm

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
bullivs
 
Posts: 2
Joined: Mon Sep 06, 2010 5:32 pm
Has thanked: 0 time
Been thanked: 0 time

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

Postby Robert Sample » Mon Sep 06, 2010 7:24 pm

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.
Robert Sample
Global moderator
 
Posts: 3367
Joined: Sat Dec 19, 2009 8:32 pm
Location: East Dubuque, Illinois
Has thanked: 1 time
Been thanked: 222 times

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

Postby steve-myers » Mon Sep 06, 2010 8:04 pm

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.
steve-myers
Global moderator
 
Posts: 1885
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 197 times

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

Postby MrSpock » Mon Sep 06, 2010 10:29 pm

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.
User avatar
MrSpock
Global moderator
 
Posts: 810
Joined: Wed Jun 06, 2007 9:37 pm
Location: Raleigh NC USA
Has thanked: 0 time
Been thanked: 2 times

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

Postby steve-myers » Mon Sep 06, 2010 10:39 pm

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.
steve-myers
Global moderator
 
Posts: 1885
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 197 times

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

Postby NicC » Mon Sep 06, 2010 11:23 pm

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.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2690
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 105 times

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

Postby Gnanasekar80 » Mon Sep 13, 2010 11:13 pm

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
Gnanasekar80
 
Posts: 1
Joined: Mon Sep 13, 2010 8:57 pm
Has thanked: 0 time
Been thanked: 0 time


Return to JCL

 


  • Related topics
    Replies
    Views
    Last post