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.

CLProgram()

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.

void AddLibLEntry(string libraryName)

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.

void AddLibLEntry(string libraryName, LiblPosition position, string referenceLibraryName)

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.

void AddLogicalFileMember(string file, string member, String[] dataMembers, string text)

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.

void AddMsgToIgnore(Type exceptionType)

Add an exception to the list of exceptions to ignore.

void AddMsgToIgnore(Type exceptionType)

Parameters

Type Parameter name Description
Type exceptionType Excption to ignore.

void AddPFM(string File, string Mbr, string Text, string srcType)

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.

string Asterisk_BCat(string prefix, string suffix)

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.

string Asterisk_TCat(string prefix, string suffix)

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.

void ChangeDataArea(string dataArea, string newValue)

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.

void ChangeDataArea(string dataArea, int start, int length, string newValue)

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.

void ChangeDataArea(string dataArea, decimal newValue)

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.

void ChangeDataArea(string dataArea, bool newValue)

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.

void ChangeFileMemberText(string File, string Mbr, string NewText)

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.

void ClearPFM(string File, string Mbr)

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.

string ConvertDate(string date, string fromDateFormat, string toDateFmt, string toDateSep)

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.

void CreateDataArea(string library, string dataAreaName, int len, string initValue, string text)

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.

void CreateDecDataArea(string library, string dataAreaName, int len, int decimals, decimal initValue, string text)

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.

void CreateDuplicateFile(string FromLibrary, string FileName, string ToLibrary, string NewName, bool CopyData)

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.

void CreateLglDataArea(string library, string dataAreaName, char initValue, string text)

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.

bool DataAreaExists(string library, string dataArea)

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.

void DelayJob_ResumeTime(string hhmmss)

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.

void DelayJob_Seconds(decimal seconds)

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.

void DelayJob_Seconds(ulong seconds)

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.

void DeleteDataArea(string dataArea)

Delete an existing data area.

void DeleteDataArea(string dataArea)

Parameters

Type Parameter name Description
String dataArea The qualified path to the data area.

void DeleteFile(string FilePath)

Delete a file database or printer file.

void DeleteFile(string FilePath)

Parameters

Type Parameter name Description
String FilePath Qualified file name (library/file).

void DeleteOverride(string fileName, OverrideScope scope)

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.

bool FileExists(string FilePath)

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.

void InitializePFM(string File, string Mbr, InitializePFMOption Records, int TotRcds)

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.

void InitializePFM(string File, string Mbr, int TotRcds)

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.

bool LibraryExists(string LibraryName)

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.

bool MemberExists(string FilePath, string MemberName)

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

void OverrideFile(string fileName, OverrideOption option, object newValue, OverrideScope scope)

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.

void Percent_SST(String& receiver, int start, int length, string value)

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”.

void RemoveMember(string File, string Mbr)

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.

void RenameDataArea(string dataAreaName, string newName)

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.

void RenameFile(string fileName, string newFileName)

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.

void RenameFileMember(string File, string Mbr, string NewName)

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()

string RetrieveDataArea(string dataArea)

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.

string RetrieveDataArea(string dataArea, int start, int length)

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.

string RetrieveJobAttribute(JobStringAttribute jobAttribute)

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.

decimal RetrieveMemberDescription(string File, string Mbr, MemberDecimalDescription DescriptionAttribute)

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.

string RetrieveMemberDescription(string File, string Mbr, MemberStringDescription DescriptionAttribute)

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.

string RetrieveMessage(string MsgId, string MsgFile, string MsgData)

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.

void RmvLibLEntry(string libraryName)

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.

void SetAttentionProgram(bool invokeProgram)

Enables or disables the current Attention Program.

void SetAttentionProgram(bool invokeProgram)

Parameters

Type Parameter name Description
Boolean invokeProgram true to enable; otherwise, false.

void SetAttentionProgram(string assemblyName, string programName, bool invokeProgram)

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.

string splitQualifiedNameForInput(string qualifiedName, String& library, String& objectName)

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.

string splitQualifiedNameForOutput(string qualifiedName, String& library, String& objectName)

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.

bool TryAddLibLEntry(string libraryName)

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.

bool TryAddLibLEntry(string libraryName, LiblPosition position, string referenceLibraryName)

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.