Server Routine

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

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

Post by chulett »

:!: Wait... you are writing to a single sequential file by multiple processes at the same time? Multiple readers are fine but multiple writers is generally what is known as a Very Bad Idea due to the nature of sequential media. The only thing that may save you is the LOCK part mentioned above so you certainly don't want to try and circumvent it.

I've seen far too many people do little limited tests of something like this in the past and declare everything "working fine"... and then the Real World comes along and things go off the rails. I don't believe you will see aborts but disengaging the LOCK will almost certainly corrupt your output file.
-craig

"You can never have too many knives" -- Logan Nine Fingers
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

... and make sure you CLOSE the file in the routine, as Ray noted.
-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 »

Apy wrote:Just to clear my understanding, If LOCKED clause is not mentioned , any other invocation will wait until the file lock is released. Please confirm.
Confirmed.
Apy wrote:What if the LOCKED clause is mentioned? How other invocation will behave?
Is there any chance of abort for other job invocation due to same files accessed by multiple invocations at a time?
The routine will do whatever the code in the LOCKED clause specifies. For example, that code may sleep for a short period before trying again. In that case, no problem. Whether or not you can cause a job abort depends on a combination of your code and your operating system's rules.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Apy
Participant
Posts: 18
Joined: Fri Oct 14, 2016 6:26 am

Post by Apy »

Thanks for such a clear explanation. To avoid any future issue, I will go for using different files and then merge into one. This will prevent from any abort/Lock or unforeseen issue.

Thanks for the help!!!
Post Reply