BuiltInSupport class | QSYS API Reference Guide
Estimated reading time: 58 minutes
Contains static methods to perform certain RPG Built In functions.
Namespace: ASNA.QSys.Runtime Assembly: ASNA.QSys.Runtime.dll
Inheritance: Object
Properties
Type | Name | Description |
---|---|---|
Int32 | MaxDecimals | Maximum Decimals supported. |
Int32 | MaxIntegrals | Maximum Integrals supported. |
Methods
Signature | Description |
---|---|
BitOff(String, Byte) | Allows bits to be set off in the input b parameter based upon a mask specified in the mask parameter. |
BitOn(String, Byte) | Allows bits to be set on in the Target parameter based upon a mask specified in the Mask parameter. |
CompareStrings(String, String) | Compares two specified string objects using RPG semantics and returns an integer that indicates their relative position in the sort order.If necessary, one of the strings is padded with blanks to make both strings the same length. |
ConvertDoubleToString(Double, Boolean) | RPG’s %EDITFLT: Convert a floating point number to IBMi’s string representation. |
DoBuiltInCharDec(String, Int32, Int32, Boolean) | RPG’s %DEC/%DECH(character). Converts a character string to a decimal numeric value, with the given length and decimal positions. |
DoBuiltInCheck(String, String, Int32) | RPG’s %CHECK. Finds in baseStr the first occurrence that is different from any of the characters in cmpStr and returns its 1-based position. |
DoBuiltInCheckR(String, String, Int32, Boolean) | RPG’s %CHECKR. Finds in baseStr the first occurrence that is different from any of the characters in cmpStr and returns its 1-based position, starting at the end of baseStr. |
DoBuiltInDigitReplace(Int32, Int32, Decimal, String) | Replace part of a string with the digits in a decimal number. |
DoBuiltInDigitSubSt(String, Int32, Int32) | Get a substring representing a decimal number and return the decimal number according to the Culture formatting. |
DoBuiltInLookup(Object, Array, Int32, Int32) | RPG’s %LOOKUP: Searches an array for the specified element value. |
DoBuiltInLookupXX(Object, Array, Int32, Int32, Boolean, Boolean, Boolean) | RPG’s %LOOKUPXX: Searches an array for the specified element value. |
DoBuiltInReplace(Int32, Int32, String, String) | Replaces characters in a string with a given replacement string. |
DoBuiltInScan(String, String, Int32) | RPG’s %SCAN: Find a string within another and return the 1-based starting position where the match starts. |
DoBuiltInSubSt(String, Int32, Int32) | RPG’s %SUBST: Get a substring. |
DoBuiltInSubStAssign(String, Int32, Int32, String, Boolean) | RPG’s %SUBST: Set a substring. |
DoBuiltInTLookup(Object, Array, Int32&, Int32&) | RPG’s %TLOOKUP: Searches an array representing a RPG table for the specified element value. |
DoBuiltInTLookupXX(Object, Array, Int32&, Int32&, Boolean, Boolean, Boolean) | RPG’s %TLOOKUPXX: Searches an array representing a RPG table for the specified element value. |
DoCheck(String, String, Boolean, Int32, Int32&) | RPG’s %CHECK. Finds in baseString the first occurrence that is different from any of the characters in cmpStr and returns its 1-based position. |
DoCheckArrayResult(String, String, Boolean, Int32, Array) | RPG’s %CHECK. Finds in baseString all the occurrences that are different from any of the characters in cmpStr and returns their 1-based position in an array. |
DoCheckR(String, String, Boolean, Int32, Int32&) | RPG’s %CHECKR. Finds in baseStr the first occurrence that is different from any of the characters in cmpStr and returns its 1-based position, starting at the end of baseStr. |
DoCheckRArrayResult(String, String, Boolean, Int32, Array) | RPG’s %CHECKR. Finds in baseString all the occurrences that are different from any of the characters in cmpStr and returns their 1-based position in an array, starting at the end of baseStr.. |
DoConcat(String, String, Int32) | Concatenate two strings, adjusting the number of blanks at the end of prefix to the given number. |
DoIntDecimal(Decimal, Boolean) | RPG’s %INT/%INTH for a decimal argument. Convert a decimal number to an integer. |
DoIntDouble(Double, Boolean) | RPG’s %INT/%INTH for a double (8-byte floating point number) argument. Convert a double number to an integer. |
DoIntString(String, Boolean) | RPG’s %INT/%INTH for a string. Convert a string representing a number in any of the supported RPG formats to an integer. |
DoScan(String, String, Int32, Int32) | Scans a string (baseStr) for a substring (cmpStr). |
DoScanArrayResult(String, String, Int32, Int32, Array) | Scans a string (baseStr) for all occurrences of a substring (cmpStr). The starting positions of the occurrences found are saved in the fndPosArray array parameter. |
DoSubStr(String, Int32, Int32) | Extracts a substring out of a given string. |
DoUnsDecimal(Decimal, Boolean) | RPG’s %UNS/%UNSH for a decimal argument. Convert a decimal number to an unsigned (positive) integer. |
DoUnsDouble(Double, Boolean) | RPG’s %UNS/%UNSH for a double (8-byte floating point number) argument. Convert a double number to an unsigned (positive) integer. |
DoUnsString(String, Boolean) | RPG’s %UNS/%UNSH for a string. Convert a string representing a number in any of the supported RPG formats to an unsigned (positive) integer. |
DoXlate(String, String, String, Int32) | RPG’s XLATE. Translates characters in the baseString according to MapFrom, MapTo, startPos. |
GetBinaryAsChars(Decimal, Char[], Int32, Int32, Int32) | Convert a decimal number to its representation as a Binary decimal in a character array. |
GetBinaryFromChars(Char[], Int32, Int32, Int32) | Convert an array of characters representing a Binary decimal number to decimal. |
GetDate(Char[], Int32, String) | Get the DateTime value represented by a fixed date/time value stored in a char array. |
GetDateArrayInCharArray(Array, Char[], Int32, String) | Copy an array of DateTime values onto a character array of fixed date/time values in the given format. |
GetDateInCharArray(DateTime, Char[], Int32, String) | Get the fixed date/time representation of a DateTime value, store the result in a character array. |
GetDecimalArrayInCharArray(Array, Char[], Int32, Int32, Int32) | Copy an array of decimal values onto a character array of zoned decimal numbers. |
GetDecimalFromZoned(Char[], Int32, Int32, Int32) | Get the decimal number represented by a zoned decimal value stored in a char array. |
GetPackedAsChars(Decimal, Char[], Int32, Int32) | Convert a decimal number to Packed representation. |
GetPackedFromChars(Char[], Int32, Int32, Int32) | Convert an array of characters representing a Packed decimal number to decimal. |
GetZoned(Decimal, Char[], Int32, Int32, Int32) | Get the zoned decimal representation of a decimal number, store the result in a character array. |
LoadPictureFromFile(String) | Loads an image file. |
MapFromBinary(Decimal, Int32, Int32) | Convert a decimal number to its string representation as a Binary decimal. |
MapToBinary(String, Int32, Int32) | Convert a string representing a Binary decimal number to decimal. |
MoveArrayElemToElem(Array, Array, Int32, Int32, Boolean, Boolean, Int32, Int32, Boolean, Int32, Boolean, String, Boolean, String) | Move data between arrays of arbitrary RPG types represented with system types. |
MoveArrayFromArray(Array, Array, Int32, Int32, Boolean) | Moves data from one array to another, where the array elements are of the same size. |
MoveArrayToString(Boolean&, Array, String, Int32, Boolean) | Serialize an array onto a target string. |
MoveComplexArray(Array, Array, Int32, Int32, Boolean) | Moves data from one array to another, where the array elements are of different size. |
MoveFigurativeToElem(Array, Int32, Object) | Fill a given array with the specified object. |
MoveStringToArray(String, Array, Int32, Boolean) | Deserialize a string onto a character-typed array. |
OsExec(String, Int32, String, String, Boolean, Int32&) | The OSEXEC command opens or prints a specified file. The file can be an executable file or a file that is associated with a program. |
OsExecWithExitCode(String, Int32, String, String, Boolean, Int32&, Int32&) | The OSEXEC command opens or prints a specified file. The file can be an executable file or a file that is associated with a program. |
SetArrayDates(Array, Char[], Int32, String) | Deserialize an array of fixed date/time values stored in a character array onto a DateTime array. |
SetArrayDecimals(Array, Char[], Int32, Int32, Int32) | Deserialize an array of zoned decimals stored in a character array onto a decimal array. |
SetPosNegBoz(String, Boolean&, Boolean&, Boolean&, Boolean) | Sets flags depending on the value of the test argument. The flags indicate a positive, negative, or blank-or-zero test value. |
SortArr(Array) | Sort an array using RPG sorting rules. |
SortNonContiguosArr(Array, Array) | Sort a base array using a second array as a key array, using RPG sorting rules. This method only sorts arrays of strings or arrays of decimal numbers. |
TestBits(Byte, String, Boolean&, Boolean&, Boolean&) | Compares the bits in mask with the corresponding bits in b. |
TestBitsWithByte(Byte, Byte, Boolean&, Boolean&, Boolean&) | Compares the bits in maskByte with the corresponding bits in b. |
ToChar(String) | Converts the first character of a specified string to a Unicode character. |
byte BitOff(string mask, byte b)
Allows bits to be set off in the input b parameter based upon a mask specified in the mask parameter.
byte BitOff(string mask, byte b)
Parameters
Type | Parameter name | Description |
---|---|---|
String | mask | Mask can contain: Bit numbers 0-7. Enclose the bit numbers in apostrophes. For example, to set bits 0, 3, 6 on, enter ‘036’ in Factor 2. A valid character expression. Hexadecimal literal (H’85’) for example(Binary 10000101). Named constant up to 8 positions long containing the bit numbers to be set OFF. |
Byte | b | Input byte value. |
Returns
Type | Description |
---|---|
Byte | BitOff result as byte. |
byte BitOn(string mask, byte b)
Allows bits to be set on in the Target parameter based upon a mask specified in the Mask parameter.
byte BitOn(string mask, byte b)
Parameters
Type | Parameter name | Description |
---|---|---|
String | mask | BitOn param mask. |
Byte | b | Input byte value. |
Returns
Type | Description |
---|---|
Byte | BitOn result as byte. |
int CompareStrings(string sA, string sB)
Compares two specified string objects using RPG semantics and returns an integer that indicates their relative position in the sort order.If necessary, one of the strings is padded with blanks to make both strings the same length.
int CompareStrings(string sA, string sB)
Parameters
Type | Parameter name | Description |
---|---|---|
String | sA | First string to compare. |
String | sB | Second string to compare. |
Returns
Type | Description |
---|---|
Int32 | A signed integer number that indicates the lexical relationship between the two strings: less than zero meanssA precedes sB in the sort order; zero, the strings are equal; greater than zero, sA follows sB in the sort order. |
string ConvertDoubleToString(double d, bool isFloat)
RPG’s %EDITFLT: Convert a floating point number to IBMi’s string representation.
string ConvertDoubleToString(double d, bool isFloat)
Parameters
Type | Parameter name | Description |
---|---|---|
Double | d | The floating point value. |
Boolean | isFloat | True is d is a 4-byte float. |
Returns
Type | Description |
---|---|
String | The string representation of the floating point number. |
decimal DoBuiltInCharDec(string charFld, int integrals, int decimals, bool halfAdjust)
RPG’s %DEC/%DECH(character). Converts a character string to a decimal numeric value, with the given length and decimal positions.
decimal DoBuiltInCharDec(string charFld, int integrals, int decimals, bool halfAdjust)
Parameters
Type | Parameter name | Description |
---|---|---|
String | charFld | The string to convert to decimal numeric. |
Int32 | integrals | The number of integral digits of the result. |
Int32 | decimals | The number of decimal positions of the result. |
Boolean | halfAdjust | True to half-adjust the result to the given number of digits. |
Returns
Type | Description |
---|---|
Decimal | The resulting decimal number. |
int DoBuiltInCheck(string cmpStr, string baseString, int startPos)
RPG’s %CHECK. Finds in baseStr the first occurrence that is different from any of the characters in cmpStr and returns its 1-based position.
int DoBuiltInCheck(string cmpStr, string baseString, int startPos)
Parameters
Type | Parameter name | Description |
---|---|---|
String | cmpStr | The characters to search for. |
String | baseString | The string to test. |
Int32 | startPos | The 1-based position where the search should start. |
Returns
Type | Description |
---|---|
Int32 | The 1-based position of the found character, or 0 if it was not found. |
int DoBuiltInCheckR(string cmpStr, string baseString, int startPos, bool isDefaultStartPos)
RPG’s %CHECKR. Finds in baseStr the first occurrence that is different from any of the characters in cmpStr and returns its 1-based position, starting at the end of baseStr.
int DoBuiltInCheckR(string cmpStr, string baseString, int startPos, bool isDefaultStartPos)
Parameters
Type | Parameter name | Description |
---|---|---|
String | cmpStr | The characters to search for. |
String | baseString | The string to test. |
Int32 | startPos | The 1-based position where the search should start. |
Boolean | isDefaultStartPos | True to start at the end of baseStr. |
Returns
Type | Description |
---|---|
Int32 | The 1-based position of the found character, or 0 if it was not found. |
string DoBuiltInDigitReplace(int length, int startPos, decimal repDigits, string baseString)
Replace part of a string with the digits in a decimal number.
string DoBuiltInDigitReplace(int length, int startPos, decimal repDigits, string baseString)
Parameters
Type | Parameter name | Description |
---|---|---|
Int32 | length | Length to replace. |
Int32 | startPos | Position where the replacement starts. |
Decimal | repDigits | The replacement digits to add to the string. |
String | baseString | The target string. |
Returns
Type | Description |
---|---|
String | The value of baseString with the indicated segment replaced. |
decimal DoBuiltInDigitSubSt(string baseString, int startPos, int subLen)
Get a substring representing a decimal number and return the decimal number according to the Culture formatting.
decimal DoBuiltInDigitSubSt(string baseString, int startPos, int subLen)
Parameters
Type | Parameter name | Description |
---|---|---|
String | baseString | The string containing the repesentation of a decimal number. |
Int32 | startPos | The 1-based starting position of the decimal number representation. |
Int32 | subLen | Length of the decimal number representation. |
Returns
Type | Description |
---|---|
Decimal | The decimal number. |
int DoBuiltInLookup(object source, Array array, int startPos, int cElements)
RPG’s %LOOKUP: Searches an array for the specified element value.
int DoBuiltInLookup(object source, Array array, int startPos, int cElements)
Parameters
Type | Parameter name | Description |
---|---|---|
Object | source | The element value being searched for in the array. |
Array | array | The array to search. |
Int32 | startPos | The array index where the search will begin. |
Int32 | cElements | The number of elements to search. |
Returns
Type | Description |
---|---|
Int32 | The position in the array where the element was found, or -1 in not found. |
int DoBuiltInLookupXX(object source, Array array, int startPos, int cElements, bool searchHi, bool searchLo, bool searchEq)
RPG’s %LOOKUPXX: Searches an array for the specified element value.
int DoBuiltInLookupXX(object source, Array array, int startPos, int cElements, bool searchHi, bool searchLo, bool searchEq)
Parameters
Type | Parameter name | Description |
---|---|---|
Object | source | The element value being searched for in the array. |
Array | array | The array to search. |
Int32 | startPos | The array index where the search will begin. |
Int32 | cElements | The number of elements to search. |
Boolean | searchHi | True to search for greater than. |
Boolean | searchLo | True to search for less than. |
Boolean | searchEq | True to search for equal. |
Returns
Type | Description |
---|---|
Int32 | The position in the array where the element was found, or -1 in not found. |
string DoBuiltInReplace(int length, int startPos, string repString, string baseString)
Replaces characters in a string with a given replacement string.
string DoBuiltInReplace(int length, int startPos, string repString, string baseString)
Parameters
Type | Parameter name | Description |
---|---|---|
Int32 | length | Length to replace, pass -1 to use the length of the replacement string. |
Int32 | startPos | Position where to start the replacement. |
String | repString | Replacement string. |
String | baseString | String to modify. |
Returns
Type | Description |
---|---|
String | The resulting string value. |
int DoBuiltInScan(string cmpStr, string baseString, int startPos)
RPG’s %SCAN: Find a string within another and return the 1-based starting position where the match starts.
int DoBuiltInScan(string cmpStr, string baseString, int startPos)
Parameters
Type | Parameter name | Description |
---|---|---|
String | cmpStr | The string to find. |
String | baseString | The string to scan. |
Int32 | startPos | The 1-based starting position where the scan should start. |
Returns
Type | Description |
---|---|
Int32 | The 1-based position where the match starts, or 0 if not found. |
string DoBuiltInSubSt(string baseString, int startPos, int subLen)
RPG’s %SUBST: Get a substring.
string DoBuiltInSubSt(string baseString, int startPos, int subLen)
Parameters
Type | Parameter name | Description |
---|---|---|
String | baseString | String to search. |
Int32 | startPos | 1-based starting position of the substring to extract. |
Int32 | subLen | Length of the desired substring. Use -1 to get the substring from startPos to the end. |
Returns
Type | Description |
---|---|
String | The substring. |
string DoBuiltInSubStAssign(string baseString, int startPos, int subLen, string replaceStr, bool isRightAdjust)
RPG’s %SUBST: Set a substring.
string DoBuiltInSubStAssign(string baseString, int startPos, int subLen, string replaceStr, bool isRightAdjust)
Parameters
Type | Parameter name | Description |
---|---|---|
String | baseString | String to search. |
Int32 | startPos | 1-based starting position of the substring to extract. |
Int32 | subLen | Length of the desired substring. Use -1 to get the substring from startPos to the end. |
String | replaceStr | The string to replace in baseString. |
Boolean | isRightAdjust | If the length of replaceStr is not equal to subLen, indicates whether the replacement should be right adjusted (True), or left adjusted (False). |
Returns
Type | Description |
---|---|
String | The value of baseString with the replacement. |
bool DoBuiltInTLookup(object source, Array array, Int32& tableIndex, Int32& altTableIndex)
RPG’s %TLOOKUP: Searches an array representing a RPG table for the specified element value.
bool DoBuiltInTLookup(object source, Array array, Int32& tableIndex, Int32& altTableIndex)
Parameters
Type | Parameter name | Description |
---|---|---|
Object | source | The element value being searched for in the table. |
Array | array | The table to search. |
Int32& | tableIndex | Out value that contains the 1-based index where the element was found, or 0 if not found. |
Int32& | altTableIndex | Out value that contains the 1-based index where the element was found, or 0 if not found. |
Returns
Type | Description |
---|---|
Boolean | True if the element was found. False otherwise. |
bool DoBuiltInTLookupXX(object source, Array array, Int32& tableIndex, Int32& altTableIndex, bool searchHi, bool searchLo, bool searchEq)
RPG’s %TLOOKUPXX: Searches an array representing a RPG table for the specified element value.
bool DoBuiltInTLookupXX(object source, Array array, Int32& tableIndex, Int32& altTableIndex, bool searchHi, bool searchLo, bool searchEq)
Parameters
Type | Parameter name | Description |
---|---|---|
Object | source | The element value being searched for in the table. |
Array | array | The table to search. |
Int32& | tableIndex | Out value that contains the 1-based index where the element was found, or 0 if not found. |
Int32& | altTableIndex | Out value that contains the 1-based index where the element was found, or 0 if not found. |
Boolean | searchHi | True to search for greater than. |
Boolean | searchLo | True to search for less than. |
Boolean | searchEq | True to search for equal. |
Returns
Type | Description |
---|---|
Boolean | True if the element was found. False otherwise. |
void DoCheck(string cmpStr, string baseString, bool isDefaultStartPos, int startPos, Int32& result)
RPG’s %CHECK. Finds in baseString the first occurrence that is different from any of the characters in cmpStr and returns its 1-based position.
void DoCheck(string cmpStr, string baseString, bool isDefaultStartPos, int startPos, Int32& result)
Parameters
Type | Parameter name | Description |
---|---|---|
String | cmpStr | The characters to search for. |
String | baseString | The string to test. |
Boolean | isDefaultStartPos | True to start at the beginning of baseString. |
Int32 | startPos | The 1-based position where the search should start. |
Int32& | result | The 1-based position of the found character, or 0 if it was not found. |
void DoCheckArrayResult(string cmpStr, string baseString, bool isDefaultStartPos, int startPos, Array noMatchArray)
RPG’s %CHECK. Finds in baseString all the occurrences that are different from any of the characters in cmpStr and returns their 1-based position in an array.
void DoCheckArrayResult(string cmpStr, string baseString, bool isDefaultStartPos, int startPos, Array noMatchArray)
Parameters
Type | Parameter name | Description |
---|---|---|
String | cmpStr | The characters to search for. |
String | baseString | The string to test. |
Boolean | isDefaultStartPos | True to start at the beginning of baseString. |
Int32 | startPos | The 1-based position where the search should start. |
Array | noMatchArray | The 1-based position of the found characters, in order. Any additional positions in the array will be filled with 0. |
void DoCheckR(string cmpStr, string baseString, bool isDefaultStartPos, int startPos, Int32& result)
RPG’s %CHECKR. Finds in baseStr the first occurrence that is different from any of the characters in cmpStr and returns its 1-based position, starting at the end of baseStr.
void DoCheckR(string cmpStr, string baseString, bool isDefaultStartPos, int startPos, Int32& result)
Parameters
Type | Parameter name | Description |
---|---|---|
String | cmpStr | The characters to search for. |
String | baseString | The string to test. |
Boolean | isDefaultStartPos | True to start at the end of baseString. |
Int32 | startPos | The 1-based position where the search should start. |
Int32& | result | The 1-based position of the found character, or 0 if it was not found. |
void DoCheckRArrayResult(string cmpStr, string baseString, bool isDefaultStartPos, int startPos, Array noMatchArray)
RPG’s %CHECKR. Finds in baseString all the occurrences that are different from any of the characters in cmpStr and returns their 1-based position in an array, starting at the end of baseStr..
void DoCheckRArrayResult(string cmpStr, string baseString, bool isDefaultStartPos, int startPos, Array noMatchArray)
Parameters
Type | Parameter name | Description |
---|---|---|
String | cmpStr | The characters to search for. |
String | baseString | The string to test. |
Boolean | isDefaultStartPos | True to start at the end of baseString. |
Int32 | startPos | The 1-based position where the search should start. |
Array | noMatchArray | The 1-based position of the found characters, in order. Any additional positions in the array will be filled with 0. |
string DoConcat(string prefix, string suffix, int blanks)
Concatenate two strings, adjusting the number of blanks at the end of prefix to the given number.
string DoConcat(string prefix, string suffix, int blanks)
Parameters
Type | Parameter name | Description |
---|---|---|
String | prefix | The first string. |
String | suffix | The second string. |
Int32 | blanks | The number of blanks to set at the end of prefix. A negative number will leave prefix as it is, without adjusting the blanks at the end. |
Returns
Type | Description |
---|---|
String | The concatenation of the modified prefix and suffix. |
int DoIntDecimal(decimal theDecimal, bool isHalfAdjust)
RPG’s %INT/%INTH for a decimal argument. Convert a decimal number to an integer.
int DoIntDecimal(decimal theDecimal, bool isHalfAdjust)
Parameters
Type | Parameter name | Description |
---|---|---|
Decimal | theDecimal | The decimal number. |
Boolean | isHalfAdjust | True for half adjust. |
Returns
Type | Description |
---|---|
Int32 | The integer conversion of theDecimal, half-adjusted if necessary. |
int DoIntDouble(double theDouble, bool isHalfAdjust)
RPG’s %INT/%INTH for a double (8-byte floating point number) argument. Convert a double number to an integer.
int DoIntDouble(double theDouble, bool isHalfAdjust)
Parameters
Type | Parameter name | Description |
---|---|---|
Double | theDouble | The double number. |
Boolean | isHalfAdjust | True for half adjust. |
Returns
Type | Description |
---|---|
Int32 | The integer conversion of theDouble, half-adjusted if necessary. |
int DoIntString(string theString, bool isHalfAdjust)
RPG’s %INT/%INTH for a string. Convert a string representing a number in any of the supported RPG formats to an integer.
int DoIntString(string theString, bool isHalfAdjust)
Parameters
Type | Parameter name | Description |
---|---|---|
String | theString | The string. |
Boolean | isHalfAdjust | True for half adjust. |
Returns
Type | Description |
---|---|
Int32 | The integer conversion of theString, half-adjusted if necessary. |
int DoScan(string cmpStr, string baseStr, int cmpLen, int startPos)
Scans a string (baseStr) for a substring (cmpStr).
int DoScan(string cmpStr, string baseStr, int cmpLen, int startPos)
Parameters
Type | Parameter name | Description |
---|---|---|
String | cmpStr | Substring to find in the baseStr string. |
String | baseStr | String to scan. |
Int32 | cmpLen | Length of the substring. Use 0 to use the current length of the substring |
Int32 | startPos | 1-based position where to start scanning in baseStr. |
Returns
Type | Description |
---|---|
Int32 | The 1-based starting position of the substring, if found, or 0 if not found. |
void DoScanArrayResult(string cmpStr, string baseStr, int cmpLen, int startPos, Array fndPosArray)
Scans a string (baseStr) for all occurrences of a substring (cmpStr). The starting positions of the occurrences found are saved in the fndPosArray array parameter.
void DoScanArrayResult(string cmpStr, string baseStr, int cmpLen, int startPos, Array fndPosArray)
Parameters
Type | Parameter name | Description |
---|---|---|
String | cmpStr | Substring to find in the baseStr string. |
String | baseStr | String to scan. |
Int32 | cmpLen | Length of the substring. Use 0 to use the current length of the substring |
Int32 | startPos | 1-based position where to start scanning in baseStr. |
Array | fndPosArray | The array where starting positions are saved, in order. |
string DoSubStr(string baseStr, int subLen, int startPos)
Extracts a substring out of a given string.
string DoSubStr(string baseStr, int subLen, int startPos)
Parameters
Type | Parameter name | Description |
---|---|---|
String | baseStr | The string from where to extract a substring. |
Int32 | subLen | The length of the desired substring. |
Int32 | startPos | The 1-based starting position in the baseStr string where the substring starts. |
Returns
Type | Description |
---|---|
String | The substring. |
int DoUnsDecimal(decimal theDecimal, bool isHalfAdjust)
RPG’s %UNS/%UNSH for a decimal argument. Convert a decimal number to an unsigned (positive) integer.
int DoUnsDecimal(decimal theDecimal, bool isHalfAdjust)
Parameters
Type | Parameter name | Description |
---|---|---|
Decimal | theDecimal | The decimal number. |
Boolean | isHalfAdjust | True for half adjust. |
Returns
Type | Description |
---|---|
Int32 | The positive integer conversion of theDecimal, half-adjusted if necessary. |
int DoUnsDouble(double theDouble, bool isHalfAdjust)
RPG’s %UNS/%UNSH for a double (8-byte floating point number) argument. Convert a double number to an unsigned (positive) integer.
int DoUnsDouble(double theDouble, bool isHalfAdjust)
Parameters
Type | Parameter name | Description |
---|---|---|
Double | theDouble | The double number. |
Boolean | isHalfAdjust | True for half adjust. |
Returns
Type | Description |
---|---|
Int32 | The positive integer conversion of theDouble, half-adjusted if necessary. |
int DoUnsString(string theString, bool isHalfAdjust)
RPG’s %UNS/%UNSH for a string. Convert a string representing a number in any of the supported RPG formats to an unsigned (positive) integer.
int DoUnsString(string theString, bool isHalfAdjust)
Parameters
Type | Parameter name | Description |
---|---|---|
String | theString | The string. |
Boolean | isHalfAdjust | True for half adjust. |
Returns
Type | Description |
---|---|
Int32 | The positive integer conversion of theString, half-adjusted if necessary. |
string DoXlate(string mapFrom, string mapTo, string baseStr, int startPos)
RPG’s XLATE. Translates characters in the baseString according to MapFrom, MapTo, startPos.
string DoXlate(string mapFrom, string mapTo, string baseStr, int startPos)
Parameters
Type | Parameter name | Description |
---|---|---|
String | mapFrom | From string, if characters are duplicated the first occurrence is used. |
String | mapTo | To string, describes what the characters in mapFrom will become. |
String | baseStr | A character expression that contains the string Xlate will operate on. |
Int32 | startPos | The 1-based start position for baseString. |
Returns
Type | Description |
---|---|
String | The resulting string value. |
void GetBinaryAsChars(decimal number, Char[] charArray, int offset, int digits, int decimals)
Convert a decimal number to its representation as a Binary decimal in a character array.
void GetBinaryAsChars(decimal number, Char[] charArray, int offset, int digits, int decimals)
Parameters
Type | Parameter name | Description |
---|---|---|
Decimal | number | The number to convert. |
Char[] | charArray | The array to contain the binary decimal. |
Int32 | offset | The index of the array where the binary decimal will start. |
Int32 | digits | The number of digits in the decimal number. |
Int32 | decimals | The number of decimal positions in the decimal number. |
decimal GetBinaryFromChars(Char[] charArray, int offset, int digits, int decimals)
Convert an array of characters representing a Binary decimal number to decimal.
decimal GetBinaryFromChars(Char[] charArray, int offset, int digits, int decimals)
Parameters
Type | Parameter name | Description |
---|---|---|
Char[] | charArray | The binary decimal number as an array of characters. |
Int32 | offset | The index of the character in the array where the binary decimal starts. |
Int32 | digits | The number of digits in the decimal number. |
Int32 | decimals | The number of decimal positions in the decimal number. |
Returns
Type | Description |
---|---|
Decimal | The decimal number. |
DateTime GetDate(Char[] charArray, int offset, string formatString)
Get the DateTime value represented by a fixed date/time value stored in a char array.
DateTime GetDate(Char[] charArray, int offset, string formatString)
Parameters
Type | Parameter name | Description |
---|---|---|
Char[] | charArray | The array containing the fixed date/time value. |
Int32 | offset | The index of the first array element where the fixed date/time value starts. |
String | formatString | The format encoding the fixed date/time value. |
Returns
Type | Description |
---|---|
DateTime | The DateTime value equivalent to the fixed date/time in the array. |
void GetDateArrayInCharArray(Array array, Char[] target, int targetIndex, string formatString)
Copy an array of DateTime values onto a character array of fixed date/time values in the given format.
void GetDateArrayInCharArray(Array array, Char[] target, int targetIndex, string formatString)
Parameters
Type | Parameter name | Description |
---|---|---|
Array | array | The DateTime array source of the operation. |
Char[] | target | The character array that will receive the date/time values. |
Int32 | targetIndex | The index of the element in target where the copy starts. |
String | formatString | The format in which the fixed date/time values are stored. |
void GetDateInCharArray(DateTime date, Char[] charArray, int offset, string formatString)
Get the fixed date/time representation of a DateTime value, store the result in a character array.
void GetDateInCharArray(DateTime date, Char[] charArray, int offset, string formatString)
Parameters
Type | Parameter name | Description |
---|---|---|
DateTime | date | The DateTime value to convert. |
Char[] | charArray | The array to store the result. |
Int32 | offset | The index of the first array element where the zoned number starts. |
String | formatString | The desired format of the resulting fixed date/time value. |
void GetDecimalArrayInCharArray(Array decimalArray, Char[] target, int targetIndex, int cIntegrals, int cDecimals)
Copy an array of decimal values onto a character array of zoned decimal numbers.
void GetDecimalArrayInCharArray(Array decimalArray, Char[] target, int targetIndex, int cIntegrals, int cDecimals)
Parameters
Type | Parameter name | Description |
---|---|---|
Array | decimalArray | The decimal array source of the operation. |
Char[] | target | The character array that will receive the date/time values. |
Int32 | targetIndex | The index of the element in target where the copy starts. |
Int32 | cIntegrals | The number of integral digits in the zoned numbers. |
Int32 | cDecimals | The number of decimal positions in the zoned numbers. |
decimal GetDecimalFromZoned(Char[] charArray, int offset, int cIntegralsAvail, int cDecimalsAvail)
Get the decimal number represented by a zoned decimal value stored in a char array.
decimal GetDecimalFromZoned(Char[] charArray, int offset, int cIntegralsAvail, int cDecimalsAvail)
Parameters
Type | Parameter name | Description |
---|---|---|
Char[] | charArray | The array containing the zoned decimal value. |
Int32 | offset | The index of the first array element where the zoned number starts. |
Int32 | cIntegralsAvail | Integral positions of the zoned number. |
Int32 | cDecimalsAvail | Decimal positions of the zoned number. |
Returns
Type | Description |
---|---|
Decimal | The decimal number corresponding to the zoned decimal representation in the array. |
void GetPackedAsChars(decimal number, Char[] charArray, int offset, int digits)
Convert a decimal number to Packed representation.
void GetPackedAsChars(decimal number, Char[] charArray, int offset, int digits)
Parameters
Type | Parameter name | Description |
---|---|---|
Decimal | number | The number to convert. |
Char[] | charArray | The array to hold the packed representation of the number. |
Int32 | offset | Where in the array to start loading the packed representation. |
Int32 | digits | The total number of digits of the desired packed number. |
decimal GetPackedFromChars(Char[] charArray, int offset, int length, int decimals)
Convert an array of characters representing a Packed decimal number to decimal.
decimal GetPackedFromChars(Char[] charArray, int offset, int length, int decimals)
Parameters
Type | Parameter name | Description |
---|---|---|
Char[] | charArray | The input array of characters. |
Int32 | offset | The position in the array where the packed number starts. |
Int32 | length | The number of digits in the decimal number. |
Int32 | decimals | The number of decimal positions in the decimal number. |
Returns
Type | Description |
---|---|
Decimal | The decimal number. |
void GetZoned(decimal decNum, Char[] charArray, int offset, int cIntegralsAvail, int cDecimalsAvail)
Get the zoned decimal representation of a decimal number, store the result in a character array.
void GetZoned(decimal decNum, Char[] charArray, int offset, int cIntegralsAvail, int cDecimalsAvail)
Parameters
Type | Parameter name | Description |
---|---|---|
Decimal | decNum | The number to convert. |
Char[] | charArray | The array to store the result. |
Int32 | offset | The index of the first array element where the zoned number starts. |
Int32 | cIntegralsAvail | Integral positions of the zoned number. |
Int32 | cDecimalsAvail | Decimal positions of the zoned number. |
Image LoadPictureFromFile(string fileName)
Loads an image file.
Image LoadPictureFromFile(string fileName)
Parameters
Type | Parameter name | Description |
---|---|---|
String | fileName | Image file pathname. |
Returns
Type | Description |
---|---|
Image | Image class instance. |
string MapFromBinary(decimal number, int digits, int decimals)
Convert a decimal number to its string representation as a Binary decimal.
string MapFromBinary(decimal number, int digits, int decimals)
Parameters
Type | Parameter name | Description |
---|---|---|
Decimal | number | The number to convert. |
Int32 | digits | The number of digits in the decimal number. |
Int32 | decimals | The number of decimal positions in the decimal number. |
Returns
Type | Description |
---|---|
String | The binary decimal representation as a string. |
decimal MapToBinary(string baseString, int digits, int decimals)
Convert a string representing a Binary decimal number to decimal.
decimal MapToBinary(string baseString, int digits, int decimals)
Parameters
Type | Parameter name | Description |
---|---|---|
String | baseString | The binary decimal number as a string. |
Int32 | digits | The number of digits in the decimal number. |
Int32 | decimals | The number of decimal positions in the decimal number. |
Returns
Type | Description |
---|---|
Decimal | The decimal number. |
void MoveArrayElemToElem(Array source, Array target, int iSourceStart, int iTargetStart, bool pad, bool targetIsFixedDecimal, int targetIntegrals, int targetDecimals, bool sourceIsFixedDecimal, int sourceDecimals, bool targetIsDateTime, string targetDateFormat, bool sourceIsDateTime, string sourceDateFormat)
Move data between arrays of arbitrary RPG types represented with system types.
void MoveArrayElemToElem(Array source, Array target, int iSourceStart, int iTargetStart, bool pad, bool targetIsFixedDecimal, int targetIntegrals, int targetDecimals, bool sourceIsFixedDecimal, int sourceDecimals, bool targetIsDateTime, string targetDateFormat, bool sourceIsDateTime, string sourceDateFormat)
Parameters
Type | Parameter name | Description |
---|---|---|
Array | source | Source array. |
Array | target | Target array. |
Int32 | iSourceStart | Source array starting index. |
Int32 | iTargetStart | Target array starting index. |
Boolean | pad | True to pad the target array. |
Boolean | targetIsFixedDecimal | True if the target contains decimal numbers representing fixed-decimals. |
Int32 | targetIntegrals | If the target is a fixed decimal number, the integral digits. |
Int32 | targetDecimals | If the target is a fixed decimal number, the decimal positions. |
Boolean | sourceIsFixedDecimal | True if the source contains decimal numbers representing fixed-decimals. |
Int32 | sourceDecimals | If the source is a fixed decimal number, the decimal positions. |
Boolean | targetIsDateTime | True if the target is a fixed date/time type. |
String | targetDateFormat | If the target is a fixed date/time type, the format as a string. |
Boolean | sourceIsDateTime | True if the source is a fixed date/time type. |
String | sourceDateFormat | If the source is a fixed date/time type, the format as a string. |
void MoveArrayFromArray(Array source, Array target, int sourceStartAt, int targetStartAt, bool pad)
Moves data from one array to another, where the array elements are of the same size.
void MoveArrayFromArray(Array source, Array target, int sourceStartAt, int targetStartAt, bool pad)
Parameters
Type | Parameter name | Description |
---|---|---|
Array | source | Source array. |
Array | target | Target array. |
Int32 | sourceStartAt | Initial position in source. |
Int32 | targetStartAt | Initial position in target. |
Boolean | pad | True if padding with blanks is to be performed when the target array is longer than the data copied from the source. |
string MoveArrayToString(Boolean& boz, Array source, string target, int sourceStartAt, bool pad)
Serialize an array onto a target string.
string MoveArrayToString(Boolean& boz, Array source, string target, int sourceStartAt, bool pad)
Parameters
Type | Parameter name | Description |
---|---|---|
Boolean& | boz | Boolean flag that return true if the resulting string is blanks. |
Array | source | The array to serialize. |
String | target | The target string. |
Int32 | sourceStartAt | Index of the array element on where to start serialization. |
Boolean | pad | True to pad the target string with blanks. |
Returns
Type | Description |
---|---|
String | The result of serializing the array onto the target string. |
void MoveComplexArray(Array source, Array target, int sourceStartAt, int targetStartAt, bool pad)
Moves data from one array to another, where the array elements are of different size.
void MoveComplexArray(Array source, Array target, int sourceStartAt, int targetStartAt, bool pad)
Parameters
Type | Parameter name | Description |
---|---|---|
Array | source | Source Array. |
Array | target | Target Array. |
Int32 | sourceStartAt | Initial position in source. |
Int32 | targetStartAt | Initial position in target. |
Boolean | pad | True if padding with blanks is to be performed when the target array is longer than the data copied from the source. |
void MoveFigurativeToElem(Array target, int iTargetStart, object obj)
Fill a given array with the specified object.
void MoveFigurativeToElem(Array target, int iTargetStart, object obj)
Parameters
Type | Parameter name | Description |
---|---|---|
Array | target | Array to fill. |
Int32 | iTargetStart | The array element where the copy starts. |
Object | obj | Object to fill array with, must be a compatible type. |
void MoveStringToArray(string source, Array target, int targetStartAt, bool pad)
Deserialize a string onto a character-typed array.
void MoveStringToArray(string source, Array target, int targetStartAt, bool pad)
Parameters
Type | Parameter name | Description |
---|---|---|
String | source | The string to deserialize. |
Array | target | The target array. |
Int32 | targetStartAt | Index of the array element on where to start deserialization. |
Boolean | pad | True to pad the array with blanks. |
void OsExec(string commandLine, int windowStyle, string operationString, string directory, bool wait, Int32& returnCode)
The OSEXEC command opens or prints a specified file. The file can be an executable file or a file that is associated with a program.
void OsExec(string commandLine, int windowStyle, string operationString, string directory, bool wait, Int32& returnCode)
Parameters
Type | Parameter name | Description |
---|---|---|
String | commandLine | Specifies the file to open or print, or the folder to open or explore. The function can be either an executable file or a document file. It can also print a document file. commandLine must contain the complete path of the application to execute. |
Int32 | windowStyle | The style of the window to open.. |
String | operationString | Specifies what type of operation is to be performed on the file. The action to take with the file the action processes. |
String | directory | Contains the string that specifies the default directory. |
Boolean | wait | Determines whether the program will wait for the launched application to end before continuing execution. |
Int32& | returnCode | Reference to the code that indicates success of failure to launch. 0 is sucess, otherwise the error numeric value. |
void OsExecWithExitCode(string commandLine, int windowStyle, string operationString, string directory, bool wait, Int32& returnCode, Int32& exitCode)
The OSEXEC command opens or prints a specified file. The file can be an executable file or a file that is associated with a program.
void OsExecWithExitCode(string commandLine, int windowStyle, string operationString, string directory, bool wait, Int32& returnCode, Int32& exitCode)
Parameters
Type | Parameter name | Description |
---|---|---|
String | commandLine | Specifies the file to open or print, or the folder to open or explore. The function can be either an executable file or a document file. It can also print a document file. commandLine must contain the complete path of the application to execute. |
Int32 | windowStyle | The style of the window to open.. |
String | operationString | Specifies what type of operation is to be performed on the file. The action to take with the file the action processes. |
String | directory | Contains the string that specifies the default directory. |
Boolean | wait | Determines whether the program will wait for the launched application to end before continuing execution. |
Int32& | returnCode | Reference to the code that indicates success of failure to launch. 0 is sucess, otherwise the error numeric value. |
Int32& | exitCode | Reference to the exit code of the launched application after waiting for it to finish. |
void SetArrayDates(Array array, Char[] source, int sourceIndex, string formatString)
Deserialize an array of fixed date/time values stored in a character array onto a DateTime array.
void SetArrayDates(Array array, Char[] source, int sourceIndex, string formatString)
Parameters
Type | Parameter name | Description |
---|---|---|
Array | array | The target of the operation. |
Char[] | source | The char array containing fixed date/time values. |
Int32 | sourceIndex | The index of the first element to extract from source. |
String | formatString | The format in which the fixed date/time values are stored. |
void SetArrayDecimals(Array array, Char[] source, int sourceIndex, int cIntegrals, int cDecimals)
Deserialize an array of zoned decimals stored in a character array onto a decimal array.
void SetArrayDecimals(Array array, Char[] source, int sourceIndex, int cIntegrals, int cDecimals)
Parameters
Type | Parameter name | Description |
---|---|---|
Array | array | The target of the operation. |
Char[] | source | The char array containing zoned decimal numbers. |
Int32 | sourceIndex | The index of the first element to extract from source. |
Int32 | cIntegrals | The number of integral digits in the zoned numbers. |
Int32 | cDecimals | The number of decimal positions in the zoned numbers. |
void SetPosNegBoz(string test, Boolean& pos, Boolean& neg, Boolean& boz, bool testIsNumeric)
Sets flags depending on the value of the test argument. The flags indicate a positive, negative, or blank-or-zero test value.
void SetPosNegBoz(string test, Boolean& pos, Boolean& neg, Boolean& boz, bool testIsNumeric)
Parameters
Type | Parameter name | Description |
---|---|---|
String | test | The value to test, as a string. |
Boolean& | pos | Positive flag. It will be true if the test parameter represents a positive numeric value. |
Boolean& | neg | Negative flag. It will be true if the test parameter represents a negative numeric value. |
Boolean& | boz | Blank-or-zero flag. It will be true if the test parameter is blanks or represents a numeric value of zero. |
Boolean | testIsNumeric | Indicates whether the string to test represents a numeric value. |
void SortArr(Array arrayToSort)
Sort an array using RPG sorting rules.
void SortArr(Array arrayToSort)
Parameters
Type | Parameter name | Description |
---|---|---|
Array | arrayToSort | The array to sort. |
void SortNonContiguosArr(Array baseArray, Array arrayToSort)
Sort a base array using a second array as a key array, using RPG sorting rules. This method only sorts arrays of strings or arrays of decimal numbers.
void SortNonContiguosArr(Array baseArray, Array arrayToSort)
Parameters
Type | Parameter name | Description |
---|---|---|
Array | baseArray | The array to sort. |
Array | arrayToSort | The array of keys. |
void TestBits(byte b, string mask, Boolean& off, Boolean& on, Boolean& eq)
Compares the bits in mask with the corresponding bits in b.
void TestBits(byte b, string mask, Boolean& off, Boolean& on, Boolean& eq)
Parameters
Type | Parameter name | Description |
---|---|---|
Byte | b | Input byte value. |
String | mask | Can contain: Bit numbers 0-7. Enclose the bit numbers in apostrophes. For example, to set bits 0, 3, 6 on, enter ‘036’. A Character Expression. Hexadecimal literal (H’01’) for example. Named constant up to 8 positions long containing the bit numbers to be set on. |
Boolean& | off | Reflects the status of the result field bits. Assuming a Mask of H’E4’ (1100 0100), Off is true if all of the masked bits are Off in the field. In this case, for Off to be true, the field would contain H’3B’ (0011 1011). |
Boolean& | on | Reflects the status of the result field bits. Assuming a Mask of H’E4’ (1100 0100), On is true if some of the masked bits are On and some the masked bits are Off in the field. In this case, the field would contain anything but H’3B’ or H’E4’. |
Boolean& | eq | Reflects the status of the result field bits. Assuming a Mask of H’E4’ (1100 0100), Eq is true if all of the masked bits are On in the field. In this case, the field would contain H’E4’ (1100 0100).. |
void TestBitsWithByte(byte b, byte maskByte, Boolean& off, Boolean& on, Boolean& eq)
Compares the bits in maskByte with the corresponding bits in b.
void TestBitsWithByte(byte b, byte maskByte, Boolean& off, Boolean& on, Boolean& eq)
Parameters
Type | Parameter name | Description |
---|---|---|
Byte | b | Input byte value. |
Byte | maskByte | Can contain: Bit numbers 0-7. Enclose the bit numbers in apostrophes. For example, to set bits 0, 3, 6 on, enter ‘036’. A Character Expression. Hexadecimal literal (H’01’) for example. Named constant up to 8 positions long containing the bit numbers to be set on. |
Boolean& | off | Reflects the status of the result field bits. Assuming a Mask of H’E4’ (1100 0100), Off is true if all of the masked bits are Off in the field. In this case, for Off to be true, the field would contain H’3B’ (0011 1011). |
Boolean& | on | Reflects the status of the result field bits. Assuming a Mask of H’E4’ (1100 0100), On is true if some of the masked bits are On and some the masked bits are Off in the field. In this case, the field would contain anything but H’3B’ or H’E4’. |
Boolean& | eq | Reflects the status of the result field bits. Assuming a Mask of H’E4’ (1100 0100), Eq is true if all of the masked bits are On in the field. In this case, the field would contain H’E4’ (1100 0100). |
char ToChar(string sA)
Converts the first character of a specified string to a Unicode character.
char ToChar(string sA)
Parameters
Type | Parameter name | Description |
---|---|---|
String | sA | A string. |
Returns
Type | Description |
---|---|
Char | A Unicode character that is equivalent to the first character in sA. If sA is null or its length is 0, the return value is ‘0’. |