Introduction to BASIC Programming Ken R. Hall, Ph.D. Ken R. Hall Consultants Portland, Oregon.

Slides:



Advertisements
Similar presentations
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 2 Getting Started with Java.
Advertisements

Chapter 11 Introduction to Programming in C
Instructors: Connie Hutchison & Christopher McCoy
CIS 240 Introduction to UNIX Instructor: Sue Sampson.
Introduction to Unix – CS 21 Lecture 11. Lecture Overview Shell Programming Variable Discussion Command line parameters Arithmetic Discussion Control.
Introduction to C++ September 12, Today’s Agenda Quick Review Check your programs from yesterday Another Simple Program: Adding Two Numbers Rules.
1 Outline 13.1Introduction 13.2A Simple Program: Printing a Line of Text in a Web Page 13.3Another JavaScript Program: Adding Integers 13.4Memory Concepts.
1 September 6, 2005CS150 Introduction to Computer Science I What Actions Do We Have Part 1 CS150 Introduction to Computer Science I.
A Guide to SQL, Seventh Edition. Objectives Understand the concepts and terminology associated with relational databases Create and run SQL commands in.
Understanding the Mainline Logical Flow Through a Program (continued)
Programming Logic and Design, Introductory, Fourth Edition1 Understanding Computer Components and Operations (continued) A program must be free of syntax.
Guide To UNIX Using Linux Third Edition
Introduction to Unix (CA263) Introduction to Shell Script Programming By Tariq Ibn Aziz.
Testing a program Remove syntax and link errors: Look at compiler comments where errors occurred and check program around these lines Run time errors:
Copyright 2003 Scott/Jones Publishing Brief Version of Starting Out with C++, 4th Edition Chapter 1 Introduction to Computers and Programming.
Ch 111 Chapter 11 Advanced Batch Files. Ch 112 Overview This chapter focuses on batch file commands that allow you to:  write sophisticated batch files.
Programming Batch Files Aim: To introduce the concept of Batch processing and programming techniques. Lesson Outcomes  The need for Batch Processing.
Refworks Presented by Margaret Clark, Reference Librarian FSU College of Law Library September 20, 2005.
Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 1 Introduction to Computers and Programming.
PICK 1 - An Introduction Course 409. PICK 1 - An Introduction Ken R. Hall, Ph.D. Hyland Technology Group, Inc. Portland, Oregon
 2003 Prentice Hall, Inc. All rights reserved. CHAPTER 3 JavaScript 1.
Introduction to Shell Script Programming
Introduction to Universe Documentation Ken R. Hall, Ph.D. Ken R. Hall Consultants Portland, Oregon.
INTERNET APPLICATION DEVELOPMENT For More visit:
Moving Data between SHIMS and Windows Course 417.
Programming.
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.
INTRODUCTION TO ALGORITHMS PROGRAMMING. Objectives Give a definition of the term algorithm Describe the various parts of the pseudocode algorithm or algorithm.
Copyright © 2007, Oracle. All rights reserved. Managing Concurrent Requests.
CNG 140 C Programming (Lecture set 9) Spring Chapter 9 Character Strings.
Shell Scripting Introduction. Agenda What is Shell Scripting? Why use Shell Scripting? Writing and Running a Shell Script Basic Commands -ECHO - REM.
Web Design and Development for E-Business By Jensen J. Zhao Copyright 2003 Prentice Hall, Inc. Web Design and Development for E-Business Jensen J. Zhao.
Chapter Three The UNIX Editors. 2 Lesson A The vi Editor.
Programming Fundamentals. Today’s lecture Decisions If else …… Switch Conditional Operators Logical Operators.
Creating your first C++ program
1 The EDIT Program The Edit program is a full screen text editor that allows you to: Create text files Create text files Edit an existing text files Edit.
Ts_print IN A FEW EASY STEPS. C L E A N, Q U A L I T Y D A T A F O R E X C E L L E N C E I N R E S E A R C H ts_print is CRSP’s flexible report writer.
 2003 Prentice Hall, Inc. All rights reserved. CHAPTER 3 JavaScript 1.
