Summary -

In this topic, we described about the below sections -

Justification applies to Numeric, Alphabetic and Alpha-numeric data types. Numeric data type is always right justified. Alphabet and alphanumeric data types are left justified.

Numeric Justification -

Case-1: - Input data is larger than the declared data item size .If the number of digits in the input are larger than the actual data item declared size, the digits assigned to the data item from right to left and the excess digits gets ignored. The data item can have those many digits that are equal to the size of the data item.

Case-2: - Input data is smaller than the declared data item size . If the number of digits in the input are smaller than the actual data item declared size, the digits assigned to the data item from right to left. The remaining digits in the data item are filled with ZEROES.

Practical Example - Numeric:
Numeric Justification Code

NUMERIC-J1 declared with of length 3 and NUMERIC-J2 declared with of length 9.

256128 value moved to both fields.

After moving, NUMERIC-J1 is smaller than the value passed. Because of right justification the value should move from right to left upto the length declared.

So NUMERIC-J1 had the value 128.

After moving, NUMERIC-J2 is larger than the value passed. Because of right justification the value should move from right to left upto the length declared.

So NUMERIC-J2 had the value ooo256128.

Output:

Numeric Justification Output

Alpha-Numeric/Alphabetic Justification -

Case-1: - Input data is larger than the declared data item size . If the number of characters in the input are larger than the actual data item declared size, the characters assigned to the data item from left to right and the excess characters gets ignored. The data item can have those many characters that are equal to the size of the data item.

Case-2: - Input data is smaller than the declared data item size .If the number of characters in the input are larger than the actual data item declared size, the characters assigned to the data item from left to right. The remaining characters in the data item are filled with LOW-VALUES or HIGH-VALUES.

Practical Example - Alphabetic:
Alphabetic Justification Code

ALPHA-J1 declared with of length 10 and NUMERIC-J2 declared with of length 20.

MAINFRAMESTECHHELP value moved to both fields.

After moving, ALPHA-J1 is smaller than the value passed. Because of right justification the value should move from left to right upto the length declared.

So ALPHA-J1 had the value MAINFRAMES.

After moving, ALPHA -J2 is larger than the value passed. Because of right justification the value should move from left to right upto the length declared.

So ALPHA -J2 had the value MAINFRAMESTECHHELP.

Output:

Alphabetic Justification Output
Practical Example - Alphanumeric:
Alphanumeric Justification Code

ALPHA-J1 declared with of length 10 and NUMERIC-J2 declared with of length 20.

MAINFRAMESTECHHELP value moved to both fields.

After moving, ALPHA-J1 is smaller than the value passed. Because of right justification the value should move from left to right upto the length declared.

So ALPHA-J1 had the value MAINFRAMES.

After moving, ALPHA -J2 is larger than the value passed. Because of right justification the value should move from left to right upto the length declared.

So ALPHA -J2 had the value MAINFRAMESTECHHELP.

ALPHA-J3 declared with of length 10 and NUMERIC-J2 declared with of length 20.

256123 value moved to both fields.

After moving, ALPHA-J3 is smaller than the value passed. Because of right justification the value should move from left to right upto the length declared.

So ALPHA-J3 had the value 256.

After moving, ALPHA –J4 is larger than the value passed. Because of right justification the value should move from left to right upto the length declared.

So ALPHA –J4 had the value 256123.

Output:

Alphanumeric Justification Output