Tricky Requirement

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
vinay_renu2001
Participant
Posts: 46
Joined: Wed Sep 28, 2005 9:24 am

Tricky Requirement

Post by vinay_renu2001 »

Hi

I have a requirement as follows:

We have a Directory called "REP" in which there are 200 Sub-Directories each for one customer. In each Sub-Directory they have 4-5 reports generated bi-weeekly for every customer by Oracle. In those reports few of them are generated in PDF format and few of them are generated in .TXT format. All these Reports need to be Archived at some different location, Need to convert all the .TXT Reports into PDF foramat and need to attach these Reports to an E-mail and forward them to corresponding Customers. All the Sub-Directories have the standard naming convention(e.g: mnc1100, mnc1210,mnc2555....). Reports does not have any standard Naming Convention.

Note: Currently All the above process is performing manually.

Now my requirement is to automate all the above process using Shell Script and DataStage. Here in this scenario, i dont think DataStage helps us a lot, Am i correct?

Iam ambigous to handle this task in a folder level or a file level.

Can anyone give me any suggestions!!!

Thanks in Advance...
Viny
"You must be the change you wish to see in the world."
--Mahatma Gandhi
Thanks and Regards
Vin
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You are correct. This is not something that DataStage does. But DataStage can control the shell script(s) that you create to perform the movement of files. You can use an Execute Command activity from a job sequence, or you can use a before/after subroutine from a job, for example ExecSH (the task of which is to execute a command in /bin/sh).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Yes, there is nothing much you can make use of Datastage other that Execute Command Activity from which you can call the unix levelconverter for these sort of house keeping of moving from one directory to another. I would not use import/Export operator for this. Unix level 'move' would be more prompt from the shell.

-Kumar
djm
Participant
Posts: 68
Joined: Wed Mar 02, 2005 3:42 am
Location: N.Z.

Post by djm »

If you end up having to write a UNIX shell script as part of your solution, one command that you are likely to find useful is "find" ("man find" for more details). Although this can be a tricky command to master, it is very powerful. For example

Code: Select all

find /REP \( -name "*.TXT" -exec ls \{\} \; \) -o \( -name "*.PDF" -exec ls -l \{\} \; \)
will look in all sub-directories underneath /REP and execute the command "ls" for a file with a suffix of .TXT and execute the command "ls -l" for a file with a suffix of .PDF.

Obviously the command in the example does not do anything near what you are looking for. However, I would suggest trying something simple commands until you work out the meaning of the various flags ( e.g. -exec, -name) and shell escape sequences ( e.g. \( \; ). You should then be able to tackle building a more complete solution (e.g. for files named with a ".TXT" suffix, invoke your own script to convert it to a PDF).

David
(Previously known as D)

Be alturistic and donate your spare CPU cycles to research. http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

It could be done quite straightforwardly using DataStage BASIC. I refrained from answering in this vein earlier because the question is posted in the parallel forum.

The DataStage BASIC (possibly a custom job control routine) would execute a UNIX command (such as find or tree) to return a treewalk of the subdirectory structures, then generate the appropriate commands to archive the different file types and execute those commands.

But of course this could also be done with a shell script, probably just as easily. It really depends on one's skill set.
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