Does file exist on mainframe

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
a2love
Participant
Posts: 30
Joined: Fri Feb 09, 2007 10:03 am

Does file exist on mainframe

Post by a2love »

Hi all,

I am trying to finish up a job sequence that sends a success/failure notification if a file is/is not created on the mainframe. Does anyone know how to accomplish this? I assume it would be something like a script checking if file exists after logging into a server via FTP...

I am unsure of what direction to go with this, any suggestions?
Adam Love
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Probably a script, executed via an Execute Command activity, that establishes an FTP connection then tests for the existence of the file. Does FTP into the mainframe support the ls subcommand for ftp?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
tiozzo
Charter Member
Charter Member
Posts: 38
Joined: Fri Sep 01, 2006 3:07 pm

Post by tiozzo »

Ya ls is supported. So I'm thinking... ls and put that list into a file, exit ftp, and run dos to real file line by line looking for my file name. If present do something else. This sound like a good plan?
tiozzo
Charter Member
Charter Member
Posts: 38
Joined: Fri Sep 01, 2006 3:07 pm

Post by tiozzo »

Actually, to get more to the point....

1) does anyone know how to write to result of 'dir' or 'ls' to a file from Dos FTP.

or alternatively,

2) how to check if a file exists on mainframe from datastage

Any help or info on where to find some help would be greatly appreciated.

Cheers,
Adam
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Etiquette Note
Thread hijacking is frowned upon. Please start a new thread for your first question, Adam.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

tiozzo wrote:Ya ls is supported. So I'm thinking... ls and put that list into a file, exit ftp, and run dos to real file line by line looking for my file name. If present do something else. This sound like a good plan?
Yes, but there's a better plan. You can use UNIX utilities as well. For example you can use grep to determine whether your particular file name exists in the ls output. This can be via an Execute Command activity in the job sequence.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply