| Job management overview |  |
| The advantage of a job is that the sessions in the job start while you are not logged on to ERP LN. In ERP LN, a job consists of one or more sessions and/or shell commands that run without user interaction. You can use a job to run one or more sessions as follows: At a predefined time Repeatedly, at specific times Periodically You can use the job management calendar to define the date and time the job must be started. Using the job calendar, you can start the job during quiet periods. For example, you can schedule processing and printing jobs to run during after office hours to improve the system performance during the day. In ERP LN, you can create the following two job types: Periodical jobs that are carried out multiple times For a periodical job, you must specify a time interval or a calendar is specified. If desired, you can restart the job automatically. Non-periodical jobs that are carried out only once When the job is carried out, the job data is removed automatically. Typically, each company stores its own basic job data. As a result, a job runs for a particular company. However, in a job, you can also run sessions in more than one company. You can only run sessions in multiple companies if the job data tables of the involved companies are physically mapped on one main company. You can use the Logical Tables (ttaad4120m000) session to link the following job tables as logical tables to one physical table: Job Data (ttaad500) Sessions by Job (ttaad501) Job Input Variables (ttaad503) Job Daemon Indicator (ttaad505) Calendars (ttaad506) Dates by Calendar (ttaad507) Job History (ttaad510) Job Session History (ttaad511) Job Session History (ttaad512) Before you add a session to a job, you must check the company number. If a job applies to more than one company, you must switch to the other companies with the Change Company command in the WorkTop/ Web UI to define the job for each company. You can then define the job data for the other companies. Job handling In ERP LN, the job’s status defines how you can start the job. You can start the job if the job’s status is In Queue or Free. In Queue If the job’s status is In Queue, you can use the Job Daemon to start the job. You must start the Job Daemon before the daemon can activate any job. The implementation of the Job Daemon depends on the operating system of the ERP LN server: On a UNIX server The Job Daemon is the shell program rc.startjobdm, which is located in the ${BSE]/etc directory. To start the Job Daemon, you can include the ${BSE}/etc/rc.startjobdm command in the ${BSE}/etc/rc.start file. As a result, the Job Daemon is activated when you start the ERP LN environment. On a Windows server The Job Daemon is a service that you can manage by means of the Application Services Manager (ASM) When the Job Daemon runs, you can stop the Virtual Machine (VM) without any problem. The Job Daemon, and not your VM, carries out the job. To run a job for multiple companies, you must start a Job Daemon for each company. For details, refer to Job handling procedures. Free If the job’s status is Free, you can start the job in the following ways: Use the Activate Job (ttaad5203m000) session Use the rc.startjob shell command (UNIX platform) Use the startjob.bat batch file (Windows platform) Activate Job (ttaad5203m000) If you start the job before the time and date of execution, the job’s status changes to Waiting. While the job is being carried out, the job’s status changes to Running. Because the Virtual Machine (VM) of the user who starts the job carries out the job, the user cannot quit the VM until the job is finished. If a job that belongs to more than one company must be started, you must use the Change Company command on the Menu browser’s Option menu to switch to the required company. The rc.startjob shell command (UNIX) You can also start the job with the UNIX ${BSE}/etc/rc.startjob shell script. For this purpose, you must enter the following syntax at the UNIX prompt: ${BSE}/etc/rc.startjob [job name]. You can include the rc.startjob script in a UNIX user job scheduler (crontab), which can automatically start jobs. For this purpose, some UNIX variables must be defined in the shell script. For more information, see the shell script. To run a job for multiple companies, you must create a unique version of the rc.startjob script for each company. For details, refer to To run the job with the rc.startjob shell program. The startjob.bat batch file (Windows) If ERP LN runs on a Windows server, you can also start the job with the startjob.bat batch file. To start a job, you must enter the following syntax at the Windows command prompt: startjob.bat [job name] Before you can enter this syntax, you must run the fillenv.bat batch file to set the ERP LN environment variables. To automate the execution of jobs, you can run startjob.bat with a scheduler. To run a job for multiple companies, you must create a unique version of startjob.bat for each company. For details, refer to To run the job with the startjob.bat batch file. Job status The following table lists the statuses a job can have during its life span:
Status | Description
--- | ---
Free | The job’s basic job data is defined and is ready to be started.
Running | The job is started and is running.
Waiting | The job is started and is waiting to be carried out at the next execution date and time. The Job Daemon will not start the job.
In queue | The job is queued and will be started automatically when the Job Daemon runs.
Blocked | The job is blocked and cannot be started. To start the job, set the status to Free or In Queue.
Canceled | The job has been stopped with the Cancel Jobs (ttaad5204m000) session. A job is also canceled when the maximum duration is exceeded.
Runtime error | This status signals an error during the execution of the job.
If required, you can cancel a job that the Job Daemon starts, for example, to change the job’s basic job data. To cancel the job, use the Job Data (ttaad5500m000) session. On the Specific menu, click Cancel Job. If you cancel a job, the current session of the running job is carried out, but the following sessions in the job will not be started. The job’s status changes from In Queue to Canceled. To restart a canceled job, you must release the job to change the job’s status to In Queue or Free. To temporarily stop a job, start the Job Data (ttaad5500m000) session. On the Specific menu, click Block Job. Job history When the execution of a job stops, for example because the job is completed successfully, or because of a runtime error, ERP LN writes information to a history log. The job history contains information such as the date and time of execution, the reason why the job has ended, and why the session in the job has ended. Use the Print Job History (ttaad5411m000) session to print this history. During the execution of a job, messages are suppressed. These suppressed messages are also logged in a history. You can use the Job History Messages (ttaad5512m000) session to print these messages. If you start jobs regularly, you must purge the job history list and the message history list regularly with the Delete Job History (ttaad5210m000) session. |