Lecture 61 Editted Output Editing Functions –Two broad classes : A) insertion and B) replacement and suppression 1.Printing decimal points 2.Suppressing.

Slides:



Advertisements
Similar presentations
CPS120: Introduction to Computer Science INPUT/OUTPUT.
Advertisements

6-1 COBOL for the 21 st Century Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout (Emeritus)
3-1 COBOL for the 21 st Century Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout (Emertius)
7-1 COBOL for the 21 st Century Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout (Emeritus)
The Print Formatting Statement … named printf. 2 Introduction to printf statements print and println statements don’t allow us to easily format output.
Lesson 5 Packed-Decimal or Computational-3 (COMP-3) MOVE TO WS-AMOUNT ====> 4 bytes instead of 7. Significant storage saving. On the.
© 2006 Pearson Education. All Rights Reserved Starting Out with C++: Early Objects 5/e Starting Out with C++: Early Objects 5 th Edition Chapter 2 Introduction.
Chapter 9: Arrays and Strings
Basic Elements of C++ Chapter 2.
A First Book of ANSI C Fourth Edition
11 Chapter 3 DECISION STRUCTURES CONT’D. 22 FORMATTING FLOATING-POINT VALUES WITH THE DecimalFormat CLASS We can use the DecimalFormat class to control.
Chapter 9 Formatted Input/Output. Objectives In this chapter, you will learn: –To understand input and output streams. –To be able to use all print formatting.
Chapter 2 Basic SQL SELECT Statements Oracle 10g: SQL.
3-1 COBOL for the 21 st Century Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout (Emertius)
Modifications to program Addda.cbl Please use speaker notes for additional information!
CSC 162 Visual Basic I Programming. Randomizing and Formatting Randomizing Formatting –User-Defined Formats –Named Numeric Formats.
Chapter 5 Using Data and COBOL Operators. Initializing Variables When you define a variable in WORKING- STORAGE, you also can assign it an initial value.
Chapter 7 – Editing and Coding Standards Numeric field types –Numeric –Numeric-edited Use these only for the fields you define for printing purposes.
6-1 Structured COBOL Programming Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout John.
Input, Output, and Processing
Agenda Reporting Work on Assignment 4! Printing on power systems.
7-1 Structured COBOL Programming Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout John.
Chapter 2: Using Data.
Lecture 31 Numeric Edited Alphabetic (A) AlphaNumeric (X) Numeric (9, V, S) Numeric Edited (9, Z, comma, decimal point, minus sign) –Z = zero suppressed.
The DATA DIVISION Chapter 3. COBOL Data Organization Field - group of characters forming a meaningful unit or basic fact –Characters in a name or digits.
3-1 Chapter 3. To familiarize you with  Ways in which data is organized in COBOL  Rules for forming data-names  Defining input and output files in.
3-1 The DATA DIVISION Chapter Chapter Objectives To familiarize you with Systems design considerations Ways in which data is organized Rules for.
Printing on power systems Program/ Command Data Report Layout (Printer File) Job Output Queue *FILE Spooled File.
Characters and tokens Characters are the basic building blocks in C program, equivalent to ‘letters’ in English language Includes every printable character.
To familiarize you with  Options of MOVE statement  Rules for moving fields and literals  Printing edit symbols  Designing and printing reports 1.
Course Title: Object Oriented Programming with C++ instructor ADEEL ANJUM Chapter No: 03 Conditional statement 1 BY ADEEL ANJUM (MSc-cs, CCNA,WEB DEVELOPER)
Chapter 3: Formatted Input/Output Copyright © 2008 W. W. Norton & Company. All rights reserved. 1 Chapter 3 Formatted Input/Output.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 2 Input, Processing, and Output.
Lecture 41 Arithmetic Clauses The ROUNDED clause –Place ROUNDED after the variable that holds the result ADD A TO B ROUNDED. ADD A TO B GIVING C ROUNDED.
More Syntax in COBOL  Moving Data  Selection Statements  System Date  Indicators in Display files.
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.
Arithmetic and Edited Pictures. Arithmetic Verb Template  Most COBOL arithmetic verbs conform to the template above. For example; ADD Takings TO CashTotal.
7-1 COBOL for the 21 st Century Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout (Emeritus)
Copyright Curt Hill Variables What are they? Why do we need them?
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 2: Introduction to C++ Starting Out with C++ Early Objects Sixth.
Chapter 3 – Variables and Arithmetic Operations. Variable Rules u Must declare all variable names –List name and type u Keep length to 31 characters –Older.
PowerPoint Presentation: Richard H. Baum, Ph.D. DeVry Institute of Technology 9th Edition Structured COBOL Programming Nancy Stern Hofstra University Robert.
Programming Fundamentals. Overview of Previous Lecture Phases of C++ Environment Program statement Vs Preprocessor directive Whitespaces Comments.
Any Questions? Week 1 - 2nd Lecture Intro to COBOL Programming Defining Files and Processing Data.
Number Representation Lecture Topics How are numeric data items actually stored in computer memory? How much space (memory locations) is.
Operating System Discussion Section. The Basics of C Reference: Lecture note 2 and 3 notes.html.
CMP 131 Introduction to Computer Programming Violetta Cavalli-Sforza Week 5, Lecture 2 (Tuesday)
Chapter 4: Variables, Constants, and Arithmetic Operators Introduction to Programming with C++ Fourth Edition.
Chapter 3: Formatted Input/Output 1 Chapter 3 Formatted Input/Output.
+ Note On the Use of Different Data Types Use the data type that conserves memory and still accomplishes the desired purpose. For example, depending on.
6-1 COBOL for the 21 st Century Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout (Emeritus)
Chapter 4 Strings and Screen I/O. Objectives Define strings and literals. Explain classes and objects. Use the string class to store strings. Perform.
2.1 The Part of a C++ Program. The Parts of a C++ Program // sample C++ program #include using namespace std; int main() { cout
Topics Designing a Program Input, Processing, and Output
Chapter 2: Introduction to C++
BASIC ELEMENTS OF A COMPUTER PROGRAM
CPS120: Introduction to Computer Science
Formatted Input/Output
Chapter 3 The DATA DIVISION.
Computing in COBOL: The Arithmetic Verbs and Intrinsic Functions
Chapter 3: Expressions and Interactivity
Formatted Input/Output
Conversion Check your class notes and given examples at class.
Chapter 2: Introduction to C++.
Topics Designing a Program Input, Processing, and Output
Data Types and Expressions
Topics Designing a Program Input, Processing, and Output
Representation of real numbers
Any Questions?.
Decision Making Using the IF and EVALUATE Statements
Presentation transcript:

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 120183 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.