70 likes | 179 Views
The MOVE Statement Rules for Receiving Field.
E N D
The MOVE Statement Rules for Receiving Field NON-NUMERIC: Left justify the data in the memory location. If the length of the data is smaller than the length of the field (as defined by the pic clause), fill to the right with blanks. If the length of the data is larger than the length of the field (as defined by the pic clause), truncate the data that does not fit into the memory location. NUMERIC integer portion: Right justify the data in the integer portion of the memory location. If the length of the data is smaller than the length of the integer portion of the field (as defined by the pic clause), then fill to the left with zeros. If the length of the data is larger than the length of the integer portion of the field (as defined by the pic clause), then truncate the data to the left that does not fit into the memory location. NUMERIC decimal portion: Left justify the data into the decimal portion of the memory location. If the length of the data is smaller than the length of the decimal portion of the field (as defined by the pic clause), then fill to the right with zeros. If the length of the data is larger than the length of the decimal portion of the field (as defined by the pic clause), then truncate the data to the right that does not fit into the memory location. SIGN: The S character in a PIC clause denotes that the data for that memory location can be a positive or negative value. The sign, however, does not take up a position in memory! FYI: Remember that truncation is used… not rounding! Move and Edited Output
THE MOVE STATEMENT cont MOVE numeric-literal TO B. Fill in every memory location for B… use a b (lower case letter b) to denote a blank Numeric LiteralB PICMEMORY LOCATIONS FOR B 123456 9(6) _________________________ 123456 9(5) _________________________ 123456 9(8) _________________________ 1234.56 9(5) _________________________ 123.456 9(4)V99 _________________________ 1234.56 9(6)V9(3) _________________________ 1234.56 9(6)V9 _________________________ 1234.56 9(3)V9 _________________________ 12345 S9(6) _________________________ -12345 S9(6) _________________________ -12345 9(6) _________________________ Move and Edited Output
THE MOVE STATEMENT cont MOVE non-numeric-literal TO B. Fill in every memory location for B… use a b (lower case letter b) to denote a blank Non-Numeric LiteralB PICMEMORY LOCATIONS FOR B kitty A(10) _________________________ kitty X(8) _________________________ 10 caps A(10) _________________________ 10 caps X(5) _________________________ Move and Edited Output
Legal and Illegal MOVEs Type of MoveLegal? Alphabetic to alphabetic Yes Alphabetic to alphanumeric Yes Alphabetic to alphanumeric edited Yes Alphanumeric to alphanumeric Yes Alphanumeric to alphanumeric edited Yes Alphanumeric to alphabetic Only if sending field is alphabetic Alphanumeric to numeric Only if sending field is an unsigned integer Alphanumeric to numeric edited Only if sending field is an unsigned integer Numeric to numeric Yes Numeric to numeric edited Yes Numeric to alphanumeric Only if sending field is an unsigned integer Numeric to alphanumeric edit Only if sending field is an unsigned integer Numeric edited to numeric Yes, to de-edit a field Alphanumeric edited to alphanumeric Yes, but does not de-edit a field Move and Edited Output
Edited Output Characters REMEMBER… each character holds a place in memory EX. $9,999.99 1. Insertion characters (alphnumeric editing) B and / can be used in the picture clause and that positions takes on a blank space or the / character 2. Insertion characters (numeric editing) same as above using B / and 0 3. Zero suppression (numeric editing) the letter Z denotes a blank if position is zero 4. Sign control plus and minus sign to the right of the field; + denotes that you want the sign to show; - denotes that you only want the sign to show up if the value is negative… still holds a place in memory, but is blank 5. Fixed dollar sign $ always shows up in the placed position 6. Floating dollar sign $ shows up to the left of the most significant digit; non-significant positions are filled in with blanks (including commas!) 7. Check protection asterisks (*) show up to the left of the most significant digit 8. Floating plus sign + (see floating $ and sign control) 9. Floating minus sign - (see floating $ and sign control 10. Other comma and decimal point Move and Edited Output
Edited Output Examples REMINDER: the length of the “picture of receiving field” will always be the same length as the “edit result” Value of Picture of Sending Field Receiving Field Edit Result 392380401 XXXBXXBXXXX 392b38b0401 03212000 XX/XX/XXXX 03/21/2000 392380401 999B99B9999 392b38b0401 3212000 99/99/9999 03/21/2000 125 999000 125000 125 999,000 125,000 123.45 ZZZ.99 123.45 1.23 ZZZ.99 bb1.23 1420.90 Z,ZZZ.99 1,420.90 12.42 Z,ZZZ.99 bbb12.42 .09 Z,ZZZ.99 bbbbb.09 1234 ZZZ,ZZZ- bb1,234b -1234 ZZZ,ZZZ- bb1,234- 1234 ZZZ,ZZZ+ bb1,234+ -1234 ZZZ,ZZZ+ bb1,234- Move and Edited Output
Edited Output Examples cont REMINDER: the length of the “picture of receiving field” will always be the same length as the “edit result” Value of Picture of Sending Field Receiving Field Edit Result 1234 $ZZZ,ZZZ $bb1,234 1234.56 $ZZZZ.99 $1234.56 11234.56 $ZZZZ.99 $1234.56 1420.90 $$,$$$.99 $1,420.90 12.42 $$,$$$.999 bbb$12.420 1420.90 $*,***.99 $1,420.90 12.42 $*,***.99 $***12.42 1234.56 **,***.99 *1,234.56 1420.90 ++,+++.99 +1,420.90 -1420.90 ++,+++.99 -1,420.90 12.42 ++,+++.99 bbb+12.42 -12.42 ++,+++.99 bbb-12.42 1420.90 --,---.99 1,420.90 -1420.90 --,---.99 -1,420.90 12.42 --,---.99 bbbb12.42 -12.42 --,---.99 bbb-12.42 Move and Edited Output