MemUnit class | QSYS API Reference Guide

Estimated reading time: 11 minutes

Defines methods to handle RPG MOVE semantics.

Namespace: ASNA.QSys.Runtime Assembly: ASNA.QSys.Runtime.dll

Inheritance: Object

Methods

Signature Description
AdjustLeft(String, Boolean, Int32) Adjust the length of a string to a given value, by padding or truncating the string on the left.
AdjustRight(String, Boolean, Int32) Adjust the length of a string to a given value, by padding or truncating the string on the right.
CharToMemUnitsSigned(String) Convert a string representing a number to a zoned numeric representation.
DecimalToMemUnits(Decimal, Int32, Int32) Convert a decimal number to its zoned representation.
DecimalToMemUnitsSigned(Decimal, Int32, Int32) Convert a decimal number to its zoned representation.
getCharValue(Char) Get the numeric digit encoded in a zoned char.
Int2ToMemUnits(Int16) Convert a 2-byte integer number to a zoned numeric representation.
Int2ToMemUnitsSigned(Int16) Convert a 2-byte integer number to a zoned numeric representation.
Int4ToMemUnits(Int32) Convert a 4-byte integer number to a zoned numeric representation.
Int4ToMemUnitsSigned(Int32) Convert a 4-byte integer number to a zoned numeric representation.
Int8ToMemUnits(Int64) Convert an 8-byte integer number to a zoned numeric representation.
Int8ToMemUnitsSigned(Int64) Convert an 8-byte integer number to a zoned numeric representation.
MemUnitsToDecimal(String, Int32, Int32) Convert the zoned representation of a number to decimal.
MemUnitsToInt2(String) Convert the zoned representation of a number to a 2-byte integer number.
MemUnitsToInt4(String) Convert the zoned representation of a number to a 4-byte integer number.
MemUnitsToInt8(String) Convert the zoned representation of a number to a 8-byte integer number.
MergeLeft(String, String) RPG’s MoveLeft. Merge the sourceValue into targetValue starting at position 0.
MergeRight(String, String) RPG’s Move(Right). Merge the sourceValue into targetValue starting at the end of targetValue.

string AdjustLeft(string source, bool isNumeric, int targetLength)

Adjust the length of a string to a given value, by padding or truncating the string on the left.

string AdjustLeft(string source, bool isNumeric, int targetLength)

Parameters

Type Parameter name Description
String source The string to adjust.
Boolean isNumeric True to pad with ‘0’ if necessary. False to pad with ‘ ‘.
Int32 targetLength The desired length.

Returns

Type Description
String The string at the desired length.

string AdjustRight(string source, bool isNumeric, int targetLength)

Adjust the length of a string to a given value, by padding or truncating the string on the right.

string AdjustRight(string source, bool isNumeric, int targetLength)

Parameters

Type Parameter name Description
String source The string to adjust.
Boolean isNumeric True to pad with ‘0’ if necessary. False to pad with ‘ ‘.
Int32 targetLength The desired length.

Returns

Type Description
String The string at the desired length.

string CharToMemUnitsSigned(string digits)

Convert a string representing a number to a zoned numeric representation.

string CharToMemUnitsSigned(string digits)

Parameters

Type Parameter name Description
String digits The input string.

Returns

Type Description
String The string representing the number as zoned.

string DecimalToMemUnits(decimal number, int integrals, int decimals)

Convert a decimal number to its zoned representation.

string DecimalToMemUnits(decimal number, int integrals, int decimals)

Parameters

Type Parameter name Description
Decimal number The number to convert.
Int32 integrals The number of integral digits in the decimal number.
Int32 decimals The number of decimal positions in the decimal number.

Returns

Type Description
String The string representing the number as zoned.

string DecimalToMemUnitsSigned(decimal number, int integrals, int decimals)

Convert a decimal number to its zoned representation.

string DecimalToMemUnitsSigned(decimal number, int integrals, int decimals)

Parameters

Type Parameter name Description
Decimal number The number to convert.
Int32 integrals The number of integral digits in the decimal number.
Int32 decimals The number of decimal positions in the decimal number.

Returns

Type Description
String The string representing the number as zoned, with the zone stamped on every character if the number is negative.

