Module 5: Data Division
JUSTIFIED/JUST clause
- By default, the alphanumeric or alphabetic data items are left justified.
- In case of data movement to alphabetic or alphanumeric data items, the receiving field receives data from left to right. If sending field is larger in length than receiving field, the extra characters at right side are truncated. If sending field is smaller in length than receiving field, the blanks are inserted in remaining positions (on right) of receiving field.
- Specifying ‘JUSTIFIED RIGHT’ or ‘JUST RIGHT’ in alphanumeric or alphabetic data item declaration, overrides the default left-justified alignment.
- General format:-
{ JUSTIFIED | JUST } RIGHT
- When you specify ‘JUSTIFIED RIGHT’ in declaration of receiving field. During data movement, the receiving field receives data from right to left. Truncation or space-fill, if necessary takes place on left side of receiving field.
- This clause can be specified only for alphanumeric or alphabetic data items
- This clause can be specified only for receiving data item. It has no effect on storage allocations.
- This clause cannot be used for numeric or numeric-edited data items as numeric data items are always aligned by the decimal point(if no decimal point then it is by default right justified)
- This clause cannot be used with 66 and 88 level items
- Example:-
We are moving data from A to B using MOVE verb(< LINK >)COBOL Code:- MOVE A TO B.