Shell Programming. Introducing UNIX Shells  Shell is also a programming language and provides various features like variables, branching, looping and.
Exercise Your your Library ® RefWorks: Advanced November 21, 2006.
1 Computer Science of Graphics and Games MONT 105S, Spring 2009 Session 1 Simple Python Programs Using Print, Variables, Input.
Introduction to SAS Macros Center for Statistical Consulting Short Course April 15, 2004.
 2000 Deitel & Associates, Inc. All rights reserved. Outline 8.1Introduction 8.2A Simple Program: Printing a Line of Text in a Web Page 8.3Another JavaScript.
Chapter Six Introduction to Shell Script Programming.
1 © 2005 Cisco Systems, Inc. All rights reserved. Session Number Presentation_ID Cisco Confidential Cisco Cross Reference Tool (CCRT) User’s Guide Version.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
CSC 1010 Programming for All Lecture 3 Useful Python Elements for Designing Programs Some material based on material from Marty Stepp, Instructor, University.
Introduction to Perl. What is Perl Perl is an interpreted language. This means you run it through an interpreter, not a compiler. Similar to shell script.
1 Printing in Python Every program needs to do some output This is usually to the screen (shell window) Later we’ll see graphics windows and external files.
JDS5 Training Guide. On Start Up you will see this screen click the OK button Click OK.
Introduction to Programming Python Lab 5: Strings and Output 05 February PythonLab5 lecture slides.ppt Ping Brennan
Be “GUI ready” developing in RPG by Robert Arce from PrismaTech. Be “GUI ready” developing in RPG-ILE Presented by: Robert Arce.
Subroutines (PrArith, Math,projCP1, PrAdrProc, PrAdrProcFunc) Please use speaker notes for additional information!
1 Agenda  Unit 7: Introduction to Programming Using JavaScript T. Jumana Abu Shmais – AOU - Riyadh.
Part 1 Learning Objectives To understand that variables are a temporary named location to store data and that programmers work with different data types.
Accomplish more with macros! Presenter: Joyce Bell Princeton University
E-JPPAP User Guide _ Supplier
Chapter 2 Introduction to C++ Programming
Downloading and Preparing a StudentVoice File for SPSS
Keyboard Input and Screen Display ––––––––––– Interactive Programming
Multi-host Internet Access Portal (MIAP) Enhancement Guide
Please use speaker notes for additional information!
Introduction to C++ Programming
An Introduction to Python
Introduction to C++ Programming
Data Groupings: File File: a group of related records
Linux Shell Script Programming
Just Basic Lessons 9 Mr. Kalmes.
Basic 9 Mr. Husch.
Introduction to C Programming
Presentation transcript:

Introduction to BASIC Programming Ken R. Hall, Ph.D. Ken R. Hall Consultants Portland, Oregon

Speaker’s Qualifications Ken Hall is a PICK/SHIMS consultant and owner of Ken R. Hall Consultants. Ken has over 25 years experience developing applications in PICK, Universe, and Unidata. Ken is a reseller of IBM U2 (Universe) and Raining Data database products. Ken has developed business applications for distributors, retailers, mail order houses, manufacturers, and leasing companies.

Learning Objectives As a result of this presentation, you will be able to: –Look at a BASIC program with an editor –Read the statements in a BASIC program –Know where to look for more information when you don’t understand the program

Presentation Agenda Concepts and Terminology Creating and Viewing Programs An Introduction to commonly used BASIC statements Where to find more information about BASIC

UniVerse Database Concepts Multivalue database structure –Accounts and Files –Keys or Item-Ids –Variable length Record Structure Each subdivision has a separator character –Records or Items Fields or Attributes –Values within Fields »Subvalues within Values

Terminology of PICK/BASIC Statements – a line of BASIC code CUST.NO = CUSTOMER.REC Constants and Literals – things that don’t change OK.RESPONSE = “YES” Assignment Statements – changing values NUMBER.PRODS = 0 Functions – things available from the system TODAY = DATE() Operators – symbols that associate variables –Arithmetic, Logical, or String +, -, *, /; #, =, GE, LE, LT, GT; :

Creating and Viewing Programs Create a File to store programs –CREATE.FILE YOURBP Naming a program Use the Editor, ED or WED, to create/edit a program –ED YOURBP YOUR.PROGRAM Compile the program with BASIC command –BASIC YOURBP YOUR.PROGRAM Activate the program with RUN command –RUN YOURBP YOUR.PROGRAM Activate the program with CATALOG command –CATALOG YOURBP YOUR.PROGRAM

