Lesson 5 Packed-Decimal or Computational-3 (COMP-3) MOVE 8649008 TO WS-AMOUNT 86 49 00 8 ====> 4 bytes instead of 7. Significant storage saving. On the.

Slides:



Advertisements
Similar presentations
DT266/2 Information Systems COBOL Revision. Chapters 1 & 2 Hutty & Spence Divisions of a Cobol Program Identification Division Program-ID. Environment.
Advertisements

Chapter 12 Array Processing and Table Handling. Defining Series of Input Fields Coding record with 24 independent hourly fields is cumbersome 01Temp-Rec.
Chapter 4 The Identification, Environment, and Data Divisions.
Figure 3.4The Building Blocks of Structured Programming A B (a) Sequence BA CONDITION? (b) Selection : ENTRYEXIT A B N (d) Case CONDITION? A (c) Iteration.
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)
Chapter 15 Indexed Sequential Files. Disk File Organization File is collection of records Three major ways records stored or organized on disk - Sequential.
Topics Covered: Data preparation Data preparation Data capturing Data capturing Data verification and validation Data verification and validation Data.
Structured COBOL Programming, Stern & Stern, 9th edition
4-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)
12-1 Structured COBOL Programming Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout John.
4-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)
1 Chapter 4. To familiarize you with methods used to 1. Access input and output files 2. Read data from an input file 3. Perform simple move operations.
Chapter To familiarize you with  Why COBOL is a popular business-oriented language.  Programming practices and techniques  History of COBOL.
Chapter 13 Sequential File Processing. Master Files Set of files used to store companies data in areas like payroll, inventory Usually processed by batch.
Structured COBOL Programming Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout.
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!
History COBOL (Common Business Oriented Language) was one of the earliest high-level programming languages. COBOL was first proposed in 1959 by the Conference.
Presentation © Copyright 2002, Bryan Meyers Externally Described Files Chapter 6.
Agenda  Commenting  Inputting Data from Keyboard (scanf)  Arithmetic Operators  ( ) * / + - %  Order of Operations  Mixing Different Numeric Data.
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.
Agenda Reporting Work on Assignment 4! Printing on power systems.
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.
UNIT 1 UNIT 1 Stephen S. Linkin Houston Community College System 8/28/ Copywrite © Houston Community College System 2007 Graphics Courtesy of IBM.
1 Interactive vs Batch Programs Cobol suited for developing both types of programs Interactive programs Accept input data from keyboard Input data processed.
CS CS Computing for Business Instructor:David Tucker GTA:Batul Mirza.
Printing on power systems Program/ Command Data Report Layout (Printer File) Job Output Queue *FILE Spooled File.
1 Chapter – 12 Table Lookups Table Codes –Expanded Values –Types of Codes Numeric Alphabetic Alphanumeric.
To familiarize you with  Options of MOVE statement  Rules for moving fields and literals  Printing edit symbols  Designing and printing reports 1.
1 The Procedure Division Chapter 4. 2 Main Two Sections File Section –Used to define files and record formats –Field names within records Working Storage.
13-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)
Sequential Files Chapter 13. Master Files Set of files used to store companies data in areas like payroll, inventory Set of files used to store companies.
Statement Syntax1 THE SELECT STATEMENT Purpose: designates a file and points to its physical location Syntax Definition : SELECT file-name-1 ASSIGN TO.
CPSC3111/CISM3111 COBOL Structured COBOL Programming Text: murach’s structured COBOL Authors: Murach, Prince, Menendez.
Structured COBOL Programming Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout.
Explanation of SAMPLEIF (if88in1.cbl or if88in1.html) Please use speaker notes for additional information!
1 The Data Division. 2 Main Two Sections File Section –Used to define files and record formats –Field names within records Working Storage Section –All.
Figure 9.9Duplicate Data Names 01 STUDENT-RECORD. 05 STUDENT-NAMEPIC X(20). 05 SOCIAL-SECURITY-NUMPIC 9(9). 05 STUDENT-ADDRESS. 10 STREETPIC X(15). 10.
Lecture 61 Editted Output Editing Functions –Two broad classes : A) insertion and B) replacement and suppression 1.Printing decimal points 2.Suppressing.
11- 1 Chapter 11.  Avoiding Logic Errors by Validating Input  What to Do If Input Errors Occur  Global Considerations in COBOL  When Data Should Be.
Any Questions!. Test Coming Up! Agenda Printing with Externally Described Printer Files Arrays.
1 Chapter 5 – The Procedure Division File handling statements –OPEN statement Initiates processing for a file Input Output Each file opened must have been.
13-1 Sequential File Processing Chapter Chapter Contents Overview of Sequential File Processing Sequential File Updating - Creating a New Master.
PowerPoint Presentation: Richard H. Baum, Ph.D. DeVry Institute of Technology 9th Edition Structured COBOL Programming Nancy Stern Hofstra University Robert.
PowerPoint Presentation: Richard H. Baum, Ph.D. DeVry Institute of Technology 9th Edition Structured COBOL Programming Nancy Stern Hofstra University Robert.
1.  Introduction  The Benefits of the Report Writer Module ◦ For Detail and Summary Printing ◦ For Control Break Processing ◦ For Printing Headings.
Lecture 21 ENVIRONMENT DIVISION  defines files external to the program and devices.  contains two sections: 1.CONFIGURATION SECTION.  identifies computers.
Any Questions? Week 1 - 2nd Lecture Intro to COBOL Programming Defining Files and Processing Data.
COBOL for the 21 st Century Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout (Emeritus)
This is It! It’s been a pleasure! Final Exam – format True / false 5 Multiple choice 5 Short answers10 Data manipulation10 SQL 3 Array’s12 File processing25.
Analysis of SAMPLE1.CBL Please check speaker notes for additional information!
11- 1 Chapter 11.  Avoiding Logic Errors by Validating Input  What to Do If Input Errors Occur  Global Considerations in COBOL  When Data Should Be.
Chapter 4 PROCEDURE DIVISION. Paragraphs PROCEDURE DIVISION divided into paragraphs Each is independent module or routine Made up of series of instructions.
Week 2/3 - 2nd Lecture Intro to COBOL Programming Defining Files and Processing Data.
Submitting Instructions on web site CS 1024 students Read guide
Designing and Debugging Batch and Interactive COBOL Programs
Any Questions?.
Chapter 3 The DATA DIVISION.
An Introduction to Structured Program Design in COBOL
Structured COBOL Programming
Chapter 14 Sorting and Merging.
Scope and System Time/Date
SCOPE TERMINATORS Definition:
Computing in COBOL: The Arithmetic Verbs and Intrinsic Functions
CHAPTER 17 The Report Writer Module
Any Questions?.
Presentation transcript:

