CLProgram class | QSYS API Reference Guide
Estimated reading time: 32 minutes
Defines the core behavior of programs migrated from CL program .
Namespace: ASNA.QSys.Runtime.JobSupport
Assembly: ASNA.QSys.Runtime.dll
Inheritance: Object –> Module –> CommonProgram –> Program
Constructors
Name |
Description |
CLProgram() |
Initializes a new instance of the CLProgram class. |
CLProgram()
Initializes a new instance of the CLProgram class.
Properties
Type |
Name |
Description |
List<Type> |
exceptionToIgnoreList |
List of exceptions to ignore on certain commands. |
Methods
Signature |
Description |
AddLibLEntry(String) |
Adds a library name to the start of the user portion of library list. |
AddLibLEntry(String, LiblPosition, String) |
Adds a library name at a particular position in the user portion of the library list. |
AddLogicalFileMember(String, String, String[], String) |
Adds a member to a logical file. |
AddMsgToIgnore(Type) |
Add an exception to the list of exceptions to ignore. |
AddPFM(String, String, String, String) |
Add a member to a physical file. |
Asterisk_BCat(String, String) |
Concatenates two strings, trimming the end of the first string and adding a blank between the two strings. |
Asterisk_TCat(String, String) |
Concatenates two strings trimming all blanks from the first string. |
ChangeDataArea(String, String) |
Update the contents of a character data area. |
ChangeDataArea(String, Int32, Int32, String) |
Update a portion of a character data area. |
ChangeDataArea(String, Decimal) |
Update the contents of a decimal data area. |
ChangeDataArea(String, Boolean) |
Update the contents of a logical data area. |
ChangeFileMemberText(String, String, String) |
Change the Text attribute of a file member. |
ClearPFM(String, String) |
Remove all records from a file’s member. |
ConvertDate(String, String, String, String) |
Converts a string representing a date in one format to a string with the date formatted in another format. |
CreateDataArea(String, String, Int32, String, String) |
Create a new character data area. |
CreateDecDataArea(String, String, Int32, Int32, Decimal, String) |
Create a new decimal data area. |
CreateDuplicateFile(String, String, String, String, Boolean) |
Create a copy of an existing file. |
CreateLglDataArea(String, String, Char, String) |
Create a logical data area capable of holding a value of ‘1’ or ‘0’. |
DataAreaExists(String, String) |
Check for existence of a data area. |
DelayJob_ResumeTime(String) |
Suspends the execution on the job until a specific time in the future. |
DelayJob_Seconds(Decimal) |
Suspends the execution on the job for the specified time. |
DelayJob_Seconds(UInt64) |
Suspends the execution on the job for the specified time. |
DelayJob_Seconds(Int32) |
Suspends the execution on the job for the specified time. |
DeleteDataArea(String) |
Delete an existing data area. |
DeleteFile(String) |
Delete a file database or printer file. |
DeleteOverride(String, OverrideScope) |
Removes a previous override for a file. |
FileExists(String) |
Test for the existence of a database or printer file. |
InitializePFM(String, String, InitializePFMOption, Int32) |
Initialize records in a physical file member. |
InitializePFM(String, String, Int32) |
Initialize a physical file member with records containing their field’s default values. |
LibraryExists(String) |
Test for the existence of a database library. |
MemberExists(String, String) |
Test for the existence of a database file’s member. |
OverrideFile(String, OverrideOption, Object, OverrideScope) |
Temporary overrides (replaces) a file name, its location or some other parameter used when a program opens the file. |
Percent_SST(String&, Int32, Int32, String) |
Retrieves a substring. The substring starts at a specified position and has a specified length. |
Percent_Switch(String) |
Tests the current state of the job’s switches. |
RemoveMember(String, String) |
Delete a member from a database file. |
RenameDataArea(String, String) |
Rename a data area. |
RenameFile(String, String) |
Rename a database or printer file. |
RenameFileMember(String, String, String) |
Change the Name of a file member. |
ResetAttentionProgram() |
Resets the attention program settings to the previous invocation level. |
RetrieveDataArea(String) |
Gets the value of a data area. |
RetrieveDataArea(String, Int32, Int32) |
Gets a portion of a data area. |
RetrieveJobAttribute(JobStringAttribute) |
Gets an attribute of the current job. |
RetrieveMemberDescription(String, String, MemberDecimalDescription) |
Gets a numeric attribute of a file member. |
RetrieveMemberDescription(String, String, MemberStringDescription) |
Gets a string attribute of a file member. |
RetrieveMessage(String, String, String) |
Produces the strings with the formatted first and second level text for a message. Any placeholders are replaced with values from the message data. |
RmvLibLEntry(String) |
Removes a library name from the user portion of the library list. |
SetAttentionProgram(Boolean) |
Enables or disables the current Attention Program. |
SetAttentionProgram(String, String, Boolean) |
Sets the attention program to be be called when the Attention Key is ‘pressed’ |
splitQualifiedNameForInput(String, String&, String&) |
Separate the name components of a qualified name. |
splitQualifiedNameForOutput(String, String&, String&) |
Separate the name components of a qualified name. |
TryAddLibLEntry(String) |
Attempts to add a library name to the start of the user portion of library list. |
TryAddLibLEntry(String, LiblPosition, String) |
Attempts to add a library name at a particular position in the user portion of the library list. |
Adds a library name to the start of the user portion of library list.
void AddLibLEntry(string libraryName)
Parameters
Type |
Parameter name |
Description |
String |
libraryName |
The name of the library. |
Adds a library name at a particular position in the user portion of the library list.
void AddLibLEntry(string libraryName, LiblPosition position, string referenceLibraryName)
Parameters
Type |
Parameter name |
Description |
String |
libraryName |
The name of the library. |
LiblPosition |
position |
One of the enumeration values that specifies the position where to add the name. May be absolute or relative. |
String |
referenceLibraryName |
For relative position values it specifies the refererence point. |
Adds a member to a logical file.
void AddLogicalFileMember(string file, string member, String[] dataMembers, string text)
Parameters
Type |
Parameter name |
Description |
String |
file |
The name of logical file. |
String |
member |
The name of the new file’s member. |
String[] |
dataMembers |
An array of the physical file members with the data of the new logical member. |
String |
text |
The text description of the new member. |
Add an exception to the list of exceptions to ignore.
void AddMsgToIgnore(Type exceptionType)
Parameters
Type |
Parameter name |
Description |
Type |
exceptionType |
Excption to ignore. |
Add a member to a physical file.
void AddPFM(string File, string Mbr, string Text, string srcType)
Parameters
Type |
Parameter name |
Description |
String |
File |
Qualified file name (library/file). |
String |
Mbr |
New member name to add. |
String |
Text |
The text description of the new member. |
String |
srcType |
Content type for members of source files. |
Concatenates two strings, trimming the end of the first string and adding a blank between the two strings.
string Asterisk_BCat(string prefix, string suffix)
Parameters
Type |
Parameter name |
Description |
String |
prefix |
The first part of the new string. |
String |
suffix |
The last part of the new string. |
Returns
Type |
Description |
String |
The concatenation of the two string. |
Concatenates two strings trimming all blanks from the first string.
string Asterisk_TCat(string prefix, string suffix)
Parameters
Type |
Parameter name |
Description |
String |
prefix |
The first part of the new string. |
String |
suffix |
The last part of the new string. |
Returns
Type |
Description |
String |
The concatenation of the two string. |
Update the contents of a character data area.
void ChangeDataArea(string dataArea, string newValue)
Parameters
Type |
Parameter name |
Description |
String |
dataArea |
Path to the data area. |
String |
newValue |
New value of the character data area. |
Update a portion of a character data area.
void ChangeDataArea(string dataArea, int start, int length, string newValue)
Parameters
Type |
Parameter name |
Description |
String |
dataArea |
Path to the data area. |
Int32 |
start |
The one-base index to the first character to start updating. |
Int32 |
length |
The length of the value to modify. |
String |
newValue |
New value of the character data area. |
Update the contents of a decimal data area.
void ChangeDataArea(string dataArea, decimal newValue)
Parameters
Type |
Parameter name |
Description |
String |
dataArea |
Path to the data area. |
Decimal |
newValue |
New value of the decimal data area. |
Update the contents of a logical data area.
void ChangeDataArea(string dataArea, bool newValue)
Parameters
Type |
Parameter name |
Description |
String |
dataArea |
Path to the data area. |
Boolean |
newValue |
New value of the logical data area. |
Change the Text attribute of a file member.
void ChangeFileMemberText(string File, string Mbr, string NewText)
Parameters
Type |
Parameter name |
Description |
String |
File |
Qualified file name (library/file). |
String |
Mbr |
Name of member. |
String |
NewText |
New Text. |
Remove all records from a file’s member.
void ClearPFM(string File, string Mbr)
Parameters
Type |
Parameter name |
Description |
String |
File |
Qualified file name (library/file). |
String |
Mbr |
Name of member to be cleared. |
Converts a string representing a date in one format to a string with the date formatted in another format.
string ConvertDate(string date, string fromDateFormat, string toDateFmt, string toDateSep)
Parameters
Type |
Parameter name |
Description |
String |
date |
The input string date to convert. |
String |
fromDateFormat |
The format in the input string. Defaults to “*JOB”. |
String |
toDateFmt |
The desired format on the output string. Defaults to “*JOB”. |
String |
toDateSep |
The character to use as the separator in output string. Defaults to “*JOB”. |
Returns
Type |
Description |
String |
The date in the desired format. |
Create a new character data area.
void CreateDataArea(string library, string dataAreaName, int len, string initValue, string text)
Parameters
Type |
Parameter name |
Description |
String |
library |
The name of the library that will contain the new data area. |
String |
dataAreaName |
The name of the new data area. |
Int32 |
len |
The length of the data area. |
String |
initValue |
The initial value of the data area. |
String |
text |
The text describing the data area. |
Create a new decimal data area.
void CreateDecDataArea(string library, string dataAreaName, int len, int decimals, decimal initValue, string text)
Parameters
Type |
Parameter name |
Description |
String |
library |
The name of the library that will contain the new data area. |
String |
dataAreaName |
The name of the new data area. |
Int32 |
len |
The number of digits that the data area values can have. |
Int32 |
decimals |
The number of decimal digit for the data area value. |
Decimal |
initValue |
The initial value of the data area. |
String |
text |
The text describing the data area. |
Create a copy of an existing file.
void CreateDuplicateFile(string FromLibrary, string FileName, string ToLibrary, string NewName, bool CopyData)
Parameters
Type |
Parameter name |
Description |
String |
FromLibrary |
The library name of the existing file. |
String |
FileName |
The name of the existing file. |
String |
ToLibrary |
The library name where the new file will be. |
String |
NewName |
The name of the new file. |
Boolean |
CopyData |
true to copy the records of the existing file to the new file; otherwise, false. |
Create a logical data area capable of holding a value of ‘1’ or ‘0’.
void CreateLglDataArea(string library, string dataAreaName, char initValue, string text)
Parameters
Type |
Parameter name |
Description |
String |
library |
The name of the library that will contain the new data area. |
String |
dataAreaName |
The name of the new data area. |
Char |
initValue |
The initial value of the data area. |
String |
text |
The text describing the data area. |
Check for existence of a data area.
bool DataAreaExists(string library, string dataArea)
Parameters
Type |
Parameter name |
Description |
String |
library |
The library where the data area may be located. |
String |
dataArea |
The name of the data area. |
Returns
Type |
Description |
Boolean |
true if the data area exists; otherwise false. |
Suspends the execution on the job until a specific time in the future.
void DelayJob_ResumeTime(string hhmmss)
Parameters
Type |
Parameter name |
Description |
String |
hhmmss |
The future time of day to resume execution. The clock format is two digits for each of: hour, minute, second. |
Suspends the execution on the job for the specified time.
void DelayJob_Seconds(decimal seconds)
Parameters
Type |
Parameter name |
Description |
Decimal |
seconds |
The amount of seconds to sleep. |
Suspends the execution on the job for the specified time.
void DelayJob_Seconds(ulong seconds)
Parameters
Type |
Parameter name |
Description |
UInt64 |
seconds |
The amount of seconds to sleep. |
void DelayJob_Seconds(int seconds)
Suspends the execution on the job for the specified time.
void DelayJob_Seconds(int seconds)
Parameters
Type |
Parameter name |
Description |
Int32 |
seconds |
The amount of seconds to sleep. |
Delete an existing data area.
void DeleteDataArea(string dataArea)
Parameters
Type |
Parameter name |
Description |
String |
dataArea |
The qualified path to the data area. |
Delete a file database or printer file.
void DeleteFile(string FilePath)
Parameters
Type |
Parameter name |
Description |
String |
FilePath |
Qualified file name (library/file). |
Removes a previous override for a file.
void DeleteOverride(string fileName, OverrideScope scope)
Parameters
Type |
Parameter name |
Description |
String |
fileName |
The simple file name used by programs. |
OverrideScope |
scope |
One of the enumeration values that specifies the scope of the override. If not given CallLvl is used. |
Test for the existence of a database or printer file.
bool FileExists(string FilePath)
Parameters
Type |
Parameter name |
Description |
String |
FilePath |
Qualified file name (library/file). |
Returns
Type |
Description |
Boolean |
true if the file exists; otherwise, false. |
Initialize records in a physical file member.
void InitializePFM(string File, string Mbr, InitializePFMOption Records, int TotRcds)
Parameters
Type |
Parameter name |
Description |
String |
File |
Qualified file name (library/file). |
String |
Mbr |
Name of member to be initialized. |
InitializePFMOption |
Records |
One of enumeration values that specifies the type of data to include in the new records. |
Int32 |
TotRcds |
The number of records the member should contain when the operation ends. |
Initialize a physical file member with records containing their field’s default values.
void InitializePFM(string File, string Mbr, int TotRcds)
Parameters
Type |
Parameter name |
Description |
String |
File |
Qualified file name (library/file). |
String |
Mbr |
Name of member to be initialized. |
Int32 |
TotRcds |
The number of records the member should contain when the operation ends. |
Test for the existence of a database library.
bool LibraryExists(string LibraryName)
Parameters
Type |
Parameter name |
Description |
String |
LibraryName |
The name of the library being tested. |
Returns
Type |
Description |
Boolean |
true if the library exists; otherwise, false. |
Test for the existence of a database file’s member.
bool MemberExists(string FilePath, string MemberName)
Parameters
Type |
Parameter name |
Description |
String |
FilePath |
Qualified file name (library/file). |
String |
MemberName |
Member name or *FIRST |
Returns
Type |
Description |
Boolean |
True if the member exists, false otherwise |
Temporary overrides (replaces) a file name, its location or some other parameter used when a program opens the file.
void OverrideFile(string fileName, OverrideOption option, object newValue, OverrideScope scope)
Parameters
Type |
Parameter name |
Description |
String |
fileName |
The simple file name used by programs. |
OverrideOption |
option |
One of the enumeration values that specifies the parameter to override. |
Object |
newValue |
The value to use when the file is used. |
OverrideScope |
scope |
One of the enumeration values that specifies the scope of the override. If not given CallLvl is used. |
Retrieves a substring. The substring starts at a specified position and has a specified length.
void Percent_SST(String& receiver, int start, int length, string value)
Parameters
Type |
Parameter name |
Description |
String& |
receiver |
The receiver of the substring. |
Int32 |
start |
The one-based position of the substring start. |
Int32 |
length |
The length of the substring. |
String |
value |
The string containing the substring. |
string Percent_Switch(string mask)
Tests the current state of the job’s switches.
string Percent_Switch(string mask)
Parameters
Type |
Parameter name |
Description |
String |
mask |
A positional list of up to 8 ‘1’/’0’ values corresponding to the job’s switches to be tested. Use any other character, like an ‘X’, for switches to be ignored. |
Returns
Type |
Description |
String |
“1” if the switches match the mask; otherwise, “0”. |
Delete a member from a database file.
void RemoveMember(string File, string Mbr)
Parameters
Type |
Parameter name |
Description |
String |
File |
Qualified file name (library/file). |
String |
Mbr |
Name of member to remove. |
Rename a data area.
void RenameDataArea(string dataAreaName, string newName)
Parameters
Type |
Parameter name |
Description |
String |
dataAreaName |
Qualified data area name (library/dataarea). |
String |
newName |
New simple data area name. |
Rename a database or printer file.
void RenameFile(string fileName, string newFileName)
Parameters
Type |
Parameter name |
Description |
String |
fileName |
Qualified file name (library/file). |
String |
newFileName |
New simple file name. |
Change the Name of a file member.
void RenameFileMember(string File, string Mbr, string NewName)
Parameters
Type |
Parameter name |
Description |
String |
File |
Qualified file name (library/file). |
String |
Mbr |
Name of member. |
String |
NewName |
Member new name. |
void ResetAttentionProgram()
Resets the attention program settings to the previous invocation level.
void ResetAttentionProgram()
Gets the value of a data area.
string RetrieveDataArea(string dataArea)
Parameters
Type |
Parameter name |
Description |
String |
dataArea |
Path to the data area. |
Returns
Type |
Description |
String |
The value stored on the data area. |
Gets a portion of a data area.
string RetrieveDataArea(string dataArea, int start, int length)
Parameters
Type |
Parameter name |
Description |
String |
dataArea |
Path to the data area. |
Int32 |
start |
The one-base index to the first character to start updating. |
Int32 |
length |
The length of the value to modify. |
Returns
Type |
Description |
String |
The value stored on the data area portion. |
Gets an attribute of the current job.
string RetrieveJobAttribute(JobStringAttribute jobAttribute)
Parameters
Type |
Parameter name |
Description |
JobStringAttribute |
jobAttribute |
One of the enumeration values that specifes what attribute to retrieve. |
Returns
Type |
Description |
String |
The requested attributed. |
Gets a numeric attribute of a file member.
decimal RetrieveMemberDescription(string File, string Mbr, MemberDecimalDescription DescriptionAttribute)
Parameters
Type |
Parameter name |
Description |
String |
File |
The qualified name of the file. |
String |
Mbr |
The name of the member. |
MemberDecimalDescription |
DescriptionAttribute |
The requested description attribute. |
Returns
Type |
Description |
Decimal |
The value of the attribute requested. |
Gets a string attribute of a file member.
string RetrieveMemberDescription(string File, string Mbr, MemberStringDescription DescriptionAttribute)
Parameters
Type |
Parameter name |
Description |
String |
File |
The qualified name of the file. |
String |
Mbr |
The name of the member. |
MemberStringDescription |
DescriptionAttribute |
The requested description attribute. |
Returns
Type |
Description |
String |
The value of the attribute requested. |
Produces the strings with the formatted first and second level text for a message. Any placeholders are replaced with values from the message data.
string RetrieveMessage(string MsgId, string MsgFile, string MsgData)
Parameters
Type |
Parameter name |
Description |
String |
MsgFile |
The message file name where the message description is to be found. |
String |
MsgId |
The message identification. |
String |
MsgData |
The replacement text, if any, for the message placeholders. |
Returns
Type |
Description |
String |
The formatted first level text of the message. |
Removes a library name from the user portion of the library list.
void RmvLibLEntry(string libraryName)
Parameters
Type |
Parameter name |
Description |
String |
libraryName |
The name of the library to remove from the list. |
Enables or disables the current Attention Program.
void SetAttentionProgram(bool invokeProgram)
Parameters
Type |
Parameter name |
Description |
Boolean |
invokeProgram |
true to enable; otherwise, false. |
Sets the attention program to be be called when the Attention Key is ‘pressed’
void SetAttentionProgram(string assemblyName, string programName, bool invokeProgram)
Parameters
Type |
Parameter name |
Description |
String |
assemblyName |
Name of assembly that contains the program. |
String |
programName |
Qualified name of the class implementing the program logic. |
Boolean |
invokeProgram |
true to enable. |
Separate the name components of a qualified name.
string splitQualifiedNameForInput(string qualifiedName, String& library, String& objectName)
Parameters
Type |
Parameter name |
Description |
String |
qualifiedName |
Qualified name to dissect. |
String& |
library |
The library name. If there is no library component, “*LIBL” is returned. |
String& |
objectName |
The object name. |
Returns
Type |
Description |
String |
The fully qualified name. |
Separate the name components of a qualified name.
string splitQualifiedNameForOutput(string qualifiedName, String& library, String& objectName)
Parameters
Type |
Parameter name |
Description |
String |
qualifiedName |
Qualified name to dissect. |
String& |
library |
The library name. If there is no library component, “*CURLIB” is returned. |
String& |
objectName |
The object name. |
Returns
Type |
Description |
String |
The fully qualified name. |
Attempts to add a library name to the start of the user portion of library list.
bool TryAddLibLEntry(string libraryName)
Parameters
Type |
Parameter name |
Description |
String |
libraryName |
The name of the library. |
Returns
Type |
Description |
Boolean |
true if the library was added successfully; otherwise, false. |
Attempts to add a library name at a particular position in the user portion of the library list.
bool TryAddLibLEntry(string libraryName, LiblPosition position, string referenceLibraryName)
Parameters
Type |
Parameter name |
Description |
String |
libraryName |
The name of the library to add. |
LiblPosition |
position |
One of the enumeration values that specifies the position where to add the name. May be absolute or relative. |
String |
referenceLibraryName |
For name of the library to use as a reference point for relative position values. |
Returns
Type |
Description |
Boolean |
true if the library was added successfully; otherwise, false. |