Initial Load Job

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
thebird
Participant
Posts: 254
Joined: Thu Jan 06, 2005 12:11 am
Location: India
Contact:

Initial Load Job

Post by thebird »

Hi,

I have a job that compares yesterday's and today's files and captures the changes. My input files are in Header-Detail-Trailer format and I am using the grep function in the filter option of the sequential file stage to read the Detail records.

I want to use this job for the inital load, i.e, with only today's file. How can I get this to be done?

I tried setting the Missing File Mode option to OK, but the job aborted returning a fatal error -
PrevIntfcFileSfSrc,0: Filter status 256;
filter process failed: 1;
import error at record 0.


Is there a way that I can get this to be done?

Regards,

The Bird.
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post by roy »

Hi,
With proper logic I assume having an empty file as your initial load should be ok (for the yesterday's data).
IHTH,
Roy R.
Time is money but when you don't have money time is all you can afford.

Search before posting:)

Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Image
thebird
Participant
Posts: 254
Joined: Thu Jan 06, 2005 12:11 am
Location: India
Contact:

Post by thebird »

roy wrote:Hi,
With proper logic I assume having an empty file as your initial load should be ok (for the yesterday's data).
IHTH,
Roy,

As I mentioned I have my source in Header-Detail-Trailer format. In the source sequential file for yesterday's file, I use grep -e '^["5"|]' in the filter option, as "5" is the identifier for the detail records.

The job runs fine if the both the files are present. But if I do not pass the parameter value for yesterday's file name, the job aborts as I had mentioned in my first post.


Regards,

The Bird.
bcarlson
Premium Member
Premium Member
Posts: 772
Joined: Fri Oct 01, 2004 3:06 pm
Location: Minnesota

Post by bcarlson »

I think Roy is suggesting creating an empty file with yesterday's filename. That way, your process will see both files, it just won't find any data in the 'old' file.

Brad.
thebird
Participant
Posts: 254
Joined: Thu Jan 06, 2005 12:11 am
Location: India
Contact:

Post by thebird »

bcarlson wrote:I think Roy is suggesting creating an empty file with yesterday's filename. That way, your process will see both files, it just won't find any data in the 'old' file.

Brad.
Hi,

I was trying to run with just a single file for the initial load. If I have an empty file for yesterday, then the job runs fine.

What I would like to do is, run the job successfully with only today's file. I thought that with the Missing File Mode option to set OK, this would be possible. But I guess that the grep function in the filter is creating a problem.

Any suggestions to how this can be accomplished would be really helpful.
Also please let me know why the missing file mode doesnt work as it should with the filter option set to use a grep function.

Regards,

The Bird.
bcarlson
Premium Member
Premium Member
Posts: 772
Joined: Fri Oct 01, 2004 3:06 pm
Location: Minnesota

Post by bcarlson »

Rather than call grep directly, you could create a script 'mygrep' (or whatever) that does it internally, but also handles the no-file situation. Then call mygrep in the filter instead of grep. Here's a sample script (remember, return code 0 is sucess, non-Zero is fail):

Code: Select all

#!/usr/bin/ksh

infile=$1

if [[ -f ${infile} ]]
then
    # File exists, grep it
    grep  -e '^["5"|]' ${infile}
    rc=$?
elif [[ -z ${infile} ]]
then
    # No file was given, just exit (no error)
    rc=0
else 
    # File was given, but invalid filename (return error)
    rc=1
fi

exit ${rc}

Brad.
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post by roy »

Hi,
I did mean build an empty file for the initial load.
IMHO, missing one of the files in your every day loads is something you want to stop your job.
Building this initial file is simple and is a "one time task"

Again IMHO Having scripts should be kept to minimum required so everything stays in DS if possible.
A ksh script for a windows install, I don't know if they have that capability installed, I would prefer a DS job instead if you must.

IHTH,
Roy R.
Time is money but when you don't have money time is all you can afford.

Search before posting:)

Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Image
Post Reply