Set path vs current schema. Set Current Schema ‘The CURRENT SCHEMA special register specifies a VARCHAR(128) value that identifies the schema name used.

Slides:



Advertisements
Similar presentations
CL programming (with Display Files). Review Display Files Constants Input/Output fields Attributes Activating Function keys.
Advertisements

AN INTRODUCTION TO PL/SQL Mehdi Azarmi 1. Introduction PL/SQL is Oracle's procedural language extension to SQL, the non-procedural relational database.
Tutorial 12: Enhancing Excel with Visual Basic for Applications
CL Programming with Database Files Updated Fall 2010.
Loops (Part 1) Computer Science Erwin High School Fall 2014.
PL/SQL (Procedural Language extensions to SQL) Prepared by: Manoj Kathpalia Edited by: M V Ramakrishna.
Computer Science 1620 Loops.
Chapter 4B: More Advanced PL/SQL Programming
Chapter 5: Loops and Files.
Loops Repetition Statements. Repetition statements allow us to execute a statement multiple times Often they are referred to as loops Like conditional.
© 2004 Pearson Addison-Wesley. All rights reserved5-1 Iterations/ Loops The while Statement Other Repetition Statements.
CS 1 Lesson 5 Loops and Files CS 1 -- John Cole.
COMP 5138 Relational Database Management Systems Semester 2, 2007 Lecture 8A Transaction Concept.
Any Questions!. Agenda Fun with Functions –how to get the system date Condition Names INDARA and SI Iteration Logical Files Positioning the file pointer.
PL / SQL P rocedural L anguage / S tructured Q uery L anguage Chapter 7 in Lab Reference.
Agenda Journalling More Embedded SQL. Journalling.
Iteration and Simple Menus Deterministic / Non-deterministic loops and simple menus.
PMS /134/182 HEX 0886B6 PMS /39/80 HEX 5E2750 PMS /168/180 HEX 00A8B4 PMS /190/40 HEX 66CC33 By Adrian Gardener Date 9 July 2012.
ASP.NET Programming with C# and SQL Server First Edition Chapter 3 Using Functions, Methods, and Control Structures.
Lecture 4 C Program Control Acknowledgment The notes are adapted from those provided by Deitel & Associates, Inc. and Pearson Education Inc.
5-1 Chapter 5 The Repetition Process in VB.NET. 5-2 Learning Objectives Understand the importance of the repetition process in programming. Describe the.
Control Structures Week Introduction -Representation of the theory and principles of structured programming. Demonstration of for, while,do…whil.
Mr. Dave Clausen1 La Cañada High School Chapter 6: Repetition Statements.
Additional Control Structures. Chapter 9 Topics Switch Statement for Multi-way Branching Do-While Statement for Looping For Statement for Looping Using.
Stored Procedures Week 9. Test Details Stored Procedures SQL can call code written in iSeries High Level Languages –Called stored procedures SQL has.
Chapter 2 Functions and Control Structures PHP Programming with MySQL 2 nd Edition.
Lecture 4 Looping. Building on the foundation Now that we know a little about  cout  cin  math operators  boolean operators  making decisions using.
COMPUTER PROGRAMMING. Iteration structures (loops) There may be a situation when you need to execute a block of code several number of times. In general,
IBC233 Calling Programs Updated Summer Agenda Assignments are mandatory Assignment 2 due on July 13, 2007 Display files – lower case Display files.
Programmatic SQL Shaista Khan CS 157B. Topic Embedded SQL statements in high-level programming languages.
Chapter 15 Introduction to PL/SQL. Chapter Objectives  Explain the benefits of using PL/SQL blocks versus several SQL statements  Identify the sections.
CONTENTS Processing structures and commands Control structures – Sequence Sequence – Selection Selection – Iteration Iteration Naming conventions – File.
Chapter 3 Functions, Events, and Control Structures JavaScript, Third Edition.
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 5 Looping.
DBT544. DB2/400 Advanced Features Level Check Considerations Database Constraints File Overrides Object and Record Locks Trigger Programs.
A loop is a repetition control structure. body - statements to be repeated control statement - decides whether another repetition needs to be made leading.
Week 4 presentation! This week we will cover editing and the use of the on-board tools provided, SEU and PDM.
JavaScript, Fourth Edition
Chapter 15 JavaScript: Part III The Web Warrior Guide to Web Design Technologies.
Sections © Copyright by Pearson Education, Inc. All Rights Reserved.
 In computer programming, a loop is a sequence of instruction s that is continually repeated until a certain condition is reached.  PHP Loops :  In.
