<?xml version="1.0" encoding="utf-8"?>
<ManualTopic ID="/baanerp/tt/onlinemanual/job_handling_procedure" xml:lang="en">
	<Header>
		<Title xmlns:HTML="http://www.w3.org/TR/REC-html40">Job handling procedure</Title>
		<Keyword ContextSensitive="No"><Level1>Job management</Level1>
			<Level2>job handling procedure</Level2>
		</Keyword>
	</Header>
	<GeneralSection><SectionTitle>Procedure aim</SectionTitle>
		<Paragraph class="Default">With the job handling procedures, you can start, block, cancel, queue, and release jobs.</Paragraph>
	</GeneralSection>
	<GeneralSection><SectionTitle>Procedure result and prerequisites</SectionTitle>
		<GeneralSection><SectionTitle>Result</SectionTitle>
			<Paragraph class="Default">This procedure results in a job that runs according to the job calendar or interval that is defined in the job’s basic data, without user interaction. This helps you to use ERP LN ’s resources more efficiently.</Paragraph>
		</GeneralSection>
		<GeneralSection><SectionTitle>Prerequisites</SectionTitle>
			<Paragraph class="Default">You can only use the job handling procedure when the job data procedure is completed.</Paragraph>
		</GeneralSection>
	</GeneralSection>
	<GeneralSection><SectionTitle>Steps in the job management procedures</SectionTitle>
		<Paragraph class="Default">Depending on the job’s status, the following methods are available to start a job:</Paragraph>
		<Paragraph class="Default">If the job status is In Queue, the Job Daemon starts the job.</Paragraph>
		<List><ListIntro>If the job’s status is Free, you can start the job in the following ways:</ListIntro>
			<ListItem>Run the <Link href="/baanerp/tt/aad/ttaad5203m000" role="session">Activate Job (ttaad5203m000)</Link> session</ListItem>
			<ListItem>Use the rc.startjob shell command (UNIX platform)</ListItem>
			<ListItem>Use the startjob.bat batch file (Windows platform)</ListItem>
		</List>
		<Figure space-and-orientation="indented-estimated"><FigIntro>The following figure illustrates the steps in the job handling procedure translated into the session or action that you must carry out to complete the procedure:</FigIntro>
			<HTML:IMG height="256" width="596" SRC="../images/tr_graph_job_handling_procedure.gif" path="/enterpriseserver/tools/tt/onlinemanual" btb-count="1" btb-count2="1" btb-image-name="tr_graph_job_handling_procedure.gif" btb-source-path="C:\SVN\docnl\Technology\EnterpriseServer~8.5\EnterpriseServer" btb-image-path="/enterpriseserver/tools/tt/images/tr_graph_job_handling_procedure.gif" ID="IDALDYBC" alt="[...]" xmlns:HTML="http://www.w3.org/TR/REC-html40"/></Figure>
		<Paragraph class="Default">This figure shows that the Job Daemon can start the job if the job’s status is In Queue. If you use the Job Daemon, the job starts automatically and a running VM is not necessary. The Job Daemon starts a VM in the background, which starts the UNIX shell program rc.startjob. The UNIX shell program then starts the job with the Activate Job Daemon session and the <GUIRef href="/baanerp/tt/aad/ttaad5203m000" role="session">Activate Job (ttaad5203m000)</GUIRef> session.</Paragraph>
		<Paragraph class="Default">You must start the Job Daemon to make sure that the Job Daemon can start any job. If the Job Daemon runs, you can exit the VM without any problem because the Job Daemon, and not your VM, carries out the job.</Paragraph>
		<Paragraph class="Default">If the job’s status is Free, you can use the <GUIRef href="/baanerp/tt/aad/ttaad5203m000" role="session">Activate Job (ttaad5203m000)</GUIRef> session, the UNIX shell program rc.startjob, or the Windows batch file startjob.bat to start the job manually. In this case, you must have a running VM.</Paragraph>
	</GeneralSection>
	<GeneralSection><SectionTitle>To enable and start the Job Daemon on a Windows platform</SectionTitle>
		<Paragraph class="Default">The Application Services Manager (ASM) manages (externally) the Job Daemon service.</Paragraph>
		<Paragraph class="Default">Typically, a Job Daemon runs jobs for one company. To run jobs for more companies, you must create a Job Daemon entry, in ASM, for each company. Per entry, use the BSE_COMPNR and PACKAGE_COMB variables to specify the company for which a Job Daemon must be started, and the package combination to which that company is linked.</Paragraph>
	</GeneralSection>
	<GeneralSection><SectionTitle>To start the Job Daemon on a UNIX platform</SectionTitle>
		<Paragraph class="Default">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 starts when you start the ERP LN environment.</Paragraph>
		<Paragraph class="Default">Typically, a Job Daemon runs jobs for one company. To run jobs for multiple companies, you must change the rc.start file to start Job Daemons for each company. Per Job Daemon entry, use the BSE_COMPNR and PACKAGE_COMB variables to specify the company for which a Job Daemon must be started, and the package combination to which that company is linked.</Paragraph>
		<Paragraph class="Default"><GUIRef href="" role="manual">Stop the Job Daemon</GUIRef>
		</Paragraph>
		<Paragraph class="Default">To stop the Job Daemon you can include the ${BSE}/etc/rc.stopjobdm command in the ${BSE}/etc/rc.stop script. As a result, the Job Daemon stops when you stop the ERP LN environment. To stop jobs for multiple companies, you must include multiple entries of rc.stopjobdm in the rc.stop file. Use the BSE_COMPNR and PACKAGE_COMB variables to specify the company for which a Job Daemon must be stopped, and the package combination to which that company is linked.</Paragraph>
	</GeneralSection>
	<GeneralSection><SectionTitle>To run a job with the Job Daemon</SectionTitle>
		<Paragraph class="Default">To use the Job Daemon to start a job, you must ensure that the job’s status is In Queue.</Paragraph>
		<Paragraph class="Default">Session <Link href="/baanerp/tt/aad/ttaad5500m000" role="session">Job Data (ttaad5500m000)</Link>
		</Paragraph>
	</GeneralSection>
	<GeneralSection><SectionTitle>To run the job with Activate Job (ttaad5203m000)</SectionTitle>
		<Paragraph class="Default">Because your running Virtual Machine (VM) starts the job, you cannot close the Virtual Machine (VM) until the job is finished. If the job is started prior to the time and date of execution, the job’s status changes to Waiting. After the job is carried out, the job’s status changes to Running.</Paragraph>
		<Paragraph class="Default">If you must start a job that belongs to more then one company, you must switch to the required company with the <GUIRef href="" role="manual">Change Company</GUIRef> command, before you start the job.</Paragraph>
	</GeneralSection>
	<GeneralSection><SectionTitle>To run the job with the rc.startjob shell program</SectionTitle>
		<Paragraph class="Default">You can also start the job with the UNIX shell program ${BSE}/etc/rc.startjob.</Paragraph>
		<Paragraph class="Default">To start the job, at the UNIX prompt you must enter:</Paragraph>
		<Paragraph class="Default">${BSE}/etc/rc.startjob [job name]</Paragraph>
		<Paragraph class="Default"><GUIRef href="" role="manual">Scheduling</GUIRef>
		</Paragraph>
		<Paragraph class="Default">If the rc.startjob program is included in a UNIX crontab, the program can automatically start jobs. For this purpose, some UNIX variables must be defined in the shell script. Additional information about how to define the UNIX variables is included in the shell script of the rc.startjob.</Paragraph>
		<Paragraph class="Default"><GUIRef href="" role="manual">Run jobs for multiple companies</GUIRef>
		</Paragraph>
		<Paragraph class="Default">If you must start jobs that pertain to different company numbers, different versions of the rc.startjob script are created.</Paragraph>
	</GeneralSection>
	<GeneralSection><SectionTitle>To run the job with the startjob.bat batch file</SectionTitle>
		<Paragraph class="Default">On a Windows platform you can start jobs with the startjob.bat batch file.</Paragraph>
		<List><ListIntro>To start a job, take the following steps:</ListIntro>
			<ListItem>Start a Command Prompt (cmd) on your ERP LN server</ListItem>
			<ListItem>Go to the ${BSE}\bin directory</ListItem>
			<ListItem>Run the fillenv.bat batch file to set the ERP LN environment variables</ListItem>
			<ListItem>Type startjob.bat [job name] to start the job</ListItem>
		</List>
		<Paragraph class="Default"><GUIRef href="" role="manual">Scheduling</GUIRef>
		</Paragraph>
		<Paragraph class="Default">To automate the execution of jobs, you can include startjob.bat in an external job scheduler, for example, the Windows scheduler. For this purpose, you must set the ERP LN environment variables in the startjob.bat batch file. To achieve this, you can copy the settings in the fillenv.bat batch file to the startjob.bat file.</Paragraph>
		<Paragraph class="Default"><GUIRef href="" role="manual">Run jobs for multiple companies</GUIRef>
		</Paragraph>
		<Paragraph class="Default">If you must start jobs that pertain to different company numbers, different versions of startjob.bat are created.</Paragraph>
	</GeneralSection>
</ManualTopic>
