<?xml version="1.0" encoding="utf-8"?>
<ManualTopic ID="/baanerp/tt/onlinemanual/job_overview" xml:lang="en">
	<Header>
		<Title xmlns:HTML="http://www.w3.org/TR/REC-html40">Job management overview</Title>
		<Keyword ContextSensitive="No"><Level1>Job management</Level1>
			<Level2>overview</Level2>
		</Keyword>
	</Header>
	<GeneralSection><Paragraph class="Default">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.</Paragraph>
		<List><ListIntro>You can use a job to run one or more sessions as follows:</ListIntro>
			<ListItem>At a predefined time</ListItem>
			<ListItem>Repeatedly, at specific times</ListItem>
			<ListItem>Periodically</ListItem>
		</List>
		<Paragraph class="Default">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.</Paragraph>
		<List><ListIntro>In ERP LN, you can create the following two job types:</ListIntro>
			<ListItemHead>Periodical jobs that are carried out multiple times</ListItemHead>
			<ListItem>For a periodical job, you must specify a time interval or a calendar is specified. If desired, you can restart the job automatically.</ListItem>
			<ListItemHead>Non-periodical jobs that are carried out only once</ListItemHead>
			<ListItem>When the job is carried out, the job data is removed automatically.</ListItem>
		</List>
		<Paragraph class="Default">Typically, each company stores its own basic job data. As a result, a job runs for a particular company.</Paragraph>
		<Paragraph class="Default">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.</Paragraph>
		<List><ListIntro>You can use the <Link href="/baanerp/tt/aad/ttaad4120m000" role="session">Logical Tables (ttaad4120m000)</Link> session to link the following job tables as logical tables to one physical table:</ListIntro>
			<ListItem><GUIRef href="/baanerp/tt/aad/ttaad500" role="table">Job Data (ttaad500)</GUIRef>
			</ListItem>
			<ListItem><GUIRef href="/baanerp/tt/aad/ttaad501" role="table">Sessions by Job (ttaad501)</GUIRef>
			</ListItem>
			<ListItem><GUIRef href="/baanerp/tt/aad/ttaad503" role="table">Job Input Variables (ttaad503)</GUIRef>
			</ListItem>
			<ListItem><GUIRef href="/baanerp/tt/aad/ttaad505" role="table">Job Daemon Indicator (ttaad505)</GUIRef>
			</ListItem>
			<ListItem><GUIRef href="/baanerp/tt/aad/ttaad506" role="table">Calendars (ttaad506)</GUIRef>
			</ListItem>
			<ListItem><GUIRef href="/baanerp/tt/aad/ttaad507" role="table">Dates by Calendar (ttaad507)</GUIRef>
			</ListItem>
			<ListItem><GUIRef href="/baanerp/tt/aad/ttaad510" role="table">Job History (ttaad510)</GUIRef>
			</ListItem>
			<ListItem><GUIRef href="/baanerp/tt/aad/ttaad511" role="table">Job Session History (ttaad511)</GUIRef>
			</ListItem>
			<ListItem><GUIRef href="/baanerp/tt/aad/ttaad512" role="table">Job Session History (ttaad512)</GUIRef>
			</ListItem>
		</List>
		<Paragraph class="Default">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 <GUIRef href="" role="manual">Change Company</GUIRef> command in the WorkTop/WebTop to define the job for each company. You can then define the job data for the other companies.</Paragraph>
	</GeneralSection>
	<GeneralSection><SectionTitle>Job handling</SectionTitle>
		<Paragraph class="Default">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 <GUIRef href="" role="manual">In Queue</GUIRef> or <GUIRef href="" role="manual">Free</GUIRef>.</Paragraph>
		<GeneralSection><SectionTitle>In Queue</SectionTitle>
			<Paragraph class="Default">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.</Paragraph>
			<List><ListIntro>The implementation of the Job Daemon depends on the operating system of the ERP LN server:</ListIntro>
				<ListItemHead>On a UNIX server</ListItemHead>
				<ListItem>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.</ListItem>
				<ListItemHead>On a Windows server</ListItemHead>
				<ListItem>The Job Daemon is a service that you can manage by means of the Application Services Manager (ASM)</ListItem>
			</List>
			<Paragraph class="Default">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.</Paragraph>
			<Paragraph class="Default">To run a job for multiple companies, you must start a Job Daemon for each company. For details, refer to <GUIRef href="" role="manual">Job handling procedures</GUIRef>.</Paragraph>
		</GeneralSection>
		<GeneralSection><SectionTitle>Free</SectionTitle>
			<List><ListIntro>If the job’s status is Free, you can start the job in the following ways:</ListIntro>
				<ListItem>Use 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>
		</GeneralSection>
		<GeneralSection><SectionTitle>Activate Job (ttaad5203m000)</SectionTitle>
			<Paragraph class="Default">If you start the job before the time and date of execution, the job’s status changes to <GUIRef href="" role="manual">Waiting</GUIRef>. While the job is being carried out, the job’s status changes to <GUIRef href="" role="manual">Running</GUIRef>. 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.</Paragraph>
			<Paragraph class="Default">If a job that belongs to more than one company must be started, you must use the <GUIRef href="" role="manual">Change Company</GUIRef> command on the Menu browser’s <GUIRef href="" role="manual">Option</GUIRef> menu to switch to the required company.</Paragraph>
		</GeneralSection>
		<GeneralSection><SectionTitle>The rc.startjob shell command (UNIX)</SectionTitle>
			<Paragraph class="Default">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].</Paragraph>
			<Paragraph class="Default">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.</Paragraph>
			<Paragraph class="Default">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 <GUIRef href="" role="manual">To run the job with the rc.startjob shell program</GUIRef>.</Paragraph>
		</GeneralSection>
		<GeneralSection><SectionTitle>The startjob.bat batch file (Windows)</SectionTitle>
			<Paragraph class="Default">If ERP LN runs on a Windows server, you can also start the job with the startjob.bat batch file.</Paragraph>
			<Paragraph class="Default">To start a job, you must enter the following syntax at the Windows command prompt: startjob.bat [job name]</Paragraph>
			<Paragraph class="Default">Before you can enter this syntax, you must run the fillenv.bat batch file to set the ERP LN environment variables.</Paragraph>
			<Paragraph class="Default">To automate the execution of jobs, you can run startjob.bat with a scheduler.</Paragraph>
			<Paragraph class="Default">To run a job for multiple companies, you must create a unique version of startjob.bat for each company. For details, refer to <GUIRef href="" role="manual">To run the job with the startjob.bat batch file</GUIRef>.</Paragraph>
		</GeneralSection>
		<GeneralSection><SectionTitle>Job status</SectionTitle>
			<Paragraph class="Default">The following table lists the statuses a job can have during its life span:</Paragraph>
			<TABLE border="2" borderstyle="default" space-and-orientation="indented-estimated"><TBODY><TR><TH rowspan="1" colspan="1">Status</TH>
						<TH width="890" rowspan="1" colspan="1">Description</TH>
					</TR>
					<TR><TD rowspan="1" colspan="1">Free</TD>
						<TD width="890" rowspan="1" colspan="1">The job’s basic job data is defined and is ready to be started.</TD>
					</TR>
					<TR><TD rowspan="1" colspan="1">Running</TD>
						<TD width="890" rowspan="1" colspan="1">The job is started and is running.</TD>
					</TR>
					<TR><TD rowspan="1" colspan="1">Waiting</TD>
						<TD width="890" rowspan="1" colspan="1">
							<Paragraph class="Default">The job is started and is waiting to be carried out at the next execution date and time.</Paragraph> <Paragraph class="Default">The Job Daemon will not start the job.</Paragraph>
						</TD>
					</TR>
					<TR><TD rowspan="1" colspan="1">In queue</TD>
						<TD width="890" rowspan="1" colspan="1">The job is queued and will be started automatically when the Job Daemon runs.</TD>
					</TR>
					<TR><TD rowspan="1" colspan="1">Blocked</TD>
						<TD width="890" rowspan="1" colspan="1">The job is blocked and cannot be started. To start the job, set the status to Free or In Queue.</TD>
					</TR>
					<TR><TD rowspan="1" colspan="1">Canceled</TD>
						<TD width="890" rowspan="1" colspan="1">The job has been stopped with the <Link href="/baanerp/tt/aad/ttaad5204m000" role="session">Cancel Jobs (ttaad5204m000)</Link> session. A job is also canceled when the maximum duration is exceeded.</TD>
					</TR>
					<TR><TD rowspan="1" colspan="1">Runtime error</TD>
						<TD width="890" rowspan="1" colspan="1">This status signals an error during the execution of the job.</TD>
					</TR>
				</TBODY>
			</TABLE>
			<Paragraph class="Default">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 <Link href="/baanerp/tt/aad/ttaad5500m000" role="session">Job Data (ttaad5500m000)</Link> session. On the <GUIRef href="" role="manual">Specific</GUIRef> menu, click <GUIRef href="" role="manual">Cancel Job</GUIRef>. 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 <GUIRef href="" role="manual">In Queue</GUIRef> to <GUIRef href="" role="manual">Canceled</GUIRef>. To restart a canceled job, you must release the job to change the job’s status to <GUIRef href="" role="manual">In Queue</GUIRef> or <GUIRef href="" role="manual">Free</GUIRef>.</Paragraph>
			<Paragraph class="Default">To temporarily stop a job, start the <Link href="/baanerp/tt/aad/ttaad5500m000" role="session">Job Data (ttaad5500m000)</Link> session. On the <GUIRef href="" role="manual">Specific</GUIRef> menu, click <GUIRef href="" role="manual">Block Job</GUIRef>.</Paragraph>
		</GeneralSection>
	</GeneralSection>
	<GeneralSection><SectionTitle>Job history</SectionTitle>
		<Paragraph class="Default">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 <Link href="/baanerp/tt/aad/ttaad5411m000" role="session">Print Job History (ttaad5411m000)</Link> session to print this history.</Paragraph>
		<Paragraph class="Default">During the execution of a job, messages are suppressed. These suppressed messages are also logged in a history. You can use the <Link href="/baanerp/tt/aad/ttaad5512m000" role="session">Job History Messages (ttaad5512m000)</Link> session to print these messages.</Paragraph>
		<Paragraph class="Default">If you start jobs regularly, you must purge the job history list and the message history list regularly with the <Link href="/baanerp/tt/aad/ttaad5210m000" role="session">Delete Job History (ttaad5210m000)</Link> session.</Paragraph>
	</GeneralSection>
</ManualTopic>
