Job fails due to unable to open a file error

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

Moderators: chulett, rschirm, roy

Post Reply
shah.tejasvi.p
Participant
Posts: 5
Joined: Wed Nov 19, 2008 11:25 pm

Job fails due to unable to open a file error

Post by shah.tejasvi.p »

We have a job with a before job subroutine ExecDOS and Input value

START REPLACE \\PATH A\*.* \\PATH B /a &EXIT &

This job runs everyday as part of a scheduled batch but sometimes it fails with below error

DSD.SEQOpen Failed to open A.txt in directory PATH B
STATUS = 2.
Unknown error ocurred.
Execution of job canceled

But when we check in PATH B the file is present.

(Please note that PATH A , PATH B and A.txt are not actual paths/names of the file but just examples)

How is it possible that the job is unable to open a file,that it itself is placing in the particular place or path in the before job subroutine.

Could it be that the file is being accessed or opened before it is actually physically placed in the folder?

Thanks in advance for all your help.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Been too long - what do the ampersands and "EXIT" do here? Get rid of them if there's any chance they let the command release control before it has actually completed.
-craig

"You can never have too many knives" -- Logan Nine Fingers
shah.tejasvi.p
Participant
Posts: 5
Joined: Wed Nov 19, 2008 11:25 pm

Post by shah.tejasvi.p »

Thanks for your reply.

The EXIT command is just used to withdraw from the current DOS session.

I tried using The EXIT command with the replace command(I was replacing a huge file which would obviously take some time) on command prompt and it seems to me that the EXIT command is executed only after the replace command completed.

Any other suggestions?

Thanks again for all your help.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Same suggestion, get rid of the EXIT and just use:

START REPLACE \\PATH A\*.* \\PATH B /a
-craig

"You can never have too many knives" -- Logan Nine Fingers
sbass1
Premium Member
Premium Member
Posts: 211
Joined: Wed Jan 28, 2009 9:00 pm
Location: Sydney, Australia

Post by sbass1 »

I typed "help start" in a cmd window:

Code: Select all

Starts a separate window to run a specified program or command.

START ["title"] [/Dpath] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED]
      [/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL | /BELOWNORMAL]
      [/WAIT] [/B] [command/program]
      [parameters]

    "title"     Title to display in  window title bar.
    path        Starting directory
    B           Start application without creating a new window. The
                application has ^C handling ignored. Unless the application
                enables ^C processing, ^Break is the only way to interrupt
                the application
    I           The new environment will be the original environment passed
                to the cmd.exe and not the current environment.
    MIN         Start window minimized
    MAX         Start window maximized
    SEPARATE    Start 16-bit Windows program in separate memory space
    SHARED      Start 16-bit Windows program in shared memory space
    LOW         Start application in the IDLE priority class
    NORMAL      Start application in the NORMAL priority class
    HIGH        Start application in the HIGH priority class
    REALTIME    Start application in the REALTIME priority class
    ABOVENORMAL Start application in the ABOVENORMAL priority class
    BELOWNORMAL Start application in the BELOWNORMAL priority class
    WAIT        Start application and wait for it to terminate
    command/program
                If it is an internal cmd command or a batch file then
                the command processor is run with the /K switch to cmd.exe.
                This means that the window will remain after the command
                has been run.

                If it is not an internal cmd command or batch file then
                it is a program and will run as either a windowed application
                or a console application.
Thoughts:

1) Can you try it without the START command? If you're already calling ExecDOS from DS, why do you need to launch a separate process for your REPLACE command?

2) If you do need START for some reason, try adding the /WAIT option.

HTH,
Scott
Some people are the Michael Jordan's of Datastage. I'm more like Muggsy Bogues :-)
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Ah, even better advice. My DOS days are way too far behind me, it seems. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
asorrell
Posts: 1707
Joined: Fri Apr 04, 2003 2:00 pm
Location: Colleyville, Texas

Post by asorrell »

I concur with what Scott said - I remember having problems with this a long time ago (in a galaxy far away). Just execute the command without the START, WAIT, etc. and you should be ok. DataStage will execute the command and wait for it to complete before proceeding.
Andy Sorrell
Certified DataStage Consultant
IBM Analytics Champion 2009 - 2020
Post Reply