error in compilation of a program

Kopperton

Member
I am running /dlc/bin/_progres -p my program.p and I get the error "PROMSG not found", Progres 9.1d07 in unixware.

I need to run this program daily. Soemthing is missing when lauched? Please help me fix this.
 

Casper

ProgressTalk.com Moderator
Staff member
you haven't to set your environment corectly. (DLC,PROMSGS,etc...).
(You have to set DLC, promsgs etc in your environment to run a program, you can also run from proenv)

Casper.
 

TomBascom

Curmudgeon
You probably don't have the DLC environment set and exported properly.

Given your example:

$ DLC=/dlc
$ export DLC

will probably fix it.

Alternatively you may need to set the PROMSGS variable. That would be something like:

$ PROMSGS=/some/other/dir/promsgs
$ export PROMSGS

(but it is unlikely that this is your problem...)

BTW -- if you need to run it daily then you probably want to run it from cron and you will, therefore, probably want to use the -b startup parameter and redirect stdin & stdout. Something like:

$ $DLC/bin/_progres -b -p mystart.p > /dev/null 2>&1 &

is the usual syntax. (Use $DLC instead of /dlc -- it's more flexible in the long run...)
 

Kopperton

Member
any file that can be deleted later is a good file or need something special?

there is a file /dlc/promsg can I use that?
 

TomBascom

Curmudgeon
Kopperton said:
any file that can be deleted later is a good file or need something special?
Sorry, I don't understand the question.

there is a file /dlc/promsg can I use that?

Yes. But the reason that it cannot find it is probably because you have not defined the DLC environment variable. If you just define PROMSGS and do not define DLC you will have a new problem. Many things are found using the DLC variable -- promsgs is one of the first which is why that particular error is stopping you now. If DLC is properly defined then _progres will find promsgs in the default location (in your case /dlc/promsgs) without any problems. You would only use the PROMSGS variable if you want to relocate the file for some reason.
 

Kopperton

Member
TomBascom it worked, but is giving me another problem, I guess it needs user to connect to it.When I use QD editor to compile this program runs fine, but I connect to QD editor with the same user I use for Data Administration in windows. I bet is the same user I use in Data Administration when I connect from a pc.
How should I pass that argument. user: progresadmin password: mypassword. Sorry guys making it such a mess and thank you also.
 

Kopperton

Member
I am still having errors, I can run successfully the procedure in QD /rd/bin/sxee

but I can not get it running via cron scheduler. Am I missing a lot of things here?
 
Normally, when running programs using the cron scheduler, you don't want any output to screen and certainly don't want any user input.

If you start the Progress session with the -b parameter then it runs in batch mode that doesn't have any user input or screen output at all and will fail if there is any.

I tend to not use the -b and redirect any output to a text file so that I can have a look at it and see if it has worked.

Also, I often write a line to a data log for that program that tells me when I have started and stopped the session correctly.
DEF STREAM s_log.
procedure p_write_to_log:
DEF INPUT PARAM inp_message AS CHAR NO-UNDO.
OUTPUT STREAM s_log to /usr/bin/logs/thisprogressprogram.log APPEND.
PUT STREAM s_log UNFORMATTED today " " string (time,"hh:mm:ss") " thisprogressprogram " inp_message skip.
OUTPUT STREAM s_log CLOSE.
end procedure.

run p_write_to_log ("STARTED").
run p_write_to_log ("FINISHED").

That way, you can see if the program starts on crontab at the correct time and finishes correctly. You can also use this to debug the code by putting log entries at key points in the code.

As to the crontab entry, I always use a script to start Progress programs, that way I can control DLC PROMSGS etc for each different instance. If you redirect any output to a text file, you can view it afterwards, e.g.
10 0 * * * /usr/bin/user/test.s > /usr/bin/logs/test.log

Obviously, make sure the output directory exists and you have permission to write to it.

I have found that Progress running from crontab normally works OK and once you get one working then you can use the same method for all you crontab Progress sessions.

Sorry, a bit long-winded, but hopefully it will help.

Simon
 

cferriol

Member
I don't see the database connection in your command line and you said that in the procedure editor it works.
Probably that is the problem.
-db "database" [-N "protocol" -H "host" -S "service"]
 
yes, look at the sxee script and you'll find that is runs the script nxt.env, this is the enviroment setup script for SX.e. nxt.env sets the DLC and PROPATH unix environment variables. I would suggest you make a script that runs nxt.env first, then the call for your program; and have this new script run by cron.
 
Top