Setting File size

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

Post Reply
gomez
Premium Member
Premium Member
Posts: 83
Joined: Tue Jun 22, 2004 6:11 am

Setting File size

Post by gomez »

Hi:
I am facing a strange issue.
I have a routine looking for a file (source.txt)to arrive. This routine is equivalent of a "WAIT FOR FILE" activity but created to log informational message when it times out.
Once a file is found, the control is passed on to another simple routine which copies (DOS Copy command) the file onto a destination folder.

We received a 207 KB file at the source today which went to the target with a size of 204 KB. Apparently there were 153 records in the source file but only 150 made it to the target. Another attempt in processing the same file sent 149 records to the target

I tried to reproduce the issue so we could address the problem. When I repeat the process in our test environment with the same file, the entire file is picked up and written to the target. Hence I am not able to arrive at why this happens. I checked the settings in DataStage Adminstrator for both test and Production environments. They seem to match

Any ideas/suggestions on this?

Is this a DataStage Issue at all or Network or file system? !!!

Thanks,
Gomathy
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

hi Gomathy,

"We received a 207 KB file at the source today which went to the target with a size of 204 KB." Is it after any transformation rules, or just the COPY you are referring about?
Make sure you are waiting for the file to read till the last record is appeard. There is a chance where you might have copied the partial data and compared with fully available file.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Get them to send two files - the data file then another, possibly empty file.
Wait for the second file, then process the first. Given that they don't send the second file till after they've sent the first, you can be confident that all of the first file has been received when the second file arrives (network contention excepted).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
gomez
Premium Member
Premium Member
Posts: 83
Joined: Tue Jun 22, 2004 6:11 am

Post by gomez »

Thanks Kumar and Ray for the suggestions
I guess the possible reason could be what kumar_s suggested. The file was copied on to the destination before being completely written.
I am doing a copy file command from source to target. There are no transformations involved at this step

Ray, I happen to know that the source system generates a statistics file on every file write to indicate the number of records written to the file. I am looking at working on the job to poll for the statistics file than the source file.

But during this investigation, I also thought I would do a DOS move than a copy command. I tested this step - Just to make sure move cannot happen when a file is being written. I tested by opening the source text file in our development environment and tried running the job that moves the file. The file was infact moved. There was no lock on the file though it was opened for editing

Any idea if the write operation's lock applies to .txt files or not?

Thanks again.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Pay attention to what Ray said. You always have to send the trigger file which is usally an empty file after your main file transfer is complete. Hence get them to send two files and wait for the trigger file (second file).
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
gomez
Premium Member
Premium Member
Posts: 83
Joined: Tue Jun 22, 2004 6:11 am

Post by gomez »

Thanks DSGuru2B
This process involves many applications with different user groups. Hence changing their process would involve considerable effort.

I was looking at leveraging what is currently available from them before going ahead asking them to change their process

Thanks
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Didn't you say they also send a 'stats' file? Couldn't you use that as you've mentioned earlier, poll for that file to trigger the processing of the main data file? Assuming they send it last, of course.

The other 'work arounds' I've seen people use:

1) When the file shows up, snag the file size. Continue polling until the file size hasn't changed for an agreed upon period of time.

2) Utilize a utility like 'fuser', something that would let you know the file is 'in use' which should mean 'still be transferred'. Continue checking until the command lets you know the file is no longer 'in use'.

Food for thought. Neither is fool-proof of course, but they're better than nothing. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
gomez
Premium Member
Premium Member
Posts: 83
Joined: Tue Jun 22, 2004 6:11 am

Post by gomez »

Thanks. I pointed the polling to Stats file and it is running fine now

Thanks again
Post Reply