int getCharValue(char c)

Get the numeric digit encoded in a zoned char.

int getCharValue(char c)

Parameters

Type Parameter name Description
Char c The zoned char encoding a digit.

Returns

Type Description
Int32 The integer value of the encoded char.

string Int2ToMemUnits(short number)

Convert a 2-byte integer number to a zoned numeric representation.

string Int2ToMemUnits(short number)

Parameters

Type Parameter name Description
Int16 number The number to convert.

Returns

Type Description
String The string representing the number as zoned.

string Int2ToMemUnitsSigned(short number)

Convert a 2-byte integer number to a zoned numeric representation.

string Int2ToMemUnitsSigned(short number)

Parameters

Type Parameter name Description
Int16 number The number to convert.

Returns

Type Description
String The string representing the number as zoned, with the zone stamped on every character if the number is negative.

string Int4ToMemUnits(int number)

Convert a 4-byte integer number to a zoned numeric representation.

string Int4ToMemUnits(int number)

Parameters

Type Parameter name Description
Int32 number The number to convert.

Returns

Type Description
String The string representing the number as zoned.

string Int4ToMemUnitsSigned(int number)

Convert a 4-byte integer number to a zoned numeric representation.

string Int4ToMemUnitsSigned(int number)

Parameters

Type Parameter name Description
Int32 number The number to convert.

Returns

Type Description
String The string representing the number as zoned, with the zone stamped on every character if the number is negative.

string Int8ToMemUnits(long number)

Convert an 8-byte integer number to a zoned numeric representation.

string Int8ToMemUnits(long number)

Parameters

Type Parameter name Description
Int64 number The number to convert.

Returns

Type Description
String The string representing the number as zoned.

string Int8ToMemUnitsSigned(long number)

Convert an 8-byte integer number to a zoned numeric representation.

string Int8ToMemUnitsSigned(long number)

Parameters

Type Parameter name Description
Int64 number The number to convert.

Returns

Type Description
String The string representing the number as zoned, with the zone stamped on every character if the number is negative.

decimal MemUnitsToDecimal(string digits, int integrals, int decimals)

Convert the zoned representation of a number to decimal.

decimal MemUnitsToDecimal(string digits, int integrals, int decimals)

Parameters

Type Parameter name Description
String digits The string with the zoned representaion of the number.
Int32 integrals The number of integral digits in the decimal number.
Int32 decimals The number of decimal positions in the decimal number.

Returns

Type Description
Decimal The decimal number equivalent to the zoned representation, in the proper size.

short MemUnitsToInt2(string digits)

Convert the zoned representation of a number to a 2-byte integer number.

short MemUnitsToInt2(string digits)

Parameters

Type Parameter name Description
String digits The string with the zoned representaion of the number.

Returns

Type Description
Int16 The 2-byte integer number equivalent to the zoned representation.

int MemUnitsToInt4(string digits)

Convert the zoned representation of a number to a 4-byte integer number.

int MemUnitsToInt4(string digits)

Parameters

Type Parameter name Description
String digits The string with the zoned representaion of the number.

Returns

Type Description
Int32 The 4-byte integer number equivalent to the zoned representation.

long MemUnitsToInt8(string digits)

Convert the zoned representation of a number to a 8-byte integer number.

long MemUnitsToInt8(string digits)

Parameters

Type Parameter name Description
String digits The string with the zoned representaion of the number.

Returns

Type Description
Int64 The 8-byte integer number equivalent to the zoned representation.

string MergeLeft(string sourceValue, string targetValue)

RPG’s MoveLeft. Merge the sourceValue into targetValue starting at position 0.

string MergeLeft(string sourceValue, string targetValue)

Parameters

Type Parameter name Description
String sourceValue Source value.
String targetValue Target value.

Returns

Type Description
String The result of the merge.

string MergeRight(string sourceValue, string targetValue)

RPG’s Move(Right). Merge the sourceValue into targetValue starting at the end of targetValue.

string MergeRight(string sourceValue, string targetValue)

Parameters

Type Parameter name Description
String sourceValue Source value.
String targetValue Target value.

Returns

Type Description
String The result of the merge.