execute .p files from the command line

kckoll

New Member
I'm having problems trying to execute CIM programs from the command line. I get the following error when trying to execute them (they work fine in the progress editor).

Shared variable global_user_lang_dir has not yet been created. (392)

I have other programs that build reports that work just fine from the command line. It appears that QAD 2008 is trying to set some global shared variable.

The first thing I call in the program is

{mfdtitle.i "01"}.

If I comment this out, then I can't set batchrun... Any ideas....
 

kckoll

New Member
I'm pretty positive that this is an initialization problem. It's one thing to access the database via raw progress commands and twiddle the bits, it's another beast when trying to run QAD's cim's from the command line. Clearly I need the appropriate steps to setup the environment properly for the cim's to run. According to QAD, I need to log into their App and run the cim from with in it. If all I was doing was automating screen entries, that would be no problem, unfortunately that's not the case. If I could log in and then kick off the progress editor, I might be able to get around this, but I haven't figured out how to do that yet...
 

vinod_home

Member
like QAD said, you would have to log into the application and then run your cim program. You use the same logic like cim to log into the application. There are examples for this in the qad knowledgebase.

You would create a input file with the login information, Then you would create a .p with something like the following and then run that program using the same propath settings as your client session setup.

output to errorlog.txt.
input from inputfile.txt.
run mf.p
input close.
output close.


HTH
 

kckoll

New Member
Thanks, I've already done that. It works great for screen automation, but for anything else, it almost impossible.. Does anyone know if it is possible to launch the Progress Editor from a CIM? I suppose I could add my program to the menu and get to it that way, seems like quite a kludge though.
 

sphipp

Member
Have you tried running the CIM program from the QAD Menu?

If you have compiled the CIM Program and saved the R-Code into the correct standard MFG/PRO directory then you just have to type in the program name and MFG/PRO should just run it.

So, if you have cim001.p in a us-language installation you have to compile it and save cim001.r in us/ci. Then when you have logged onto MFG/PRO you can type cim001.p and press ENTER for the program to run.

All the Shared variables should have already been defined by MFG/PRO in the menu/startup./logon routines.

You do not need to actually add the program to the menu. It is effectively an invisible option that can easily be run.
 

kckoll

New Member
Yes, I know how to do that. But the point of this thread is to kick off programs from a cron job. I can do that as long as I don't try to execute any QAD Applications... Pure progress database commands work fine.
 

sphipp

Member
The best way to run a cron job for MFG/PRO is to invoke MFG/PRO with a command-line redirection. That way you have the full MFG/PRO environment.

If you try to use MFG/PRO include files from the command prompt or just from a command-line.p then you are going to have a lot of problems.

When I set up a new cron job, the first thing I do is to ensure that the program works from the MFG/PRO menu system, whether through a menu option or by typing the program name. Once that is working, I set up a unix script that will kick off MFG/PRO and load in the correct program and parameters. Once that works I can set up the cron job that calls the script.
 
Top