Presentation is loading. Please wait.

Presentation is loading. Please wait.

Spring 2014 CS 230 – Procedural Programming

Similar presentations


Presentation on theme: "Spring 2014 CS 230 – Procedural Programming"— Presentation transcript:

1 Spring 2014 CS 230 – Procedural Programming
RPG language on IBMi POWER Systems Rick Flagler Adjunct Professor

2 Major Concepts of THIS course
Use of RPG, PDM, Rational development tools Understanding of the mechanics of creating and compiling a program Application of RPG language to access the built-in DB2 database of IBMi Native DB access Embedded SQL statements Relationships involved in the nature of data and programs

3 Level set – where are you in relation to other students and developers?
1- I have never programmed – don’t know what it is 2- I’ve done some programming – think RPG = Role Playing Games 3- I’ve heard of RPG in this context 4- I work in a place using IBMi OS or similar mainframe / programs 5- I’ve programmed a lot in other languages 6- I use RPG but want to learn more 7- I could sub for Rick as teacher – just here for easy credit 1 2 3 4 5 6 7 Beginner Expert

4 Tonight’s agenda Introduce IBMi and Power Hardware
Discuss history of how this platform came to be and why so popular in business world Discuss tools used for programming and administration of system Discuss language and Database Access for built-in DB2 database

5 Class environment Can get these last two products from Lab Monitors
“IBMi – operating system DB2 database Emulation = telnet (5250) STRPDM command PDM = Program Development Manager Operations or i Navigator = Client-server GUI Rational Developer for Power Systems Rdi or RDp Can get these last two products from Lab Monitors Or from Professor

6 Tools you might run into when using IBMi server
Navigator GUI file browser Work area to create DB2 stuff RDi Integrated Development Environment for iSeries compilers RPG, Java, C, COBOL Debugger Data Views Eclipse foundatioin with IBMi specific plug-ins Websphere Application Server Server environment for Java Servlets and Web Applications “Green Screen” – Operations console, command line, various server tasks STRPDM – launchs editor environment CALL – runs programs SBMJOB – submits program calls or commands to batch (background) processing

7 Navigator – GUI interface of IBMi formerly Operations Navigator
PIE3.keene.edu UserID and Password required for server access

8 Navigator - Database Access
Database menu allows you to access a LIBRARY, also known by the SQL terms COLLECTION or SCHEMA, and the objects within.

9 Integrated File System
File system “contains” DOS, Windows PC-like file and folders as well as native Objects. / “root /QDLS – PC-based Document library objects (DLOs) and folders /QFILESVR.400 –access to other file systems residing on remote iSeries /QNTC – local/remote Integrated Netfinity Servers running Windows NT or 2000 /QOPENSYS – UNIX-based files and directories /QOPT – stream files stored on optical media /QSYS.LIB – iSeries libraries and various objects /Mounted-name (NFS) – Any Network File System exported by an NFS server /User-defined file system – contains user-defined/managed file systems

10 Navigator - IFS view

11 Emulation = Telnet so-called (green screen)
IBMi Access Windows Versions Emulation sessions Mapped drives Database access Data transfer Application programming interfaces (APIs) - defined set of programming constructs iNavigator - the GUI of the system

12 Client Server development tools
RDi or RDp Rational Developer tools Part of Eclipse Open Source Consortium Includes all typical development tools for mainframe, PC and web areas Part of the Application Development Toolset for the iSeries LPEX = Live Parsing Editor Extensible cross application editor for creating source code for almost any PC or Host-based languages Java, CL, RPG and COBOL, DDS

13 Code Explorer Status Typical Eclipse or RDi interface Rational layout

14 Competencies to gain To become a successful application developer, you need the following skills: Analysis: How to analyze an existing (or proposed) system to identify required objects and processes Specification: how to specify system objects and processes in a way that is useful to the end-users and/or implementers Design: how to design database files, programs Implementation: how to code to create objects, DB files, programs etc. Testing: How to test software at the component and system level Deployment: How to put programs, databases and software into production use. This course will teach some skills in each of these important areas.

15 What is a Database? A database is a set of computer files to store information. A database management system (DBMS) is the system software enabling computer users to define and update database files. DB2 or Universal Database (UDB) for i is an integrated part of i5/OS, the operating system of the IBMi. This is different than other platforms where you buy load DB separately. Carbuy.com Server LAN Clients

16 Database Object terminology
Schema Table Row Column SchemaA Database SchemaB Table2 Table1 Row Row Row Rows Rows Columns

