Getting Started Chapter 2 Presentation © Copyright 2002, Bryan Meyers

Slides:



Advertisements
Similar presentations
Database Basics. What is Access? Database management system Computer-based equivalent of a manual database Makes it easy to organize and update information.
Advertisements

CHAPTER 5 INPUT/OUT FORMAT. Introduction READ (*,*) x WRITE (*,*) x This is free format: the first * is for I/O device number (* = input is keyboard *
Chapter 3: Modules, Hierarchy Charts, and Documentation
2-1 Chapter 2.  Coding Requirements of IDENTIFICATION DIVISION  Sections of ENVIRONMENT DIVISION  Assigning Files to Devices in ENVIRONMENT DIVISION.
Chapter 2: Modularization
Modules, Hierarchy Charts, and Documentation
Programming Logic and Design Fourth Edition, Introductory
Presentation © Copyright 2002, Bryan Meyers Arithmetic and Assignment Operations Chapter 4.
The IDENTIFICATION and ENVIRONMENT DIVISIONS Chapter 2.
Writing a Complete Program
Chapter 2: Input, Processing, and Output
Modules, Hierarchy Charts, and Documentation
Understanding the Mainline Logical Flow Through a Program (continued)
Pseudocode.
- Meeting 4 – Writing a Complete Program
Chapter 3: Introduction to C Programming Language C development environment A simple program example Characters and tokens Structure of a C program –comment.
Basic Elements of C++ Chapter 2.
Chapter 8 Printing 1. In COBOL you send data to the printer by writing data to a file. In COBOL, the printer is defined as a file, and it is opened, closed,
Presentation © Copyright 2002, Bryan Meyers Defining Data with Definition Specifications Chapter 3.
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)
System Analysis and Design
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.
Fortran 1- Basics Chapters 1-2 in your Fortran book.
Simple Program Design Third Edition A Step-by-Step Approach
Chapter To familiarize you with  Why COBOL is a popular business-oriented language.  Programming practices and techniques  History of COBOL.
1 © 2000 John Urrutia. All rights reserved. Qbasic Constructing Qbasic Programs.
Presentation © Copyright 2002, Bryan Meyers Externally Described Files Chapter 6.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley STARTING OUT WITH Python Python First Edition by Tony Gaddis Chapter 2 Input,
Agenda Reporting Work on Assignment 4! Printing on power systems.
Computer Science 101 Introduction to Programming.
Systems development Dr. Al Bento University of Baltimore.
Lecture 31 Numeric Edited Alphabetic (A) AlphaNumeric (X) Numeric (9, V, S) Numeric Edited (9, Z, comma, decimal point, minus sign) –Z = zero suppressed.
1 Interactive vs Batch Programs Cobol suited for developing both types of programs Interactive programs Accept input data from keyboard Input data processed.
Presentation © Copyright 2002, Bryan Meyers Top-Down, Structured Program Design Chapter 5.
Printing on power systems Program/ Command Data Report Layout (Printer File) Job Output Queue *FILE Spooled File.
Chapter 17 Creating a Database.
6 Chapter 61 Looping Programming Logic and Design, Second Edition, Comprehensive 6.
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.
CPSC3111/CISM3111 COBOL Structured COBOL Programming Text: murach’s structured COBOL Authors: Murach, Prince, Menendez.
Welcome to RPG544. Bit about Cindy Administrative Stuff Standards Due Dates Web Page.
INPUT / OUTPUT STATEMENTS
Structured Programming
Structured COBOL Programming, Stern & Stern, 9th Edition CHAPTER 2 Cobol Language Fundamentals.
1 Chapter 5 – The Procedure Division File handling statements –OPEN statement Initiates processing for a file Input Output Each file opened must have been.
Presentation © Copyright 2002, Bryan Meyers Introduction to Programming and RPG Chapter 1.
PowerPoint Presentation: Richard H. Baum, Ph.D. DeVry Institute of Technology 9th Edition Structured COBOL Programming Nancy Stern Hofstra University Robert.
2-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)
CPS120: Introduction to Computer Science Introduction to C++
Chapter Topics 2.1 Designing a Program 2.2 Output, Input, and Variables 2.3 Variable Assignment and Calculations 2.4 Variable Declarations and Data Types.
Week 2/3 - 2nd Lecture Intro to COBOL Programming Defining Files and Processing Data.
Chapter 2: Input, Processing, and Output Starting Out with Programming Logic & Design by Tony Gaddis (with instructor modifications) 1-1.
Easily Modify Report Programs (because you have better things to do) Ted Holt Sr. Software Developer, Profound Logic Software Sr. Technical Editor, Four.
C++ Programming: From Problem Analysis to Program Design, Fourth Edition Chapter 3: Input/Output Samples.
Chapter Topics The Basics of a C++ Program Data Types
Submitting Instructions on web site CS 1024 students Read guide
RPG Programming with Printer Files
Chapter 2: Input, Processing, and Output
Structured Programming
Basic Elements of C++.
Programming Problem steps must be able to be fully & unambiguously described Problem types; Can be clearly described Cannot be clearly described (e.g.
RPG Programming with Printer Files
Basic Elements of C++ Chapter 2.
Any Questions?.
Chapter 3 The DATA DIVISION.
An Introduction to Structured Program Design in COBOL
CHAPTER 17 The Report Writer Module
Writing a Complete Program
Chapter 2: Input, Processing, and Output
IBC233 Lecture 3 Updated Fall 2011
Chapter 4: Writing and Designing a Complete Program
Presentation transcript:

Getting Started Chapter 2 Presentation © Copyright 2002, Bryan Meyers 4/21/2017 Getting Started Chapter 2 Presentation © Copyright 2002, Bryan Meyers

Objectives Describe the RPG Specification forms 4/21/2017 Objectives Describe the RPG Specification forms Create a simple read/write RPG program Explain how to include comment lines in a program Explain how to do output editing to control the appearance of a report Programming in RPG IV Third Edition

Specifications in RPG IV 4/21/2017 Specifications in RPG IV Different specifications for different purposes File Description Specifications Describe files used by program Definition Specifications Describe working variables, structures Input Specifications Describe input fields in files Calculation Specifications Processing instructions Output Specifications Describe program output (reports, files, etc.) Programming in RPG IV Third Edition

File Description Specifications 4/21/2017 File Description Specifications File Name File Type File Designation File Format Record Length Device *.. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8 FFilename++IPEASFRlen+LKlen+AIDevice+.Keywords+++++++++++++++++++++++++++++ FSalesMast IF F 63 DISK FQPRINT O F 132 PRINTER Programming in RPG IV Third Edition

Input Specifications Record Identification Entries 4/21/2017 Input Specifications Record Identification Entries File Name Sequence Field Description Entries Field Location Decimal Positions Field Name *.. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8 IFilename++SqNORiPos1+NCCPos2+NCCPos3+NCC.................................. I........................Fmt+SPFrom+To+++DcField+++++++++L1M1FrP1MnZr...... ISalesMast NS I 1 4 0SlspNumber I 5 34 SlspName I 35 50 ItemNumber I 51 56 0DateOfSale I 57 63 2Price Programming in RPG IV Third Edition

Output Specifications 4/21/2017 Output Specifications Record Identification Entries File Name Type Exception Name Space and Skip Entries Field Description Entries Field Name Constants End Position in Output Record Edit Codes *.. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8 OFilename++DF..N01N02N03Excnam++++B++A++Sb+Sa+............................. O..............N01N02N03Field+++++++++YB.End++PConstant/editword/DTformat++ OQPRINT E Headings 2 2 O 8 ‘PAGE ’ O PAGE 13 O 50 ‘WEEKLY SALES REPORT ’ O 64 ‘DATE ’ O *DATE Y 75 Programming in RPG IV Third Edition

Pseudocode for Program 4/21/2017 Pseudocode for Program WRITE report headings READ a record WHILE there are more records WRITE a detail line READ the next record ENDWHILE END Program Programming in RPG IV Third Edition

Calculation Specifications 4/21/2017 Calculation Specifications Except Read Dow Enddo Eval Return *.. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8 /FREE EXCEPT Headings; READ SalesMast; DOW NOT %EOF; EXCEPT Detail; ENDDO; EVAL *INLR =*ON; RETURN; /END-FREE Programming in RPG IV Third Edition

Fixed-Format C-Specifications 4/21/2017 Fixed-Format C-Specifications Before Version 5, compiler did not support free-format calculations Fixed-format C spec required *.. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8 CL0N01Factor1+++++++Opcode(E)+Factor2+++++++Result++++++++Len++D+HiLoEq.... CL0N01Factor1+++++++Opcode(E)+Extended-factor2+++++++++++++++++++++++++++++ C EXCEPT Headings C READ SalesMast C DOW NOT %EOF C EXCEPT Detail C ENDDO C EVAL *INLR =*ON C RETURN Programming in RPG IV Third Edition

Internal Documentation 4/21/2017 Internal Documentation Comment lines begin with // Starting at Version 5 Free format specifications Comment can make up entire line or a portion of the line, after the code // can be anywhere from 8-80 Fixed format specifications Comment must make up entire line // Can be anywhere from 7-80 Fixed format also supports comments that start with * in column 7 Used exclusively before Version 5 Blank lines are also allowed Programming in RPG IV Third Edition

Completed Program - F & I 4/21/2017 Completed Program - F & I *.. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8 // *********************************************************************** // This program produces a weekly sales report. The report data comes // directly from input file SalesMast. // Author: J.Yaeger Date Written: 12/10/1994. // Date Modified: 12/20/2001. FSalesMast IF F 63 DISK FQPRINT O F 132 PRINTER ISalesMast NS I 1 4 0SlspNumber I 5 34 SlspName I 35 50 ItemNumber I 51 56 0DateOfSale I 57 63 2Price Programming in RPG IV Third Edition

Completed Program - C Spec 4/21/2017 Completed Program - C Spec *.. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8 /FREE EXCEPT Headings; READ SalesMast; DOW NOT %EOF; EXCEPT Detail; ENDDO; EVAL *INLR =*ON; RETURN; /END-FREE *.. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8 C EXCEPT Headings C READ SalesMast C DOW NOT %EOF C EXCEPT Detail C ENDDO C EVAL *INLR =*ON C RETURN (Before V5) Programming in RPG IV Third Edition

Completed Program - O Spec 4/21/2017 Completed Program - O Spec *.. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8 OQPRINT E Headings 2 2 O 8 'PAGE' O PAGE 13 O 50 'WEEKLY SALES REPORT' O 64 'DATE' O *DATE Y 75 O E Headings 1 O 7 'SLSPSN.' O 48 'DATE OF' O 77 'SALE' O E Headings 2 O 3 'NO.' O 21 'NAME' O 46 'SALE' O 61 'ITEM SOLD' O 77 'PRICE' Programming in RPG IV Third Edition

Completed Program - O Spec 4/21/2017 Completed Program - O Spec *.. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8 O E Detail 1 O SlspNumber 4 O SlspName 37 O DateOfSale Y 48 O ItemNumber 67 O Price 1 79 Programming in RPG IV Third Edition

Edit Codes Commas Print Zero No Sign CR Right - Floating - Yes 1 A J N 4/21/2017 Edit Codes Commas Print Zero No Sign CR Right - Floating - Yes 1 A J N No 2 B K O 3 C L P 4 D M Q Programming in RPG IV Third Edition

Edit Words Value Edit Word Prints 999999999 ‘bbb-bb-bbbb’ 999-99-9999 4/21/2017 Edit Words Value Edit Word Prints 999999999 ‘bbb-bb-bbbb’ 999-99-9999 ‘bbb&bb&bbbb’ 999 99 9999 1234123412 ‘0(bbb)bbb-bbbb’ (123)412-3412 00012^14 ‘bbb$0.bb’ $12.14 ‘$bbbb0.bb’ $ 12.14 05612^14 ‘$bb,bb0.bb’ $ 5,612.14 Programming in RPG IV Third Edition

4/21/2017 Points to Remember RPG programs are written as fixed form specifications Different specification forms convey different kinds of information to the RPG compiler File specifications contain descriptions of all files used within a program Programming in RPG IV Third Edition

4/21/2017 Points to Remember Input specifications provide detail information about each program described input file used by a program Calculation specifications center on operations, or processing steps, to be accomplished by the computer Output specifications provide details about each program-described output file Programming in RPG IV Third Edition

4/21/2017 Points to Remember It generally is customary to edit numeric values that are printed Comment lines, which begin with //, can appear almost anywhere within a program Programming in RPG IV Third Edition