Lesson 5

Packed-Decimal or Computational-3 (COMP-3) MOVE TO WS-AMOUNT ====> 4 bytes instead of 7. Significant storage saving. On the AS/400 numeric zoned decimal field is –converted to packed decimal format – Arithmetic is performed –converted back to zoned decimal format.

Report CPCH04A BEST DEAL STORES 09/18/00 EMPLOYEE HOURS WORKED REPORT PAGE 1 EMPLOYEE HOURS HOURLY NUMBER EMPLOYEE NAME WORKED RATE SALES SMITH $80, MARY $8, LARRY $18,000.00

01 HEADING PIC X(5) VALUE SPACES. 05 PIC X(7) VALUE 'CPCH04A'. 05 PIC X(18) VALUE SPACES. 05 PIC X(16) VALUE 'BEST DEAL STORES'. PRINT-RECORD-OUT 01 DETAIL-LINE. 05 PIC X(8) VALUE SPACES. 05 EMPLOYEE-NUMBER-OUT PIC 999B99B PIC X(5) VALUE SPACES. 05 LAST-NAME-OUT PIC X(15). 05 PIC X(5) VALUE SPACES. 05 HOURS-WORKED-OUT PIC Z(2) PIC X(5) VALUE SPACES. 05 HOURLY-RATE-OUT PIC Z(3) PIC X(5) VALUE SPACES. 05 SALES-OUT PIC $$$,$$9.99-.

Data Division fields must be initialized. –VALUE –PROCEDURE DIVISION. Move Input fields to output fields in the DETAIL-LINE record before printing.

FD EMPLOYEE-FILE DATA RECORD IS EMPLOYEE-RECORD. 01 EMPLOYEE-RECORDPIC X(60).... WORKING-STORAGE SECTION. 01 FILLERPIC X(14) VALUE ‘WS BEGINS HERE’. 01 WS-EMPLOYEE-RECORD. 05 EMP-NAMEPIC X(25).... PROCEDURE DIVISION.... READ EMPLOYEE-FILE INTO WS-EMPLOYEE-RECORD AT END MOVE ‘NO’ TO DATA-REMAINS-SWITCH NOT AT END PERFORM PROCESS-THIS-RECORD END-READ. Figure 9.3The READ INTO statement

The WRITE FROM statement (a) Two instruction process FD PRINT-FILE DATA RECORD IS PRINT-LINE. 01 PRINT-LINEPIC X(80). PROCEDURE DIVISION.. MOVE HEADING-LINE TO PRINT-LINE. WRITE PRINT-LINE AFTER ADVANCING PAGE. FD PRINT-FILE DATA RECORD IS PRINT-LINE. 01 PRINT-LINEPIC X(80) HEADING-LINE. 03 PIC X(17) VALUE SPACES. 03 PIC X(25) VALUE ‘ INVENTORY REPORT PREPARED BY GARPL’. PROCEDURE DIVISION... WRITE PRINT-LINE FROM HEADING-LINE AFTER ADVANCING PAGE. (b) One instruction process

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 Figure 7.1 Comparison of Outputs (a)

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 Figure 7.1 Comparison of Outputs (b)

Table 7.1 Editing Characters CHARACTERMEANINGCHARACTERMEANING.Actual decimal pointBBlank ZZero suppression/Slash $Dollar signCRCredit character,CommaDBDebit character *Check protection+Plus sign 0Zero-Minus sign

Table 7.2 Review of Editing Characters 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.

Data Division –Choose meaningful names –Prefix all data names within the same FD or 01 with tow or three characters unique to the FD –Begin all PICTURE clauses in the same column –Choose one form of PICTURE clause –Indent successive level numbers under an 01 consistently –Avoid 77-level entries Coding Standards Procedure Division –Develop functional paragraphs –Sequence paragraph names –Avoid Commas –Use scope terminators –Indent Both Divisions –Space attractively –Avoid constants –Don’t overcomment