Repetition Statements (Loops) The do while Loop The last iteration structure in C++ is the do while loop. A do while loop repeats a statement or.
Loops and Files. 5.1 The Increment and Decrement Operators.
1 Standard Version of Starting Out with C++, 4th Brief Edition Chapter 5 Looping.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 5: Looping.
Agenda Perform Quiz #1 (20 minutes) Loops –Introduction / Purpose –while loops Structure / Examples involving a while loop –do/while loops Structure /
Programming Logic and Design, Introductory, Fourth Edition1 Understanding the Three Basic Structures Structure: a basic unit of programming logic Any program.
Fundamental Programming Fundamental Programming More on Repetition.
1 1 Additional Control Structures Chapter 9 2 New and Improved... Ways to branch Ways to write loops Understanding the break and continue statements.
1 Programming in C++ Dale/Weems/Headington Chapter 9 Additional Control Structures (Switch, Do..While, For statements)
PL/SQL programming Procedures and Cursors Lecture 1 [Part 2]
Chapter 1 Java Programming Review. Introduction Java is platform-independent, meaning that you can write a program once and run it anywhere. Java programs.
Repetition Statements (Loops). 2 Introduction to Loops We all know that much of the work a computer does is repeated many times. When a program repeats.
Chapter Looping 5. The Increment and Decrement Operators 5.1.
Any Questions!. Agenda Fun with Functions Externally Described Files Condition Names Iteration Logical Files Random Reads.
LECTURE # 8 : REPETITION STATEMENTS By Mr. Ali Edan.
Introduction to PL/SQL Francis Thottungal. The outline The basic PL/SQL code structure is : DECLARE -- optional, which declares and define variables,
Engineering Computing I Chapter 3 Control Flow. Chapter 3 - Control Flow The control-flow of a language specify the order in which computations are performed.
Chapter Looping 5. The Increment and Decrement Operators 5.1.
Lecture 7 – Repetition (Loop) FTMK, UTeM – Sem /2014.
1 Week # 5 Agenda CL Programming CL Commands Job Logs Review for test # 1.
Learning Javascript From Mr Saem
Introduction to Loop. Introduction to Loops: The while Loop Loop: part of program that may execute > 1 time (i.e., it repeats) while loop format: while.
CL Programming with Database Files Updated Summer 2007.
More SQL: Complex Queries, Triggers, Views, and Schema Modification
Creating professional PDF documents from basic Spool Files, utilising report definitions, maps and dynamic use of images. (CVTSPLDBF & CVTSPLPDF)
Arrays, For loop While loop Do while loop
Week 4 Updated Winter 2011.
Iteration: Beyond the Basic PERFORM
CL programming (with Display Files)
Presentation transcript:

Set path vs current schema

Set Current Schema ‘The CURRENT SCHEMA special register specifies a VARCHAR(128) value that identifies the schema name used to qualify unqualified database object references where applicable in dynamically prepared SQL statements. ‘ –Copied IBM’s SQL reference manual

We set the current schema. We created a User Defined field and then tried to use it in a create table statement. The create table failed because the statement couldn’t find the user defined type. Why?

Current Path ‘The CURRENT PATH special register specifies the SQL path used to resolve unqualified distinct type names, function names, and procedure names in dynamically prepared SQL statements.’ –Copied from IBM’s SQL Reference Manual Set path = ‘collection’

Function Foot Prints! Watch your parameter definitions!

CL Programming Review

CL Restrictions Only open 5 files Cannot update files Only 25 levels of nested iteration and selection statements Cannot create reports – only execute them

Begin and end PGM –Also used to include parameters passed to the program ENDPGM –Last statement executed and control returns to the calling program

Declaring Variables Declaring files (DCLF) –Specify the file name –If more than one file used in the program than specify the opnid –Limit of 5 files open in the program Declaring variables (DCL) –*DEC, *CHAR, *LGL, *INT, *UINT –Date, Time, and Timestamp variables are treated as *CHAR

Defining a Logical Block Do Enddo Can be embedded in iteration, and selection statements

Iteration Dowhile (condition) Enddo Tests the condition first. If the condition is true, then the logic block is executed.

Iteration Dountil (condition) Enddo Tests the condition after the logic block is executed In other words, the logic block is always executed at least once.

Iteration DOFOR &variable &from &to &by ENDO Executes the loop by checking the contents of &variable. &variable starts the the &from value. The loop ends when &variable reaches the &to value. &variable is incremented by the &by variable. If &by is left out then &variable is incremented by 1.

Selection If (condition) Else End-if. Allows execution of code based on a condition. If the condition is false, then the else logic is executed. If statements process only one CL command if true and one CL command if false Often used in combination with the DO ENDDO logic block.

Selection Select When cond(condition 1) then(cl command) When cond(condition 2) then(cl command) Otherwise (cl command) Endselect Executes the first true condition and then exits the structure

Working with Files RCVF OPNID(openidname) –Reads records from a file –Works with database files and display files SNDF OPNID(openidname) –Writes to a file –Works only with display files SNDRCVF OPNID(openidname) –Reads a record from a file –Writes to a file –Works only with display files OPNID only needed if more than one file is opened in the program

MONitoring for MeSsaGes MONMSG MSGID(CPF9999) EXEC(cl command) Used to trap error messages Used to avoid the Black Screen of Death

Indicators Used in display file to pass information between the program and the display file. Two types of indicators –Response (ie function keys) –Option (ie reverse image)

Happy Birthday Program Write an interactive program that prompts for a userid and sends a happy birthday greeting to that user. Program should terminate when F3 is pressed

CL commands for the lab RUNSQLSTM DSPOBJD DSPFD DSPDBR DSPOBJAUT RTVJOBA DSPSPLF