17 Database The software or hardware that enables you to create objects to store and manipulate data in a computer. Think of the database as a room full of file cabinets. Some names and makers of popular database software DB2 Oracle MySQL Informix DataComm SQL Server Access – Microsoft Office (not a full database but used by many)

18 Schema Schema (aka Library or Collection) – All these terms mean the same thing. A schema is a container where database objects are stored. Different DB software will use various names. IBM used to call it a Library or a Collection and now a Schema Industry standards influence the naming Think of the Schema as a file cabinet There can be many schemas created in any database You give each schema a unique name in the database Schema

19 Table Table – Often also called a File, the Table is the physical object that is created to hold data and store facts about a specific type of data, the shape of data and access information as well. Many tables are created in a schema Think of each Table as a file folder Many times you will hear Tables referred to as the Database. Schema Table

20 Row Row – The Row holds a set of related facts and is also referred to as a Record. In database software, rows are numbered from 1 through however many there are. Usually there is some theoretical maximum number of rows or records that you probably will not reach. An Excel spreadsheet can hold only rows Think of each Row as a piece of paper in a file folder Table Schema Rows

21 Column Column – A Column, also called a Field contains one fact.
Each column is assigned a data type. Some of these types are CHARACTER, DATE, TIME, NUMERIC and a host of others. A Table will always have at least one Column and usually many In a good design, one or more columns will uniquely identify a specific row Each Row in the Table has the same layout of columns In other words, the Column definition applies to all Rows in the Table and is defined when the Table is first created. As Rows are added or removed from the Table, all columns become available Think of a Column as a line on a piece of paper Columns Table Schema Rows

22 Database processing Past Now All data resided on one central host
Database contained text only One sequence for data review at a time Sorting of physical data from one sequence to new sequence when needed Now Data all over the place – on more than one computer Multimedia - Sounds, BLOB, CLOB, GIF, JPEG Many “logical” sequences provide access simultaneously by different people for differing uses – these are called Index objects

23 IBM Computer History 1960’s - Mainframe systems System/360 - mainframe
1970’s - Small business computers emerge System/3, System/32, System/34, System/36 System/370 - next generation mainframe 1978 System/38 – numerous radical concepts single level storage - everything handled as memory device independence – everything is data Allowed new hardware with NO SOFTWARE CHANGES – still revolutionary today! 1980’s through 1990’s - Application System/400 (ie. AS/400) merged System/38 and System/36 hardware reinvented several times since now 64-bit double (or triple) horsepower every year AS/400e model 8xx - first huge AS/400s Renamed from AS/400 to iSeries – joined with pSeries, zSeries 2003 – i890, i870 and other i8xx models with new software packaging announced – more powerful/competitive than ever 2004 – IBM announces next generation iSeries and pSeries computers for business and scientific computing – similar architecture, shared hypervisor to allow various operating systems to run in partitions 2008 – IBM combines pSeries/iSeries into POWER Systems such that all systems can run any OS offered (AIX, Linux, “IBM i” and with external box/internal card Windows) 2009 – IBM announces POWER7 – 7th generation of high performance chips 5ghz or more 2011- IBM WATSON system beats humans on quiz show "Jeopardy" 2013 –IBM announces POWER 8 – 12 core chip – doubles performance of Power7

24 IBM computers – Then and Now
Link to IBM circa 1978, this computer was considered small compared to the mainframes! Model 595 Requires Room of it’s own Model 520 Under Desk small or large IBM Power System today With 1000’s of times the power.

25 Supersize it! - 64-bits 18,446,744,073,709,551,616 bytes
IBM i address space 18,446,744,073,709,551,616 bytes Kilo Mega Giga Tera (240) Peta (250) Exa (260)

26 Why is it called IBM i, System i or iSeries?
The i in stands for: integrated – all components packaged together and system tested in Rochester, MN at IBM development laboratory integrity – iSeries security is better than most any system available innovative – extremely powerful and cutting edge technology In a class by itself - compared to all other computing machinery – more Fortune 500/1000 companies use IBMi than any other computing platform

27 IBM i Operating System (OS/400) Basics
Menus - system functions organized by menu Commands - take vowels out of the words to get meaningful commands Examples: Work with Active Jobs = WRKACTJOB Display Job = DSPJOB Start (Programming Development Manager) PDM = STRPDM Create Bound RPG Program = CRTBNDRPG Work with Submitted Jobs = WRKSBMJOB Work with User Jobs = WRKUSRJOB

28 Finding Commands Function Keys Partial command names
F4 to Prompt parameters F3 to exit a screen/program F1 for HELP Partial command names GO CMDxxx Where XXX = ADD, CHG, DSP, WRK, RPG to locate commands based on subject Prompting commands at command line Fill in the blanks – ease of use