Fundamental BASIC Statements PROMPT PRINT CRT or DISPLAY INPUT END STOP IF … THEN … ELSE LEN(), ABS(), DATE(),TIME OPEN READ WRITE GO or GOTO * comments for clarity * looping FOR NEXT LOOP UNTIL or WHILE REPEAT * finding records SELECT READNEXT

Adding Comments for Clarity Comment lines start with *, !, or REM –* PROGRAM TO PRINT INVOICES FOR XYZ COMPANY –! This line is also a comment Programs often start with comments that explain the purpose of the program and the author Comment lines can be used as spacers for clarity –* –* TODAY is a constant to store the current date –TODAY = DATE() –* Comments document modifications to the program

Simple Input of Information PROMPT defines the character displayed when user input is requested by the program –* send the colon when input is requested –PROMPT ‘:’ INPUT requests user input from the keyboard –Puts prompt character at current cursor position –Input is completed by hitting Enter key –INPUT CUSTOMER.NAME Input can be positioned and/or formatted

Output of Data PRINT sends data to either screen or printer –Controlled with PRINTER ON or PRINTER OFF statements –PRINT “This is a test of output” –PRINT CUSTOMER.NAME CRT sends data to the screen –CRT YOUR.NAME Output can be positioned and/or formatted “L#25”

Marking the END The END statement is used to: –Marks the end of the program * the last line is below END –Marks the end of a multi-line statement IF DAYS.PAST.DUE > “90” THEN PRINT “OVER 90 DAYS PAST DUE” END The STOP statement causes the program to terminate. * the next line exits this program after Q is typed IF DATA.INPUT = ‘Q’ THEN STOP END

Logical Control with IF … THEN Single line statement: IF X > “10” THEN PRINT “More than ten” ELSE PRINT “Ten or less” Multi-line IF statement: IF X > “10” THEN PRINT “X is greater than ten” END ELSE PRINT “X is ten or less” END

Logical Control with LOOP Single line LOOP statement: X = 0 LOOP X = X + 5 WHILE X < 100 DO PRINT “X is ”: X REPEAT * Go here when X is equal to or greater than 100 Multi-line LOOP statement: X = 0 LOOP X = X + 5 WHILE X < 100 DO PRINT “X is ”:X REPEAT * Go here when X is equal to or greater than 100

OPEN file and READ data Use OPEN to gain acces to a file OPEN ‘CUSTOMER’ TO CUST.FILE ELSE STOP Use READ to read a record from a file CUST.NO = ‘1023’ READ CUSTOMER.REC CUST.FILE, CUST.NO THEN CRT CUSTOMER.REC ; * display customer name END ELSE CRT ‘CUSTOMER ‘:CUST.NO:’ not found’

WRITE data to a file Use WRITE to save data to a record WRITE CUSTOMER.REC ON CUST.FILE, CUST.NO Use WRITEV to save a variable in a field CUST.NO = ‘1023’ CUSTOMER.NAME = “ABC ELECTRIC CO.” WRITEV CUSTOMER.NAME ON CUST.FILE, CUST.NO, 1 Corresponding READV reads a field READ V CUSTOMER.NAME FROM CUST.FILE, CUST.NO, 1 ELSE CUSTOMER.NAME = ‘UNKNOWN’ END

Sample BASIC Program * A simple program that opens a file and reads data PROMPT '' 10: CRT 'Enter first file name: ': INPUT F1 IF F1 = '' OR F1 = 'X' OR F1 = "." THEN STOP OPEN F1 TO FILE1 ELSE CRT 'CANNOT open file ':F1 GO 10 END READ TEST.REC FROM FILE1, ‘TEST’ THEN CRT ‘TEST.REC IS ‘:TEST.REC END ELSE CRT ‘TEST IS NOT ON FILE’ END STOP END

PICK BASIC Book Jonathan E. Sisk's Pick/BASIC: A Programmer's Guide Found on the web at:

IBM UniVerse Documentation To view or get copy of UniVerse BASIC manual, follow the link below: Found on the web at: /u2/pubs/library/ Click on UniVerse version that you want. Choose “install doc set” to download the entire UV documentation set with installer.

Q&A

Thank You! Ken R. Hall Ken R. Hall Consultants