accessing zip files

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

kum_d
Participant
Posts: 20
Joined: Tue Jul 17, 2007 4:53 am

accessing zip files

Post by kum_d »

Hi

I need to FTP the previous month zip file on every month 2nd into datastage server from unix server.
But in unix server we have earlier monthly files say June2007.gz,May2007.gz,April2007.gz etc.... which are from more than 1 year.

Can any one help me out for how to catch the previous months file into datastage server.

This has to be autamated on everymonth 2nd.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Sort them by date/time modified then select the most recent.

Code: Select all

ls -rt1 | head -1
Execute Command activity to execute something like the above command; the return value will give you the file name which you can pass to the job as a job parameter value.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kum_d
Participant
Posts: 20
Joined: Tue Jul 17, 2007 4:53 am

Post by kum_d »

Hi Ray,

Is it possible to use more then one command in telnet before command as i need to get the most recent file from unix server and rename it to kkk.txt in FTP stage.

Can you pls suggest me how can i do this in datastage
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You can capture the result of the ls command using backquotes, and use that as the first argument of the mv command that renames (or copies) the file prior to its being transferred.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kum_d
Participant
Posts: 20
Joined: Tue Jul 17, 2007 4:53 am

Post by kum_d »

Hi Ray,

Can we get multiple files(more than one file) from unix server to datastage server using GET command.
Cr.Cezon
Participant
Posts: 101
Joined: Mon Mar 05, 2007 4:59 am
Location: Madrid

Post by Cr.Cezon »

you must use then mget command
[
quote="kum_d"]Hi Ray,

Can we get multiple files(more than one file) from unix server to datastage server using GET command.[/quote]
kum_d
Participant
Posts: 20
Joined: Tue Jul 17, 2007 4:53 am

Post by kum_d »

can i have the syntax of the same
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

It's the same as 'get' just with an 'm' on the front and a wildcard in the filename. That's it. Try 'man ftp' for more information.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

OP is on Windows, but maybe has MKS Toolkit or similar.

On Windows open a cmd shell and invoke ftp. When the ftp> prompt appears type in a single ? or the word help to get a list of help topics.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Doh! Could have sworn I rolled back and checked the OS on the first post, obviously not. Perhaps it was your 'ls -rt1' and the mention of the remote UNIX server that threw me...

Still, that's still all there is to it - other than the need to invoke ftp with the -i option to turn off 'Interactive' mode. As far as I know, you still need to do that for a scripted mget so it doesn't stop and attempt to confirm each one.
-craig

"You can never have too many knives" -- Logan Nine Fingers
kum_d
Participant
Posts: 20
Joined: Tue Jul 17, 2007 4:53 am

Post by kum_d »

Hi

I have the folder path like this in unxi server: /home/users/ftptci
This path is having the files like May2007.gz,June2007.gz,Jul2007.gz as well other files say 58.gz ,xxxx.gz .
Out of these files which are different names along with monthly file names
as mentioned above.
I need to capture the latest monthly file into my datastage job using FTP stage.

Can you plesae help me out for this.
kum_d
Participant
Posts: 20
Joined: Tue Jul 17, 2007 4:53 am

Post by kum_d »

any one help on this please
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

I counsel... patience.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

If you don't like the previously offered solution, please say so. It can also be done with a routine, using the STATUS statement to determine the date/time modified (for example).

If you're looking for someone to do the work for you, please contact them privately for a quotation.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kum_d
Participant
Posts: 20
Joined: Tue Jul 17, 2007 4:53 am

Post by kum_d »

can you please give me any sample routine which works for this
Post Reply