move and edited output1 non-numeric: left justify the data in the memory location. if the length of...

7
Move and Edited Output 1 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! The MOVE Statement Rules for Receiving Field

Upload: asher-pearson

Post on 04-Jan-2016

212 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Move and Edited Output1 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

Move and Edited Output 1

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!

The MOVE Statement Rules for Receiving Field

Page 2: Move and Edited Output1 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

Move and Edited Output 2

Numeric Literal B PIC MEMORY 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 numeric-literal TO B.Fill in every memory location for B… use a b (lower case letter b) to denote a blank

THE MOVE STATEMENT cont

Page 3: Move and Edited Output1 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

Move and Edited Output 3

Non-NumericLiteral B PIC MEMORY LOCATIONS FOR B

kitty A(10) _________________________

kitty X(8) _________________________

10 caps A(10) _________________________

10 caps X(5) _________________________

MOVE non-numeric-literal TO B.Fill in every memory location for B… use a b (lower case letter b) to denote a blank

THE MOVE STATEMENT cont

Page 4: Move and Edited Output1 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

Move and Edited Output 4

Legal and Illegal MOVEs

Type of Move Legal?Alphabetic to alphabetic YesAlphabetic to alphanumeric YesAlphabetic to alphanumeric edited Yes

Alphanumeric to alphanumeric YesAlphanumeric to alphanumeric edited YesAlphanumeric to alphabetic Only if sending field is alphabeticAlphanumeric to numeric Only if sending field is an unsigned integerAlphanumeric to numeric edited Only if sending field is an unsigned integer

Numeric to numeric YesNumeric to numeric edited YesNumeric to alphanumeric Only if sending field is an unsigned integerNumeric to alphanumeric edit Only if sending field is an unsigned integerNumeric edited to numeric Yes, to de-edit a field

Alphanumeric edited to alphanumeric Yes, but does not de-edit a field

Page 5: Move and Edited Output1 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

Move and Edited Output 5

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

Page 6: Move and Edited Output1 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

Move and Edited Output 6

Value of Picture ofSending Field Receiving Field Edit Result392380401 XXXBXXBXXXX 392b38b040103212000 XX/XX/XXXX 03/21/2000392380401 999B99B9999 392b38b04013212000 99/99/9999 03/21/2000125 999000 125000125 999,000 125,000123.45 ZZZ.99 123.451.23 ZZZ.99 bb1.231420.90 Z,ZZZ.99 1,420.9012.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-

Edited Output ExamplesREMINDER: the length of the “picture of receiving field” will always be the same length as the “edit result”

Page 7: Move and Edited Output1 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

Move and Edited Output 7

Value of Picture ofSending Field Receiving Field Edit Result1234 $ZZZ,ZZZ $bb1,2341234.56 $ZZZZ.99 $1234.5611234.56 $ZZZZ.99 $1234.561420.90 $$,$$$.99 $1,420.9012.42 $$,$$$.999 bbb$12.4201420.90 $*,***.99 $1,420.9012.42 $*,***.99 $***12.421234.56 **,***.99 *1,234.561420.90 ++,+++.99 +1,420.90-1420.90 ++,+++.99 -1,420.9012.42 ++,+++.99 bbb+12.42-12.42 ++,+++.99 bbb-12.421420.90 --,---.99 1,420.90-1420.90 --,---.99 -1,420.9012.42 --,---.99 bbbb12.42-12.42 --,---.99 bbb-12.42

Edited Output Examples cont

REMINDER: the length of the “picture of receiving field” will always be the same length as the “edit result”