# Kernel Engine (Engine `krn`)

The jobs of the kernel executor `krn` serve for the internal management of the application server processes.
These are particularly functions for batch management, server monitoring, registry management
and administration of loaded engines at runtime.

## Session Management

These jobs serve for session management.

* [krn.SessionAttach](krn.md#krn.SessionAttach)
* [krn.SessionLogin](krn.md#krn.SessionLogin)
* [krn.SessionLogout](krn.md#krn.SessionLogout)
* [krn.SessionDrop](krn.md#krn.SessionDrop)
* [krn.SessionDropDB](krn.md#krn.SessionDropDB)
* [krn.SessionDeleteLost](krn.md#krn.SessionDeleteLost)
* [krn.SessionEnum](krn.md#krn.SessionEnum)
* [krn.SessionEnumDB](krn.md#krn.SessionEnumDB)
* [krn.SessionEnumResourcesDB](krn.md#krn.SessionEnumResourcesDB)
* [krn.SessionGetInfo](krn.md#krn.SessionGetInfo)
* [krn.SessionPropertiesEnum](krn.md#krn.SessionPropertiesEnum)
* [krn.SessionPropertiesGet](krn.md#krn.SessionPropertiesGet)
* [krn.SessionPropertiesSet](krn.md#krn.SessionPropertiesSet)
* [krn.UserSessionCreate](krn.md#krn.UserSessionCreate)
* [krn.UserSessionDelete](krn.md#krn.UserSessionDelete)
* [krn.SessionChangePassword](krn.md#krn.SessionChangePassword)
* [krn.VerifyPassword](krn.md#krn.VerifyPassword)

## Channel Management

* [krn.GetChannelGUID](krn.md#krn.GetChannelGUID)

## Batch Management

* [krn.BatchAdd](krn.md#krn.BatchAdd)
* [krn.BatchChange](krn.md#krn.BatchChange)
* [krn.BatchEnum](krn.md#krn.BatchEnum)
* [krn.BatchGetStatistic](krn.md#krn.BatchGetStatistic)
* [krn.BatchRemove](krn.md#krn.BatchRemove)

## Registry Management

These jobs serve for registry management.
Registry entries can be queried or changed.

* [krn.RELoad](krn.md#krn.RELoad)
* [krn.RESave](krn.md#krn.RESave)
* [krn.REBackup](krn.md#krn.REBackup)
* [krn.REGetCurrentSchema](krn.md#krn.REGetCurrentSchema)
* [krn.REGetRegValue](krn.md#krn.REGetRegValue)
* [krn.REGetRegValues](krn.md#krn.REGetRegValues)
* [krn.RESetRegValue](krn.md#krn.RESetRegValue)

## Server Management

These jobs serve for server management.

* [krn.GetServerInfo](krn.md#krn.GetServerInfo)
* [krn.GetServerInfoEx](krn.md#krn.GetServerInfoEx)
* [krn.CheckServerConnection](krn.md#krn.CheckServerConnection)
* [krn.MakeBeatPing](krn.md#krn.MakeBeatPing)
* [krn.CheckCrashedServers](krn.md#krn.CheckCrashedServers)
* [krn.RefillServerList](krn.md#krn.RefillServerList)
* [krn.AppsEventsEnum](krn.md#krn.AppsEventsEnum)
* [krn.AppsEventsSubscribe](krn.md#krn.AppsEventsSubscribe)
* [krn.ShutDown](krn.md#krn.ShutDown)

## Engine Management

These jobs serve for engine management.

* [krn.NameSpaceEnum](krn.md#krn.NameSpaceEnum)
* [krn.EnumNameSpaces](krn.md#krn.EnumNameSpaces)
* [krn.GetNameSpaceParams](krn.md#krn.GetNameSpaceParams)
* [krn.NameSpaceGetInfo](krn.md#krn.NameSpaceGetInfo)
* [krn.NameSpaceGetJobsInfo](krn.md#krn.NameSpaceGetJobsInfo)
* [krn.EnumJobs](krn.md#krn.EnumJobs)
* [krn.LoadExecutor](krn.md#krn.LoadExecutor)
* [krn.ReloadExecutor](krn.md#krn.ReloadExecutor)
* [krn.UnloadExecutor](krn.md#krn.UnloadExecutor)
* [krn.LogConfigGet](krn.md#krn.LogConfigGet)
* [krn.LogConfigSet](krn.md#krn.LogConfigSet)

## General Management

* [krn.EnumModules](krn.md#krn.EnumModules)
* [krn.JobThreadBreak](krn.md#krn.JobThreadBreak)
* [krn.JobThreadGetInfo](krn.md#krn.JobThreadGetInfo)
* [krn.QueueEnum](krn.md#krn.QueueEnum)
* [krn.QueueGetParams](krn.md#krn.QueueGetParams)
* [krn.QueueGetStatistic](krn.md#krn.QueueGetStatistic)

## Other Jobs

* [krn.EmptyJob](krn.md#krn.EmptyJob)
* [krn.CheckDiskSpace](krn.md#krn.CheckDiskSpace)
* [krn.CheckUserAccount](krn.md#krn.CheckUserAccount)
* [krn.GetFileVersionList](krn.md#krn.GetFileVersionList)
* [krn.GetNextIndex](krn.md#krn.GetNextIndex)
* [krn.GetCounter](krn.md#krn.GetCounter)
* [krn.RunScript](krn.md#krn.RunScript)
* [krn.SendAdminMail](krn.md#krn.SendAdminMail)
* [krn.SendMail](krn.md#krn.SendMail)
* [krn.SendMessageToClients](krn.md#krn.SendMessageToClients)
* [krn.ProcessGetInformation](krn.md#krn.ProcessGetInformation)
* [krn.ChangeUserObjDefLanguage](krn.md#krn.ChangeUserObjDefLanguage)

## Undocumented Endpoints

The following jobs are offered by the enaio® server in the `krn` engine but are not currently described in this documentation:

Channel management (server-to-server communication)::
`krn.ChannelDrop`, `krn.ChannelEnum`, `krn.ChannelGetInfo`, `krn.ChannelGetInfoSR`, `krn.ChannelMakePing`, `krn.ChannelOpen`, `krn.ChannelPingMade`, `krn.ChannelServerGetInfoSR`, `krn.ConnectionGetInfoSR`, `krn.CritSectGetInfoSR`

Extended session management::
`krn.CloseSession`, `krn.CreateSession`, `krn.GetUserBySessionGUID`, `krn.OpenSession`, `krn.SessionCheckPwd`, `krn.SessionDropNotActive`, `krn.SessionGetInfoSR`, `krn.SessionGetSysRoles`, `krn.SetSessionUser`

Server strings (key-value persistence on the server)::
`krn.SrvStrg_Clear`, `krn.SrvStrg_ElementDelete`, `krn.SrvStrg_ElementEnum`, `krn.SrvStrg_ElementExists`, `krn.SrvStrg_ElementGet`, `krn.SrvStrg_ElementNames`, `krn.SrvStrg_ElementProps`, `krn.SrvStrg_ElementSet`, `krn.SrvStrg_Load`, `krn.SrvStrg_Save`

Prepared jobs::
`krn.PreparedJobDel`, `krn.PreparedJobEnum`, `krn.PreparedJobExecute`, `krn.PreparedJobState`, `krn.PreparedJobStop`, `krn.PreparedJobUnlock`

Profiler::
`krn.ProfilerConfigGet`, `krn.ProfilerConfigSet`, `krn.ProfilerStart`, `krn.ProfilerStop`

Job callbacks and asynchronous jobs::
`krn.AsynchJobResponse`, `krn.DeregisterJobCall`, `krn.RegisterJobCall`, `krn.RejectJob`

Threads (stacks and enumeration)::
`krn.GetFlowStackSizes`, `krn.JobThreadGetCallStack`, `krn.JobThreadGetFlowStack`, `krn.ThreadEnum`, `krn.ThreadGetInformation`

Database pool diagnostics::
`krn.DBGetJTEnum`, `krn.DBPoolJTEnum`, `krn.DBPoolRTEnum`

Direct SQL access (internal diagnostics)::
`krn.SQLCommand`, `krn.SQLSelect`

Logging and trace configuration::
`krn.ETMGetFileName`, `krn.ETMRereadConfig`, `krn.LogConfigReread`

Other management::
`krn.AslogGeneralFlags`, `krn.BatchGetLastResults`, `krn.CheckClausesFormats`, `krn.CheckExpires`, `krn.ClearOvertimedJobs`, `krn.EnumClients`, `krn.EnumRJCIntervals`, `krn.EnumRJCJobs`, `krn.EnumSessionResources`, `krn.EnvironmentChanged`, `krn.ExecutorKernel`, `krn.ExplorerFind`, `krn.GetClientInfo`, `krn.PacketToSendQueue`

<a id="krn.AppsEventsEnum"></a>

## krn.AppsEventsEnum

This job returns all defined event types implemented in the server.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |

### Output Parameters

| Name | Type | Dependency | Description |
|---|---|---|---|
| `Info` | STRING | — | Semicolon-separated, MIME-encoded buffer with the event types |
| `Infotyp` | STRING | — | Description of the data returned in `Info` |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

<a id="krn.AppsEventsSubscribe"></a>

## krn.AppsEventsSubscribe

This job causes the server to send notifications (notifications) for the specified events to the caller.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |
| `Events` | STRING | Yes | Semicolon-separated events for which notifications are to be subscribed: +<br>[krn.SessionLogin](krn.md#krn.SessionLogin), [krn.SessionLogout](krn.md#krn.SessionLogout), `krn.Connected`, `krn.Disconnected`, `krn.JobCall`, `krn.Executor` |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

<a id="krn.BatchAdd"></a>

## krn.BatchAdd

This job adds a batch to the registry.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |
| `Registry` | STRING | Yes | Name in the registry |
| `Name` | STRING | Yes | Name of the batch to be added |
| `NameSpace` | STRING | Yes | Engine of the job to be executed |
| `JobName` | STRING | Yes | Name of the job to be executed (without engine prefix) |
| `Scheduling` | STRING | Yes | Execution time |
| `Period` | INT | Yes | Duration in milliseconds between calls of the job |
| `Enabled` | BOOLEAN | Yes | `1` = Batch is enabled; `0` = disabled |
| `DoLog` | BOOLEAN | Yes | `1` = Job is logged; `0` = no logging |
| `Parameters` | MIME buffer | Yes | Name, data type and value of the job (MIME-encoded buffer) |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

See also: [krn.BatchChange](krn.md#krn.BatchChange), [krn.BatchRemove](krn.md#krn.BatchRemove)

<a id="krn.BatchChange"></a>

## krn.BatchChange

This job changes an existing batch.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |
| `Registry` | STRING | Yes | Name in the registry |
| `Name` | STRING | Yes | Name of the batch to be changed |
| `NameSpace` | STRING | Yes | Engine of the job to be executed |
| `JobName` | STRING | Yes | Name of the job to be executed (without engine prefix) |
| `Scheduling` | STRING | Yes | Execution time |
| `Period` | INT | Yes | Duration in milliseconds between calls of the job |
| `Enabled` | BOOLEAN | Yes | `1` = Batch is enabled; `0` = disabled |
| `DoLog` | BOOLEAN | Yes | `1` = Job is logged; `0` = no logging |
| `Parameters` | MIME buffer | Yes | Name, data type and value of the job (MIME-encoded buffer) |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

See also: [krn.BatchEnum](krn.md#krn.BatchEnum)

<a id="krn.BatchEnum"></a>

## krn.BatchEnum

This job returns a list of existing batches.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |

### Output Parameters

| Name | Type | Dependency | Description |
|---|---|---|---|
| `Batch[1..n]` | STRING | — | Information about the batch with the following fields: +<br>`Registry` (name of the registry entry);<br>`Name` (name of the batch);<br>`Period` (duration in ms between calls);<br>`Scheduling`;<br>`JobName` (without engine prefix);<br>`NameSpace`;<br>`Enabled` (`1` = active);<br>`DoNotLog` (`1` = logged);<br>`TimeCreated` (creation time);<br>`TimeEnabled` (activation time);<br>`TimeFired` (time of last execution);<br>`Parameters` (MIME-encoded parameters) |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

See also: [krn.BatchAdd](krn.md#krn.BatchAdd), [krn.BatchChange](krn.md#krn.BatchChange), [krn.BatchRemove](krn.md#krn.BatchRemove), [krn.BatchGetStatistic](krn.md#krn.BatchGetStatistic)

<a id="krn.BatchGetStatistic"></a>

## krn.BatchGetStatistic

This job outputs statistical parameters for the selected batch.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |
| `Name` | STRING | Yes | Name of the batch whose statistics should be output |

### Output Parameters

| Name | Type | Dependency | Description |
|---|---|---|---|
| `Ticks` | STRING | — | Number of job executions |
| `PeriodAve` | STRING | — | Average period between ticks (in seconds) |
| `PeriodLast` | STRING | — | Period between last and second-to-last tick (in seconds) |
| `DeviationAveP` | STRING | — | Average deviation of intervals from target (in percent) |
| `DeviationAveS` | STRING | — | Average deviation of intervals from target (in seconds) |
| `DeviationLastP` | STRING | — | Deviation of last interval from target (in percent) |
| `DeviationLastS` | STRING | — | Deviation of last interval from target (in seconds) |
| `DeviationMaxP` | STRING | — | Maximum deviation of intervals from target (in percent) |
| `DeviationMaxS` | STRING | — | Maximum deviation of intervals from target (in seconds) |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

See also: [krn.BatchEnum](krn.md#krn.BatchEnum)

<a id="krn.BatchRemove"></a>

## krn.BatchRemove

This job removes an existing batch.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |
| `Registry` | STRING | Yes | Name of the registry entry of the batch to be removed |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

See also: [krn.BatchEnum](krn.md#krn.BatchEnum)

<a id="krn.ChangeUserObjDefLanguage"></a>

## krn.ChangeUserObjDefLanguage

This job changes the language ID used for the currently logged-in user when resolving display texts in object definitions (cabinets, fields, catalogs).

====
This job is not listed in the official enaio® kernel engine overview. This description was reconstructed from the call code of the `enaio-jobs-custom` template.
====

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Reserved; always pass `0`. |
| `LangID` | INT | Yes | Numeric language ID to use from now on for resolution. |

### Return Value

`(INT)`: `0` = job successful, otherwise error code.

### See Also

* [dms.GetObjDef](dms.md#dms.GetObjDef) — returns object definitions in the currently active language

<a id="krn.CheckCrashedServers"></a>

## krn.CheckCrashedServers

This job searches for crashed servers and frees their resources.
In the DB table `ospingtable` the server status is set to `2` (hung server).

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

See also: [krn.MakeBeatPing](krn.md#krn.MakeBeatPing)

<a id="krn.CheckDiskSpace"></a>

## krn.CheckDiskSpace

This job returns information about the capacity of the specified drive.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |
| `Disk` | STRING | Yes | Drive name: +<br>`ROOT` = drive of the server directory +<br>`DATA` = drive of the work server directory +<br>`LOG` = drive of the log server directory |
| `MinSpace` | INT | Yes | Minimum free space in MB. If this value is exceeded, the administrator will be notified by email. Empty = value from registry. |
| `InformAdmin` | BOOLEAN | Yes | `1` = administrator is informed by email; `0` = no information |

### Output Parameters

| Name | Type | Dependency | Description |
|---|---|---|---|
| `Total` | INT64 | — | Drive size in MB |
| `Free` | INT64 | — | Free space in MB |
| `Min` | INT64 | — | Minimum free space in MB |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

<a id="krn.CheckServerConnection"></a>

## krn.CheckServerConnection

This job checks the server connection by incrementing a global counter variable by 1 with each call.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |

### Output Parameters

| Name | Type | Dependency | Description |
|---|---|---|---|
| `CallNumber` | LONG | — | Number of job calls |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

<a id="krn.CheckUserAccount"></a>

## krn.CheckUserAccount

This job checks whether the specified user can log into the system.
If a password is passed, it is checked — an incorrect password can lead to account lockout (same criteria as in enaio® enterprise-manager).

The job returns with an error if the user cannot log into the system.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Must be `0`. |
| `UserName` | STRING | Yes | Login name of the user |
| `[Password]` | STRING | No | Encrypted password (optional) |

### Output Parameters

| Name | Type | Dependency | Description |
|---|---|---|---|
| `Action` | INT | — | Result of login check: +<br>`0` = login is possible +<br>`2` = user not known +<br>`3` = account locked by wrong password, login not possible +<br>`4` = wrong password, re-login possible +<br>`5` = account already locked, login not possible |
| `PwdExpires` | INT | only when `Action` = `0` | Password validity (only when `Action=0`): +<br>`-1` = password does not expire within the validity period +<br>`0` = password has expired and must be changed +<br>`n` = number of days until expiration |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

<a id="krn.EmptyJob"></a>

## krn.EmptyJob

Generic job without its own logic. All passed parameters and files are returned unchanged in the response.

The job serves as a universal communication channel whose behavior is entirely defined by server-side **before and after events**. Without configured events, it behaves as an echo — all input parameters and files are returned 1:1.

### Typical Use Cases

* **Execute server-side business logic** — Before/after events can evaluate the passed parameters, perform server-side operations, and set custom return parameters.
* **File transfer** — Files can be sent to the server and processed by events. The job can also return files in the response.
* **Parameterized RPC channel** — Any input parameters are forwarded to the events, and any output parameters can be set by the events.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |
| _any_ | _any_ | No | All additional parameters are forwarded to the server-side events and returned unchanged without configured events. |

### Input Files

Any files can be passed. Without configured events, they are returned unchanged in the response.

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

Without configured events, the response contains all input parameters and files as an echo. With configured events, the return parameters and files can be freely defined by the event script.

### See Also

[krn.RunScript](krn.md#krn.RunScript) — Executes a script directly (instead of via events).

<a id="krn.EnumJobs"></a>

## krn.EnumJobs

This job returns a list of implemented jobs for a specified engine.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |
| `NameSpace` | STRING | Yes | Short label of the engine for which the list of jobs should be generated (e.g. `krn`, `dms`, `std`) |

### Output Parameters

| Name | Type | Dependency | Description |
|---|---|---|---|
| `[Jobname]` | STRING | Optional | One parameter per implemented job. The parameter name equals the job name (without namespace prefix); the value is empty. |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

### Notes

* The job names are contained in the parameter names, not in the parameter values.
* The returned job names have no namespace prefix; for a call, prepend the engine's prefix (e.g. parameter name `BatchEnum` in engine `krn` corresponds to the job `krn.BatchEnum`).
* Which jobs are returned depends on the specific server installation and configuration and may differ between systems.
* The available engine labels are returned by [krn.EnumNameSpaces](krn.md#krn.EnumNameSpaces).

### Example

Request with `Flags` = `0` and `NameSpace` = `krn`. Excerpt of the returned output parameters (return value `0`):

```text
AppsEventsEnum       =
AppsEventsSubscribe  =
AslogGeneralFlags    =
AsynchJobResponse    =
BatchAdd             =
…
```
See also: [krn.EnumNameSpaces](krn.md#krn.EnumNameSpaces)

<a id="krn.EnumModules"></a>

## krn.EnumModules

This job returns a list of loaded modules (libraries).
System32 DLLs can be hidden.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |
| `NoSystem32` | BOOLEAN | Yes | `1` = hide System32 DLLs; `0` = show |

### Output Parameters

| Name | Type | Dependency | Description |
|---|---|---|---|
| `Module[1..n]` | STRING | — | Semicolon-separated information about the respective module: +<br>`Basename` (name without path); `FileName` (name with path); `Version`; `Create` (creation time); `Write` (last modification); `Access` (last access) |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

<a id="krn.EnumNameSpaces"></a>

## krn.EnumNameSpaces

This job returns a list of implemented engines (alphabetically sorted).

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |

### Output Parameters

| Name | Type | Dependency | Description |
|---|---|---|---|
| `NameSpace[1..n]` | STRING | — | Name of an engine. One parameter per engine, numbered from `NameSpace1`. |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

### Notes

* Which engines are returned depends on the specific server installation and configuration and may differ between systems.
* The number of engines can be determined from the index of the `NameSpace` parameters (`NameSpace1`, `NameSpace2`, … `NameSpaceN`).

### Example

The output parameters of a typical installation:

```text
NameSpace1  = abn
NameSpace2  = adm
NameSpace3  = ado
NameSpace4  = cnv
NameSpace5  = dbp
NameSpace6  = dms
NameSpace7  = dtr
NameSpace8  = krn
NameSpace9  = lic
NameSpace10 = mng
NameSpace11 = std
NameSpace12 = vtx
NameSpace13 = wfm
```
See also: [krn.EnumJobs](krn.md#krn.EnumJobs)

<a id="krn.GetChannelGUID"></a>

## krn.GetChannelGUID

This job returns the GUID of the currently open server communication channel.
The channel GUID is used for unique identification of the connection in server-side logs and session tables.

====
This job is not listed in the official enaio® kernel engine overview. This description was reconstructed from the call code of the `enaio-jobs-custom` template.
====

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Reserved; always pass `0`. |

### Output Parameters

| Name | Type | Dependency | Description |
|---|---|---|---|
| `ChannelGUID` | STRING | — | GUID of the current communication channel. |

### Return Value

`(INT)`: `0` = job successful, otherwise error code.

### See Also

* [krn.SessionAttach](krn.md#krn.SessionAttach) — binds a working session to a channel
* [krn.GetServerInfo](krn.md#krn.GetServerInfo) — server-side information about the current context

<a id="krn.GetCounter"></a>

## krn.GetCounter

This job manages counters in the table `oscounters`.
When called, the counter value is incremented (except when resetting).
Resetting occurs automatically or manually depending on the counter type.

Counter types: +
`0` = manually reset (via job parameter) +
`1` = daily reset +
`2` = monthly reset +
`3` = yearly reset

Counters are identified by GUID and type.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |
| `CounterGUID` | STRING | Yes | GUID of the counter |
| `CounterType` | INT | Yes | Type of the counter (`0`–`3`, see above) |
| `Reset` | BOOLEAN | Yes | `1` = counter is reset (only for `CounterType=0`); `0` = do not reset |
| `Initial` | INT | Yes | Value with which the counter is initialized if it does not exist or is reset |

### Output Parameters

| Name | Type | Dependency | Description |
|---|---|---|---|
| `Counter` | INT | — | Current value of the counter |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

<a id="krn.GetFileVersionList"></a>

## krn.GetFileVersionList

This job returns a list of files in the requested directory with creation time information.
For DLL, OCX and EXE files, instead of creation time the version number is displayed.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |
| `Directory` | STRING | Yes | Directory. `.` = `server\etc`; `..` = server directory |

### Output Parameters

| Name | Type | Dependency | Description |
|---|---|---|---|
| `FileVersionList` | STRING | — | File names and creation time in the format: `[filename]+[Datetime/version number]#[filename2]+[Datetime2]#...` |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

<a id="krn.GetNameSpaceParams"></a>

## krn.GetNameSpaceParams

This job returns the engine parameters for a specified engine.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |
| `NameSpace` | STRING | Yes | Short label of the engine (e.g. `krn`, `dms`, `std`) |

### Output Parameters

| Name | Type | Dependency | Description |
|---|---|---|---|
| `Child` | INT | — | `1` = executor was started in a separate process; `0` = in main process |
| `ExecutorPresent` | BOOLEAN | — | `1` = executor is present; `0` = not present |
| `Internal` | BOOLEAN | — | `1` = internal engine (implemented in kernel); `0` = implemented in executor |
| `Queue` | STRING | — | Name of the queue for the engine |
| `State` | INT | — | Engine status: `0`=CREATED; `1`=LOADING; `2`=LOADED; `3`=UNLOADING; `4`=UNLOADED |
| `StateText` | STRING | — | Status as text |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

### Notes

* Which output parameters are returned depends on the specific server installation and configuration and may differ between systems.
* The available engine labels are returned by [krn.EnumNameSpaces](krn.md#krn.EnumNameSpaces).

### Example

Request with `Flags` = `0` and `NameSpace` = `dms`. Returned output parameters (return value `0`):

```text
ExecutorPresent = 1
Internal        = 0
Queue           = dms
State           = 2
StateText       = LOADED
```
See also: [krn.EnumNameSpaces](krn.md#krn.EnumNameSpaces)

<a id="krn.GetNextIndex"></a>

## krn.GetNextIndex

This job returns the next index from the database table `osnextindex` for all DB entries that need a unique ID.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |

### Output Parameters

| Name | Type | Dependency | Description |
|---|---|---|---|
| `Index` | INT | — | The requested index |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

<a id="krn.GetServerInfo"></a>

## krn.GetServerInfo

This job returns a specific server information based on the information type.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |
| `Info` | INT | Yes | Information type (see table below) |

### Output Parameters

| Name | Type | Dependency | Description |
|---|---|---|---|
| `Info` | INT | — | Equal to the input parameter `Info` |
| `Name` | STRING | — | The identifier associated with the info type |
| `Value` | STRING | — | The queried server information |

### Information Types

| Info Type | Info String | Description |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| `1` | `ServerID` | Server ID | `2` | `ComputerName` | Server name | `3` | `InstanceName` | Program instance name | `4` | `ComString` | Server Comstring (e.g. `127.0.0.1`) | `5` | `DataBaseSourceC` | Database name (e.g. `os400`) | `6` | `DataBaseParser` | Database parser (e.g. `oxorantl.dll`) | `7` | `ClientETC` | Path to client configuration files | `8` | `StatusLine` | Status bar string | `9` | `ServerType` | `0` = main server; `1` = secondary server | `16` | `ETC` | Complete path of the server directory `etc` | `1000` | `FileVersionListUpdate` | File names + creation time from `server\etc\update` | `1001` | `FileVersionListClient` | File names + creation time from `server\etc\update\client` | `1002` | `FileVersionListAdmin` | File names + creation time from `server\etc\update\admin` | `1003` | `FileVersionListIndex` | File names + creation time from `server\etc\update\index` | `1004` | `FileVersionListTemplate` | File names + creation time from `server\etc\templates` |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

See also: [krn.GetServerInfoEx](krn.md#krn.GetServerInfoEx)

<a id="krn.GetServerInfoEx"></a>

## krn.GetServerInfoEx

This job returns the specified server information.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |
| `Info` | STRING | Yes | Semicolon-separated parameters to be output (`;Parameter;Parameter;...`): +<br>`?` → Names of all parameters are returned as a list +<br>empty string → all parameters and their values are returned |

### Output Parameters

| Name | Type | Dependency | Description |
|---|---|---|---|
| `[Param[000..NNN]]` | STRING | Optional | Only when `Info=?`: Names of all parameters that can be passed via `Info` |
| `[Parametername]` | STRING | Optional | Server information for the respective requested parameter |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

See also: [krn.GetServerInfo](krn.md#krn.GetServerInfo)

<a id="krn.JobThreadBreak"></a>

## krn.JobThreadBreak

This job interrupts the execution of the specified running job.
Can only be used for correctly running jobs that support this job.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |
| `ThreadID` | INT | Yes | Thread ID |
| `JobNumber` | INT | Yes | Job number |
| `Queue` | STRING | Yes | Name of the queue |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

<a id="krn.JobThreadGetInfo"></a>

## krn.JobThreadGetInfo

This job returns information about the threads.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |

### Output Parameters

| Name | Type | Dependency | Description |
|---|---|---|---|
| `Info` | STRING | — | Semicolon-separated MIME-encoded information about threads |
| `Infotyp` | STRING | — | Description of the data returned in `Info` |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

<a id="krn.LoadExecutor"></a>

## krn.LoadExecutor

This job loads an executor.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |
| `Name` | STRING | Yes | Short label of the engine to be loaded |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

See also: [krn.ReloadExecutor](krn.md#krn.ReloadExecutor)

<a id="krn.LogConfigGet"></a>

## krn.LogConfigGet

This job returns information about the current logging settings.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | `0` = standard output (to be used in normal cases) +<br>`1` = verbose (more settings are returned) |

### Output Parameters

| Name | Type | Dependency | Description |
|---|---|---|---|
| `JSON` | STRING | — | List of log channels. For each channel: name, channel type (`Action`: `8`=error), suspended, level, log type, name of the log file, new file daily, maximum file size. |
**Example: JSON return value**

```json
{"ProcessID":13540,"Reports":[{"Name":"default","Channels":[
{"Type":0,"Action":8,"Level":1,"Suspended":0,"Name":"oxrpt\\channels\\Error log",
 "LogFileName":"D:\\log\\err061020.evn","RecreateOnNewDay":1,"MaxFileSize":16384},
{"Type":0,"Action":7,"Level":1,"Suspended":1,"Name":"oxrpt\\channels\\Job call log",
 "LogFileName":"D:\\log\\log061020.evn","RecreateOnNewDay":1,"MaxFileSize":16384},
{"Type":0,"Action":15,"Level":5,"Suspended":1,"Name":"oxrpt\\channels\\Flow log",
 "LogFileName":"D:\\log\\flw061020.evn","RecreateOnNewDay":1,"MaxFileSize":65536},
{"Type":0,"Action":9,"Level":3,"Suspended":1,"Name":"oxrpt\\channels\\SQL log"}
]}]}
```

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

<a id="krn.LogConfigSet"></a>

## krn.LogConfigSet

This job changes the logging settings.
In the JSON, `Name` and `Channels` are required, then all values to be changed.
Only the specified values are adjusted.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Must be `0`. |
| `JSON` | STRING | Yes | The channels to be changed in the same format as in [krn.LogConfigGet](krn.md#krn.LogConfigGet) |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

<a id="krn.MakeBeatPing"></a>

## krn.MakeBeatPing

This job performs a ping to the application server.
The table `ospingtable` is updated with server status `1` (server active).

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

See also: [krn.CheckCrashedServers](krn.md#krn.CheckCrashedServers)

<a id="krn.NameSpaceEnum"></a>

## krn.NameSpaceEnum

This job returns a list of implemented engines.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |

### Output Parameters

| Name | Type | Dependency | Description |
|---|---|---|---|
| `Namespaces` | STRING | — | Semicolon-separated short labels of all engines |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

### Notes

* Returns the same information as [krn.EnumNameSpaces](krn.md#krn.EnumNameSpaces), but as a single semicolon-separated string instead of one parameter per engine.
* The list may end with a trailing semicolon; ignore empty substrings when splitting.
* Which engines are returned depends on the specific server installation and configuration and may differ between systems.

### Example

Request with `Flags` = `0`. Returned output parameter (return value `0`):

```text
Namespaces = abn;adm;ado;cnv;dbp;dms;dtr;krn;kts;lic;mng;std;tst;vtx;wfm;
```
See also: [krn.EnumNameSpaces](krn.md#krn.EnumNameSpaces)

<a id="krn.NameSpaceGetInfo"></a>

## krn.NameSpaceGetInfo

This job returns all information for the specified engine.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |
| `NameSpaces` | STRING | Yes | Short label of the engine |

### Output Parameters

| Name | Type | Dependency | Description |
|---|---|---|---|
| `NameSpaceInfo` | STRING | — | MIME-encoded buffer with information about the engine |
| `NameSpaceInfoType` | STRING | — | Description of the data returned in `NameSpaceInfo` |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

<a id="krn.NameSpaceGetJobsInfo"></a>

## krn.NameSpaceGetJobsInfo

This job returns information (name, number of job calls etc.) about the jobs of the specified engine.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |
| `NameSpaces` | STRING | Yes | Short label of the engine |

### Output Parameters

| Name | Type | Dependency | Description |
|---|---|---|---|
| `NameSpaceInfo` | STRING | — | MIME-encoded buffer with information about the jobs |
| `NameSpaceInfoType` | STRING | — | Description of the data returned in `NameSpaceInfo` |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

<a id="krn.ProcessGetInformation"></a>

## krn.ProcessGetInformation

This job determines Windows performance counters with information about the kernel process.
Only information from the server on which the current session is logged in is determined.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | `0` or `1` = information is returned in binary form (for monitor and enaio® enterprise-manager) +<br>`2` = information is returned in text form and logged to channel 11 |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

<a id="krn.QueueEnum"></a>

## krn.QueueEnum

This job creates a list with the names of the existing queues.
Typical queues are: `common`, `dbpipe`, `ocr`, `workflow`, `redir`.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |

### Output Parameters

| Name | Type | Dependency | Description |
|---|---|---|---|
| `Queue[1..n]` | STRING | — | Name of the respective queue |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

See also: [krn.QueueGetParams](krn.md#krn.QueueGetParams), [krn.QueueGetStatistic](krn.md#krn.QueueGetStatistic)

<a id="krn.QueueGetParams"></a>

## krn.QueueGetParams

This job returns the parameters of a specified queue.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |
| `Queue` | STRING | Yes | Name of the queue |

### Output Parameters

| Name | Type | Dependency | Description |
|---|---|---|---|
| `NumThreads` | INT | — | Number of threads |
| `Priority` | INT | — | Priority: `0` = low; `1` = normal; `2` = high |
| `MaxQueueSize` | INT | — | Maximum number of jobs that can be accepted |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

See also: [krn.QueueEnum](krn.md#krn.QueueEnum), [krn.QueueGetStatistic](krn.md#krn.QueueGetStatistic)

<a id="krn.QueueGetStatistic"></a>

## krn.QueueGetStatistic

This job returns statistical information about a specified queue.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |
| `Queue` | STRING | Yes | Name of the queue |

### Output Parameters

| Name | Type | Dependency | Description |
|---|---|---|---|
| `JobsPosted` | INT | — | Number of sent jobs |
| `JobsWaiting` | INT | — | Number of waiting jobs |
| `LastPop` | STRING | — | Time of last pop |
| `LastPush` | STRING | — | Time of last push |
| `NameSpaces` | STRING | — | Semicolon-separated engines that use this queue |
| `Threads` | STRING | — | Semicolon-separated threads of this queue |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

See also: [krn.QueueEnum](krn.md#krn.QueueEnum)

<a id="krn.REBackup"></a>

## krn.REBackup

This job creates a backup in XML format of the current registry schema.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |
| `FileName` | STRING | Yes | Name of the target file including path (file extension should be `.xml`) |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

<a id="krn.REGetCurrentSchema"></a>

## krn.REGetCurrentSchema

This job returns the current registry schema in XML notation.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |

### Output Parameters

| Name | Type | Dependency | Description |
|---|---|---|---|
| `Schema` | STRING | — | Current schema in XML notation |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

<a id="krn.REGetRegValue"></a>

## krn.REGetRegValue

This job returns the value of a specified registry entry.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |
| `Name` | STRING | Yes | Name of the registry entry |

### Output Parameters

| Name | Type | Dependency | Description |
|---|---|---|---|
| `Value` | STRING | — | Value of the registry entry |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

See also: [krn.RESetRegValue](krn.md#krn.RESetRegValue)

<a id="krn.REGetRegValues"></a>

## krn.REGetRegValues

This job returns all values for a specified registry key and optionally additionally the values of all subordinate registry keys.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | `0` = returns only the values for the specified registry key +<br>`1` = additionally recursively returns the values of all subordinate registry keys |
| `Path` | STRING | Yes | Name of the registry key, e.g. `Services\Fulltext` |

### Output Parameters

| Name | Type | Dependency | Description |
|---|---|---|---|
| `Values` | STRING | — | Tree of the requested registry keys with their values |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

<a id="krn.RELoad"></a>

## krn.RELoad

This job loads the current registry schema into memory.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

<a id="krn.RESave"></a>

## krn.RESave

This job saves the current registry schema.

The registry key is: +
`HKLM\SOFTWARE\OPTIMAL SYSTEMS\[Service name]\Schemata\[Version number]`

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

<a id="krn.RESetRegValue"></a>

## krn.RESetRegValue

This job changes the value of the specified registry entry.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |
| `Name` | STRING | Yes | Name of the registry entry |
| `Value` | STRING | Yes | Value of the registry entry |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

See also: [krn.REGetRegValue](krn.md#krn.REGetRegValue), [krn.RESave](krn.md#krn.RESave)

<a id="krn.RefillServerList"></a>

## krn.RefillServerList

This job loads server information from the DB tables `ospingtable` and `sever` into memory.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

<a id="krn.ReloadExecutor"></a>

## krn.ReloadExecutor

This job reloads an executor.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |
| `Name` | STRING | Yes | Engine to be reloaded |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

<a id="krn.RunScript"></a>

## krn.RunScript

Executes a VBScript or JavaScript on the server. The script text is determined in the following order: parameter `Script`, parameter `ScriptFile`, file list.

If the script is empty and only parameters are passed, only the server-side before/after events are triggered.

This is a generic job: any input parameters can be passed and the server can return any output parameters and files.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |
| `Script` | STRING | Yes | Script text to execute. Can be empty if `ScriptFile` or the file list is used, or if only events should be triggered. |
| `CtxName` | STRING | Yes | Context name. Empty = default name is used. |
| `GUI` | BOOLEAN | Yes | `true` = `MsgBox` may be called from the script (depends on server environment). `false` = not allowed. |
| `Eval` | BOOLEAN | Yes | `true` = the script text is evaluated as an expression (Eval). `false` = the script text is executed as a function block (Exec). |
| `[IsJS]` | BOOLEAN | No | `true` = JavaScript execution. `false` or not specified = VBScript execution. |
| `[Main]` | STRING | No | Name of the entry point function. Default: `Main`. |
| `[ScriptFile]` | STRING | No | Name of a script file in the `scripts` subdirectory of the server configuration. Used when `Script` is empty. |
| `[ScriptName]` | STRING | No | Name of the script for debugging purposes. |
| `[InspectorEnabled]` | INT | No | V8 inspector control (JavaScript only). `0` = disabled, `1` = enabled, `-1` = controlled by `oxv8.metadata.cfg` (default behavior when not specified). |
| _any_ | _any_ | No | All additional parameters are forwarded as input parameters to the job and the server-side events. |

### Input Files

Any files can be passed. The script or the server-side events can process them and return custom files in the response.

### Output Parameters

| Name | Type | Description |
|---|---|---|
| `$ScriptResult$` | _variable_ | Return value of the script. The type depends on the script (`INT`, `STRING`, `FLOAT`, `BOOLEAN`, etc.). Not always present. |
| _any_ | _any_ | The script and the server-side events can set any additional output parameters. |

### Eval and Exec

**Exec mode** (`Eval=false`): The script is executed as a function block. The return value of the entry point function (default: `Main`) is returned as `$ScriptResult$`.

```vbscript
Function Main()
    Main = 42
End Function
```
**Eval mode** (`Eval=true`): The script text is evaluated as an expression. The result is returned as `$ScriptResult$`.

### Return Value

`(INT)`: `0` = Job successful, otherwise error code +
[Complete list of error codes](errorcodes.md)

> **Tip:** If all logic resides in server-side before/after events and no script text is needed, prefer using [krn.EmptyJob](krn.md#krn.EmptyJob) instead.

### Required System Role

====
This job may only be executed by a user who holds system role `109` (**Server: Execute script**, `R_SRV_SCRIPT_JOB`). If this role is missing, the call is rejected with the error code `31523546`; the associated error text reads:

```text
Job <krn.RunScript> can only be executed by a user who owns the system roles [R_SRV_SCRIPT_JOB(109)].
```
An overview of all system roles is available under [System Roles](mng.md); see also [Error Codes](errorcodes.md).
====

### See Also

[krn.EmptyJob](krn.md#krn.EmptyJob) — Generic job without script execution, controlled only via events.

<a id="krn.SendAdminMail"></a>

## krn.SendAdminMail

This job sends an email to the predefined administrator.

> **Note:** In the registry, under `HKLM\Software\Optimal Systems\[Application Server Name]\Schemata` at least `Mailserver` (SMTP IP address) and `AdminMail` (email address) must be set. The passed file list is attached as an attachment to the email.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |
| `Sender` | STRING | Yes | Name of the sender |
| `Subject` | STRING | Yes | Subject line of the email |
| `Text` | STRING | Yes | Text content of the email |

### Input Files

| Name | Description |
|---|---|
| `[File list]` | Files to be sent as email attachments |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

<a id="krn.SendMail"></a>

## krn.SendMail

This job sends an email to a recipient identified by email address.

> **Note:** In the registry, under `HKLM\Software\Optimal Systems\[Application Server Name]\Schemata` at least the entry `Mailserver` (SMTP IP address) must be set.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |
| `Receiver` | STRING | Yes | Email address of the recipient |
| `Sender` | STRING | Yes | Name of the sender |
| `Subject` | STRING | Yes | Subject line of the email |
| `Text` | STRING | Yes | Text content of the email |
| `[FileNamePrefix]` | STRING | No | Prefix for names of attachment files. A file `XYZ.abc` will be renamed to `<Prefix>.XYZ.abc`. |

### Input Files

| Name | Description |
|---|---|
| `[File list]` | Files to be sent as email attachments |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

<a id="krn.SendMessageToClients"></a>

## krn.SendMessageToClients

This job sends a message to one or all connected clients.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |
| `Computer` | STRING | Yes | Empty = notify all computers; otherwise: name of the computer |
| `Instance` | STRING | Yes | Name of the program |
| `User` | STRING | Yes | Name of the user to be notified |
| `Message` | STRING | Yes | Type of message |
| `Info` | STRING | Yes | Message text (programmatic message) |
| `Text` | STRING | Yes | Message text for the user (e.g. for MessageBox) |
| `Broadcast` | INT | Yes | `3` = message is sent via all server groups in multi-server systems to users logged in there |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

<a id="krn.SessionAttach"></a>

## krn.SessionAttach

This job creates a new work session with the application server or resumes an existing work session.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |
| `SessionGUID` | STRING | Yes | GUID of the session to be continued; empty = new session is created |

### Output Parameters

| Name | Type | Dependency | Description |
|---|---|---|---|
| `SessionGUID` | STRING | — | GUID of the new or existing session |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

<a id="krn.SessionChangePassword"></a>

## krn.SessionChangePassword

This job changes the password of the user currently logged into the working session.
Unlike [mng.SetUserAttributes](mng.md#mng.SetUserAttributes), the user must know the old password — the call is therefore suited for "self-service" password changes in the client.

====
This job is not listed in the official enaio® kernel engine overview. This description was reconstructed from the call code of the `enaio-jobs-custom` template.
====

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Reserved; always pass `0`. |
| `OldPassword` | STRING | Yes | Current password as encoded hash (see [krn.SessionLogin](krn.md#krn.SessionLogin)/`UserPwd` for the hash computation). |
| `NewPassword` | STRING | Yes | New password as encoded hash. |

### Return Value

`(INT)`: `0` = job successful, otherwise error code (e.g. when `OldPassword` is wrong).

### See Also

* [krn.VerifyPassword](krn.md#krn.VerifyPassword) — verifies a password against the stored hash without changing it
* [mng.SetUserAttributes](mng.md#mng.SetUserAttributes) — administrative password change without knowledge of the old password

<a id="krn.SessionDeleteLost"></a>

## krn.SessionDeleteLost

This job deletes all sessions from the database that are no longer online.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | `1` = parameter `AgeHours` is observed; `0` = ignored |
| `AgeHours` | INT | Yes | Minimum age of sessions in hours, from which an offline session is deleted |

### Output Parameters

| Name | Type | Dependency | Description |
|---|---|---|---|
| `DeletedSessions` | STRING | — | IDs of deleted sessions |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

<a id="krn.SessionDrop"></a>

## krn.SessionDrop

This job deletes the specified work session.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |
| `SessionGUID` | STRING | Yes | ID of the work session |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

<a id="krn.SessionDropDB"></a>

## krn.SessionDropDB

This job deletes all entries for the work session in the database (tables `oslockedres`, `ossession`).

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |
| `SessionGUID` | STRING | Yes | ID of the work session |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

<a id="krn.SessionEnum"></a>

## krn.SessionEnum

This job returns a list of all existing work sessions for the server.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |

### Output Parameters

| Name | Type | Dependency | Description |
|---|---|---|---|
| `Sessions` | STRING | — | Semicolon-separated list of GUIDs of all existing work sessions |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

<a id="krn.SessionEnumDB"></a>

## krn.SessionEnumDB

This job returns a list of all database entries for work sessions.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |

### Output Parameters

| Name | Type | Dependency | Description |
|---|---|---|---|
| `SessionInfoType` | STRING | — | Description of the data returned in parameter `Sessions` |
| `Sessions` | STRING | — | MIME-encoded buffer with information about work sessions |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

<a id="krn.SessionEnumResourcesDB"></a>

## krn.SessionEnumResourcesDB

This job returns all resources used by the specified work session that are stored in the database.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |
| `SessionGUID` | STRING | Yes | ID of the work session |

### Output Parameters

| Name | Type | Dependency | Description |
|---|---|---|---|
| `Resources` | STRING | — | Semicolon-separated resources in the format `GUID1=Locktime1,Name1;GUID2=Locktime2,Name2;...`: +<br>Resource ID; Lock time; Short resource designation |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

See also: [krn.SessionEnum](krn.md#krn.SessionEnum)

<a id="krn.SessionGetInfo"></a>

## krn.SessionGetInfo

This job returns information about the specified work sessions on the server.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |
| `Sessions` | STRING | Yes | Semicolon-separated IDs of work sessions |

### Output Parameters

| Name | Type | Dependency | Description |
|---|---|---|---|
| `SessionInfoType` | STRING | — | Labels of the information returned in parameter `SessionInfo` |
| `ConnectionInfoType` | STRING | — | Labels of connection information returned in parameter `SessionInfo` |
| `SessionInfo` | STRING | — | MIME-encoded buffer with session information |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

<a id="krn.SessionLogin"></a>

## krn.SessionLogin

This job logs a user into the active session.
The user is identified by name and encrypted password.

> **Note:** For password encryption, please contact Optimal Systems GmbH.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |
| `UserName` | STRING | Yes | Login name of the user |
| `UserPwd` | STRING | Yes | Encrypted password |
| `[EntMgr]` | LONG | No | Only to be set at Enterprise Manager start. |

### Output Parameters

| Name | Type | Dependency | Description |
|---|---|---|---|
| `Description` | STRING | Optional | Description if an error occurs |
| `Action` | STRING | — | Action that was executed |
| `[UserGUID]` | STRING | Optional | GUID of the logged-in user (only for Enterprise Manager) |
| `[UserID]` | INT | Optional | ID of the logged-in user (only for Enterprise Manager) |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

See also: [krn.SessionAttach](krn.md#krn.SessionAttach), [krn.SessionLogout](krn.md#krn.SessionLogout), [krn.SessionPropertiesSet](krn.md#krn.SessionPropertiesSet)

<a id="krn.SessionLogout"></a>

## krn.SessionLogout

This job ends the use of the active session.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

<a id="krn.SessionPropertiesEnum"></a>

## krn.SessionPropertiesEnum

This job returns the names of all properties of a work session with the server.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |

### Output Parameters

| Name | Type | Dependency | Description |
|---|---|---|---|
| `Names` | STRING | — | Semicolon-separated properties for a work session |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

<a id="krn.SessionPropertiesGet"></a>

## krn.SessionPropertiesGet

This job returns the specified properties of a work session.

> **Note:** Possible properties: `address` (address of the application server), `sessguid` (session GUID), `statname` (computer name of the work station), `instname` (instance name), `statguid` (work station GUID), `userguid` (user GUID), `hasserveraccount`, `loggedin`, `haschannel`, `autologin`, `supervisor` (supervisor name), `langid` (language ID), `changepwd` (whether password must be changed before other jobs can be called).

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |
| `Properties` | STRING | Yes | Semicolon-separated properties to be displayed.<br>For each specified property, an output parameter is generated. |
| `SessionGUID` | STRING | Yes | GUID of the work session |

### Output Parameters

The output parameters are determined by the input parameter `Properties`.

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

See also: [krn.SessionPropertiesSet](krn.md#krn.SessionPropertiesSet), [krn.SessionPropertiesEnum](krn.md#krn.SessionPropertiesEnum)

<a id="krn.SessionPropertiesSet"></a>

## krn.SessionPropertiesSet

This job sets the specified properties of a session.

> **Note:** Settable properties (excerpt): `address` (client address), `sessguid`, `statname`, `instname`, `statguid`, `userguid`, `hasserveraccount`, `loggedin`, `haschannel`, `autologin`, `supervisor`, `langid`.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |
| `Properties` | STRING | Yes | Semicolon-separated properties to be set.<br>For each specified property, a corresponding input parameter is expected. |
| `[Propertyname]` | STRING | No | Property value (one parameter for each property specified in `Properties`) |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

See also: [krn.SessionPropertiesGet](krn.md#krn.SessionPropertiesGet), [krn.SessionPropertiesEnum](krn.md#krn.SessionPropertiesEnum)

<a id="krn.ShutDown"></a>

## krn.ShutDown

This job shuts down the server.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

<a id="krn.UnloadExecutor"></a>

## krn.UnloadExecutor

This job removes a specified engine (executor) from the server.

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |
| `Name` | STRING | Yes | Engine to be deleted |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

<a id="krn.UserSessionCreate"></a>

## krn.UserSessionCreate

This job creates a user work session for a B2B connection.
A B2B connection exists between two servers (e.g. DRT server and Java server).

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |

### Output Parameters

| Name | Type | Dependency | Description |
|---|---|---|---|
| `SessionGUID` | STRING | — | ID of the work session |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

See also: [krn.UserSessionDelete](krn.md#krn.UserSessionDelete)

<a id="krn.UserSessionDelete"></a>

## krn.UserSessionDelete

This job deletes a user work session for a B2B connection.
A B2B connection exists between two servers (e.g. DRT server and Java server).

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Currently not supported — pass `0`. |
| `SessionGUID` | STRING | Yes | ID of the work session |

### Return Value

`(INT)`: `0` = Job successful, otherwise error code.

See also: [krn.UserSessionCreate](krn.md#krn.UserSessionCreate)

<a id="krn.VerifyPassword"></a>

## krn.VerifyPassword

This job verifies whether a given password matches the stored password of the currently logged-in user — without changing it.
Typically used as a "confirmation before a sensitive action" (step-up authentication).

====
This job is not listed in the official enaio® kernel engine overview. This description was reconstructed from the call code of the `enaio-jobs-custom` template.
====

### Input Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Flags` | INT | Yes | Reserved; always pass `0`. |
| `Password` | STRING | Yes | Password to verify, as encoded hash (same format as [krn.SessionLogin](krn.md#krn.SessionLogin)/`UserPwd`). |

### Output Parameters

| Name | Type | Dependency | Description |
|---|---|---|---|
| `Matches` | BOOL | — | `true` if `Password` matches the stored password. |

### Return Value

`(INT)`: `0` = job successful (also when `Matches=false`), otherwise error code.

### See Also

* [krn.SessionChangePassword](krn.md#krn.SessionChangePassword) — change the password (with confirmation of the old password)
* [krn.SessionLogin](krn.md#krn.SessionLogin) — initial login with password verification
