nicklewe
14th October 2002, 10:47
Hello,

I have a session which opens a file and reads in the contents line by line and then goes on to work with each line in turn. No problems. However, as soon as we let this session run as a job I keep getting an error opening the file. The file name is read in from a seperate owner parameter table via a function call.

Anybody have any ideas ?

Nick LeWe

NPRao
14th October 2002, 11:03
Nick,

Check the file access permissions of the job user on those files/directories.

nicklewe
14th October 2002, 15:23
Hi,

well, the job is being run with user Admin. No permission problems there.

Nick

mark_h
14th October 2002, 15:47
Did you check the path on both the job and user to make sure they match? Is there an error number for opening the file - maybe that will tell someone where the problem is.

Mark

nicklewe
15th October 2002, 08:55
The open return code is -13 (?)

Nick

jaapzwaan
15th October 2002, 09:36
Look here for a description : http://www.baanboard.com/programmers_manual_baanerp_help_errors_13_EACCES
Also check this thread (http://www.baanboard.com/baanboard/showthread.php?s=&threadid=7165)

Regards,
Jaap

grzegorz
15th October 2002, 09:37
When a session runs as a job, not all program script sections are invoked. I had a similar problem once. Path and filename were determined in init.form section. In background mode that part of code was not invoked, so my function (present in choice.cont.proces ) tried to open a file with blank name and path, with no success of course. Maybe it is something like that in your case.

lsatenstein
15th October 2002, 15:09
Gentlemen. The path I chose was on the same server as the Baan application.

I would like to dynamically build the file name, and have the following snippet.

domain tcmcs.str132 filename

...........

cwd = getcwd() |LSS 021014 n
x = pos(cwd,"\") |LSS 021014 n
dir = cwd(1;x) & "ship_data\" |LSS 021014 n
|* e:\shipdata\ is the result

secondstamp = secs.now() |LSS 021009 n returns hhmmss as long
filename = sprintf$(
"%s%d_%D(%02y%02m%02d)_%06d.txt",
dir,suno.f,date.num(),secondstamp)

secondstamp is the time as a long with value hhmmss

When filename is opened manually (debug or manual run, it is fine. Directory permissions are r/w for everyone.
jobdaemon is the other user .

Any more Ideas please

grzegorz
15th October 2002, 15:23
Try to determine, if filename during job contains what you expect. You may for instance open another file with constant name as a log and write filename variable into that file. Then you will see what is the filename without debug or manual run. I think, that your problem is not with permissions, but with filename itself, and filename you build is somehow different during job and during manual run.

lsatenstein
15th October 2002, 15:27
The files are being created in e:\baan\tmp

The files should be created in e:\ship_data

The file names are faultless. And I am also creating a static file name and it too is being created in the wrong directory.


Regards

Leslie

nicklewe
18th October 2002, 14:10
Hello,

a big thank you to everybody for the tips and tricks ...

My file open access problem has been solved. The job user did not have the correct directory access permissions.

Nick