Download presentation
Presentation is loading. Please wait.
Published byValerie Haynes Modified over 9 years ago
1
Chapter 7 – Editing and Coding Standards Numeric field types –Numeric –Numeric-edited Use these only for the fields you define for printing purposes
2
STUDENT NAMECREDITSTUITION UNION FEE ACT FEESCHOLARSHIP TOTAL BILL SMITH JB 15003000 025 075 00000003100 JAMES HR 15003000 000 075 00000003075 BAKER SR 09001800 000 050 00500001350 PART-TIMER JR 03000600 025 025 00000000650 JONES PL 15003000 025 075 00000003100 HEAVYWORKER HM 18003600 000 075 00000003675 LEE BL 18003600 000 075 00000003675 CLARK JC 06001200 000 025 00000001225 GROSSMAN SE 07000600 000 025 00000001450 FRANKEL LF 10002000 000 050 00000002050 BENWAY CT 03000600 000 025 00250000375 KERBEL NB 04000800 000 025 00000000825 -------- ------- ------- -------- --------- 024500 0075 0625 000750024550 (a) Without Editing Figure 7.1 Comparison of Outputs (a)
3
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 3 600 $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 7 600 $25 $1,450 FRANKEL LF 10 $2,000 $50 $2,050 BENWAY CT 3 600 $25 $250 $375 KERBEL NB 4 800 $25 $825 LUCKY ONE FR 9 $1,800 $50 $2,000 $150CR -------- ------- ------- -------- --------- $26,400 $75 $675 $2,750$24,400 (b) With Editing Figure 7.1 Comparison of Outputs (b)
4
Editing characters –Decimal point Actual decimal point Implied decimal point 05 Field-A PIC 9v99. 05 Field-A-Edited PIC 9.99. –Zero suppression Gets rid of the left side zeros 05 FIELD-B PIC 9(5). 05 FIELD-B-EDITED PIC ZZZZ9. –Dollar sign Fixed –05 FIELD-D PIC 9(4). –05 FIELD-D-EDITED PIC $ZZZ9. Floating –05 FIELD-D-EDITED PIC $$$$9. –Receiving field must be one character bigger than the sending field
5
–Comma 05 FIELD-E PIC 9(4). 05 FIELD-E-EDITED PIC $$,$$9. In this example 2 extra spaces needed –Check protection Used when printing a check to avoid blank spaces between a fixed dollar sign and first digit. 05 FIELD-G-EDITED PIC $**,**9. –Insertion characters /, BLANK (B), 0 Printed exactly where they appear in the PIC statement 05 FIELD-H PIC 9(6). 05 FIELD-H-EDITED PIC 99/99/99.
6
Signed numbers –Require a ‘S’ in the PIC clause – signed field FIELD-A PIC S99 VALUE - 20 –Default is positive if no ‘S’ even if the result of a calculation is negative. –CR and DB symbols Credit and debit Treats them identically Only shows CR or DB if value is negative –Plus and minus signs BLANK WHEN ZERO clause –Use after a PIC clause 05 UNION-FEE PIC $$$9.99 BLANK WHEN ZERO.
7
Table 7.1 Editing Characters CHARACTERMEANINGCHARACTERMEANING.Actual decimal pointBBlank ZZero suppression/Slash $Dollar signCRCredit character,CommaDBDebit character *Check protection+Plus sign 0Zero-Minus sign
8
Table 7.3 CR and DB Editing Characters SOURCE FIELDRECEIVING FIELD PICTUREVALUEPICTUREVALUE S9(5) 98765 S9(5)-98765 $$$,999CR$98,765 $$$,999CR$98,765CR $$$,999DB$98,765 $$$,999DB$98,765DB a. b. c. d.
9
Table 7.4 Floating Plus and Minus Sign 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)-1234 ++,++++1,234 ++,+++ +123 ++,+++-1,234 --,--- 1,234 --,--- 123 --,----1,234 ZZ,ZZ9+ 1,234+ ZZ,ZZ9- 1,234- a. b. c. d. e. f. g. h.
10
Coding standards –If someone else must edit your program –Data division Meaningful data names –X or IN-EMPLOYEE-NAME Consistent data name prefixes –Within the same record (01) or File Descriptor (FD) –IN-… WS-… Column alignment of picture clauses –This helps check that the PIC clause is correct Standard format for picture clause –PIC, PICTURE, PIC IS use only one Consistent indentation of level numbers Avoidance of 77-level entries
11
Procedure division –Development of functional paragraphs Useful names, READ-FILE, WRITE-HEADING –Sequencing of paragraph names 100-WRITE-HEADER, 200-READ-FILE Used to locate paragraph header quickly –Avoidance of commas –Use scope terminators Ex, END-IF, END-READ –Consistent indentation Readability –Use of Spaces –Avoidance of literals or constants in the procedure division –Don’t over comment Use care when commenting
12
Make the PIC clause: Page 191 –1.a Floating $, omission of cents, printing of commas, max value of $9,999,999 –c. fixed dollar sign, zero suppression of insignificant leading zeros, no commas, max value of $99,999.99 –d. floating $, use of commas, max value of $9,999.00 and trailing CR if negative.
13
1.9(6)1234569(6) 2.9(6)1234569(8) 3.9(6)1234569(6).99 4.9(4)V991234569(6) 5.9(4)V991234569(4) 6.9(4)V99123456$$$$$9.99 7.9(4)V99123456$$$,$$9.99 8.9(6)123456$$$$,$$9.99 9.9(6)123456Z(8) 10.9(4)V99123456$ZZZ,ZZZ.99
14
1.S9(4)V9945600$$$$$.99CR 2.S9(4)V9945600$$,$$$.99DB 3.S9(4)4567$$,$$$.00 4.S9(6)12257799B99B99 5.S9(6)123456++++,+++ 6.S9(6)-123456++++,+++ 7.S9(6)123456----,--- 8.S9(6)-123456----,--- 9.9(4)V99567890$$$$,$$$.99 10.9(4)V99567890$ZZZ,ZZZ.99 11.9(4)V99567890$***,***.99
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.