29 Objects Encapsulation Everything in the OS is an object Header
80+ object types in OS Programs Files Object contains HEADER information and CONTENTS Access objects only through COMMANDS Object Contents (program instructions, file data) Header Type-specific part of object header COMMAND Data or object information extracted to display, files or printer Associated space (misc object data)

30 Libraries Program Library Executable File object Directory, size etc.
Libraries are located in the Integrated File System (IFS) IFS allows OS to support various file systems (Unix, PC, Lib/File) Libraries are used to organize objects on IBMi Think of a Library like a Unix or MS-DOS directory or a Windows95 folder. Libraries are not nested like in Windows Explorer With one exception (QSYS.LIB) contains other libraries Files and Programs live inside Libraries, Library and Object names are 10 alphanumeric characters, Objects are “owned” by a User Profile Executable object Program Display Library Call Program Directory, size etc. Library Data, record layout, etc. File Open File

31 Object types and sub-types
An object is uniquely identified by the combination of its Qualified Name (Library/Object) and its object type OS will only allow one object with the name CUSTOMER of the type *FILE in library DATA. OS will allow another object CUSTOMER of type *PGM in library DATA however but this is NOT a good practice. *LIB - LB0001 Accounts payable applications AP0001 Create Accounts payable total *PGM APMASTER Accounts payable open balances *FILE AP0002 Roll over open balance *PGM APOWNER Owns objects in the AP system *USRPRF

32 Files, Record Formats & Members
RRN = Relative Record (row) number 1 2 3 4 5 6 Records Fields

33 Records in Members Each record occupies a unique position in the file member. Record# 1, 2, 3 ….n This is called the “Relative Record Number” (RRN) Each physical file has just one record format and all records in every member of the file have the same format A record is identified as used or deleted. Deleted records can be re-used

34 File Description - record format (layout) in DB2 database

35 Access Paths - two kinds Arrival or Keyed Sequence
Records Fields Arrival sequence – records are numbered from 1 through however many. BUT, if deleted records are reused – “arrival” is misnomer – why?

36 Access Paths - two kinds Arrival or Keyed Sequence
Records Fields One or more fields can be the key

37 Type of Files - Physical and Logical
Logical File - may have fewer fields, reordered fields, changed sizes in addition to key ordering and selection/omission of rows

38 Physical file = TABLE Container for data
Has one access path by default Can be Arrival (as inserted) Can be Keyed (by one of more fields) An SQL Table is a physical file in DB2 on the IBMi OS

39 Logical file = VIEW or INDEX
Filter for data Has Keyed access path Can reorder data Can select/omit rows Can include/exclude columns An SQL View or SQL Index is a logical file in DB2 on the IBMi OS

40 Typical file access - Relationship between physical and logical files
Higher Level Languages RPG, COBOL, JAVA, SQL Logical File File Member Physical File(s) File Member

41 Creating programs with RPG and files with Data Description Specifications - DDS
Text Editors SEU source Entry Utility RDi, RDp, Eclipse, etc. Source files Source Member(s) Physical or Logical File member Compiler CRTRPGPGM command CRTPF command program

42 DDS use and formatting DDS is columnar
DDS uses keywords to describe file features and field attributes DDS is entered into a source physical file DDS is “compiled” to create (CRTxx) a file object UNIQUE R CUSTOMER TEXT(‘CUSTOMERS’) CUSTID 7P 0 COLHDG(‘Customer’ ‘ID’) NAME A COLHDG(‘Customer’ ‘Name’) STATUS A COLHDG(‘Customer’ ‘Status’) SHPA A COLHDG(‘Customer’ ‘Addr’ ‘line’) SHPCITY A COLHDG(‘Customer’ ‘City’) K CUSTID

43 Creating files with Structured Query Language - SQL
SQL Development Kit Interactive SQL Operations Navigator SQL interpreter Create Table Create View Create Index Alter Table Comment ON Label ON Table (Physical) or View (Logical) Index (Logical) member

44 SQL use and formatting SQL is free format and “english-like”
SQL uses reserved words SQL commands are entered into an interactive session therefore no compilation step is required Create Table DATA/CUSTOMER (CustId Dec(7,0) not Null, Name Char(30) not Null, ShpA1 Char(30), ShpCity Char(30), ShpState Char(2), Status Char(1), Primary Key (CustID))

45 Creating tables with Operations Navigator
Point-click or fill-in-blanks method to create a table from scratch or from other pre-existing table(s).


Download ppt "Spring 2014 CS 230 – Procedural Programming"

Similar presentations


Ads by Google