lecture 61 Editted Output Editing Functions –Two broad classes : A) insertion and B) replacement and suppression 1.Printing decimal points 2.Suppressing leading zeros 3.Printing dollar signs and commas 4.Insertion characters 5.Printing asterisks for check protection 6.Signed Numbers 1, 2, 3, 5, and 6 are only for numeric fields 4 is for any data field
lecture 62 Report Item An item whose PIC clause performs an editing function Can appear in the GIVING option, MOVE, and COMPUTE statements Make your report look nicer!
lecture 63 STUDENT NAMECREDITSTUITION UNION FEE ACT FEESCHOLARSHIP TOTAL BILL SMITH JB JAMES HR BAKER SR PART-TIMER JR JONES PL HEAVYWORKER HM LEE BL CLARK JC GROSSMAN SE FRANKEL LF BENWAY CT KERBEL NB (a) Without Editing STUDENT NAMECREDITSTUITION UNION FEE ACT FEESCHOLARSHIP TOTAL BILL SMITH JB 15 $3,000 $25 $75 $3,100 JAMES HR 15 $3,000 $75 $3,075 BAKER SR 9 $1,800 $50 $500$1,350 PART-TIMER JR $25 $25 $650 JONES PL 15 $3,000 $25 $75 $3,100 HEAVYWORKER HM 18 $3,600 $75 $3,675 LEE BL 18 $3,600 $75 $3,675 CLARK JC 6 $1,200 $25 $1,225 GROSSMAN SE $25 $1,450 FRANKEL LF 10 $2,000 $50 $2,050 BENWAY CT $25 $250 $375 KERBEL NB $25 $825 LUCKY ONE FR 9 $1,800 $50 $2,000 $150CR $26,400 $75 $675 $2,750$24,400 (b) With Editing
lecture 64 Printing Decimal Points : ‘.’ V does not use a position in storage –PIC 99V9 for 12.3 stored as 123 Decimal point does occupy a storage position
lecture 65 Decimal Points Sending Receiving Sending Receiving Picture Data Picture Result Picture Data Picture Result PIC 999V PIC PIC 999V PIC PIC 999V PIC PIC PIC Sending Receiving Sending Receiving Picture Data Picture Result Picture Data Picture Result PIC 999V PIC PIC 999V PIC PIC 999V PIC PIC PIC
lecture 66 Suppressing Leading Zeros : ‘Z’ ‘Z’ in a PIC replaces leading zeros with blanks –Thus, represents one storage position Representing the number zero (b is a blank) PIC ZZZ9 bbb0 PIC ZZZZ bbbb
lecture 67 Dollar Signs and Commas : ‘$’, ‘,’ You can place ‘$’ and ‘,’ anywhere in a PIC They take up a storage position ‘Z’ will suppress both zeros and commas until the first significant digit Value , $9,999, $0, $Z,ZZZ,ZZ9.99 $bbbb1,234.98
lecture 68 Suppressing Leading Zeros Sending Receiving Sending Receiving Picture Data Picture Result Picture Data Picture Result PIC 9(5)12345PIC ZZ,999 PIC 9(5)01234PIC ZZ,999 PIC 9(5)00123PIC ZZ,999 PIC 9(5)00012PIC ZZ,999 Sending Receiving Sending Receiving Picture Data Picture Result Picture Data Picture Result PIC 9(5)12345PIC ZZ,999 PIC 9(5)01234PIC ZZ,999 PIC 9(5)00123PIC ZZ,999 PIC 9(5)00012PIC ZZ,999 12,345 1,234 123 012
lecture 69 Fixed Insertion Characters : “B”, “0”, “/”, “,” Used as separators within fields Hold a position in storage Act as zero and comma suppression, just as “Z” does, except uses *’s instead of blanks Check Protection : “*”
lecture 610 Sending Receiving Sending Receiving Picture Data Picture Result Picture Data Picture Result PIC PIC 999,999 PIC 9(6)000078PIC 9(3),9(3) PIC 9(6)000078PIC ZZZ,ZZZ PIC 9(6)000178PIC ***,*** PIC 9(6)002178PIC ***,*** PIC 9(6)120183PIC 99B99B99 PIC 9(6)120183PIC 99/99/99 PIC 9(6) PIC Sending Receiving Sending Receiving Picture Data Picture Result Picture Data Picture Result PIC PIC 999,999 PIC 9(6)000078PIC 9(3),9(3) PIC 9(6)000078PIC ZZZ,ZZZ PIC 9(6)000178PIC ***,*** PIC 9(6)002178PIC ***,*** PIC 9(6)120183PIC 99B99B99 PIC 9(6)120183PIC 99/99/99 PIC 9(6) PIC , ,078 78 ****178 **2,178 120183 12/01/
lecture 611 Signed Numbers : “+”, “-” Can appear to the left or right of the number “+” –Always generates a sign, whether pos. or neg. “-” –If the number is pos., the sign is omitted
lecture 612 Sending Receiving Sending Receiving Picture Data Picture Result Picture Data Picture Result PIC S PIC -999 PIC S PIC 999- PIC S PIC -999 PIC S9(5)+12345PIC +9(5) PIC S9(3)-123PIC +9(3) PIC S9(3)-123PIC 999+ Sending Receiving Sending Receiving Picture Data Picture Result Picture Data Picture Result PIC S PIC -999 PIC S PIC 999- PIC S PIC -999 PIC S9(5)+12345PIC +9(5) PIC S9(3)-123PIC +9(3) PIC S9(3)-123PIC
lecture 613 Floating Strings : “$”, “+”, “-” Suppression of zeros into blanks Causes the floating character to appear adjacent to the first significant digit Can use only on the left side
lecture 614 Sending Receiving Sending Receiving Picture Data Picture Result Picture Data Picture Result PIC 9(4) 0000PIC $$,$$9.99 PIC 9(4) 0080PIC $$,$$9.00 PIC 9(4) 0128PIC $$,$$9.99 PIC 9(5) 57397PIC $$,$$9 PIC S9(4)- 0005PIC PIC S9(4)+0080PIC PIC S9(4)- 0080PIC PIC S9(5)+71234PIC Sending Receiving Sending Receiving Picture Data Picture Result Picture Data Picture Result PIC 9(4) 0000PIC $$,$$9.99 PIC 9(4) 0080PIC $$,$$9.00 PIC 9(4) 0128PIC $$,$$9.99 PIC 9(5) 57397PIC $$,$$9 PIC S9(4)- 0005PIC PIC S9(4)+0080PIC PIC S9(4)- 0080PIC PIC S9(5)+71234PIC $0.00 $80.00 $ $7,
lecture 615 SOURCE FIELDRECEIVING FIELD PICTUREVALUEPICTUREVALUE S9(4) 1234 S9(4) 0123 S9(4)-1234 S9(4) 1234 S9(4) 0123 S9(4)-1234 S9(4) 1234 S9(4) ,++++1,234 ++, ,+++-1,234 --,--- 1,234 --, ,----1,234 ZZ,ZZ9+ 1,234+ ZZ,ZZ9- 1,234- a. b. c. d. e. f. g. h.
lecture 616 Summary, B 0 / Simple Insertion. Special Insertion + - $ Fixed Insertion + - $ Floating Insertion Z * Suppression and Replacement, B 0 / Simple Insertion. Special Insertion + - $ Fixed Insertion + - $ Floating Insertion Z * Suppression and Replacement Edit Symbol Editing Type
lecture 617 More Examples SOURCE FIELDRECEIVING FIELD PICTUREVALUEPICTUREVALUE 9(4)0678 9(4)0678 9(4)0678 9(4)V (4)V (4)V (4)0008 9(4)V (4)V (5) (9) (4)1234 9(6) (6) z(4) 678 $9(4)$0678 $Z(4)$ 678 9(4) $9(4).99$ $9,999.99$1, $$,$$9 $8 9(4)1234 9(4) $****9$***45 999B99B $$,$$9.00$1, /99/9908/05/94 Z9/99/99 8/05/94 a. b. c. d. e. f. g. h. i. j. k. l. m. n.