MC Press Online
Welcome to the MC Press Online!
Need help with our eBooks?
Contact PublishersRow.com
Click here, to go to our main store

  MC Press Online eBookStore  

Control Language Programming for IBM i
preview of book Control Language Programming for IBM i
text of book Control Language Programming for IBM i

Control Language Programming for IBM i

Authors:
Publisher: MC Press Online
Publication Date: August 2011
Subject: Computer: Programming & Software Engineering
Category: Programming
Number of Pages: 577

Free Preview    Email to Friend   Add to wish list
 Available as: (for format`s description click on its name)
Individual E-Version (PDF) Individual E-Version (PDF) ISBN: 978-1-58347-358-0  
$61.17
 
 Reg.: $
79.95 per N pages
 You Save: 
$18.78 (23%)
 Online  Open CopyPrint    
all time
Printed Edition   see MC Press Online    
About this title
Whether you are a novice programmer who needs to get up to speed on the ins and outs of CL or an experienced professional looking for a daily CL reference, this comprehensive book is the guide you need.

Here, you'll find all the must-know basics of the CL language, as well as full coverage of its latest and most powerful features — including structured programming capabilities, file processing enhancements, and the Integrated Language Environment (ILE). The book introduces the basics quickly for those without any previous knowledge of CL. Progressing methodically into more complex processes and concepts, it guides readers smoothly toward a professional grasp of CL programming techniques and style.

In addition to 25 chapters covering CL from start to finish, the book includes a condensed reference appendix to the most commonly used CL commands, as well as appendices addressing the essentials of programming tools and debugging. End-of-chapter review questions and programming assignments complete your master course in CL and make the book suitable for use in a classroom or tutorial setting. Students who plan careers as IBM i programming professionals will find this book essential reading.

With Control Language Programming for IBM i, you will:
  • Learn the role of CL in the IBM i environment
  • Understand the IBM i user interface and programming tools
  • Recognize the data types supported by CL, and when to use them
  • Use program variables, including pointer-based variables and data structures
  • Use structured statements to organize CL processing and control workflow
  • Perform program and procedure calls, passing parameters
  • Understand critical ILE concepts, including procedures and activation groups
  • Integrate IBM application programming interface (API) programs with CL
About authors
Jim Buck
Jim Buck's career in IT spans more than 25 years, primarily in the manufacturing and healthcare industries. He is a programmer/analyst instructor at Gateway Technical College in Kenosha, Wisconsin; eight-year president of the Wisconsin Midrange Computer Professional Association (WMCPA); co-author of three IBM i textbooks; and the recipient of the 2007 IBM System i Innovation – Education Excellence Award. Jim has been instrumental in creating an advisory board for Gateway's IBM i curriculum, developing classes and seminars in IBM's programming software, and opening networking opportunities for students.

Bryan Meyers
Bryan Meyers is well known to IBM i technicians as the author of a number of popular books and frequent magazine articles. His programming, management, and consulting career has spanned most of the IBM midrange history, from the System/360 through the AS/400 and Power Systems using IBM i. For much of that time, Bryan was the IT director for an international hospitality franchisor. He has also managed computer operations for municipal government, international construction, and broadcasting media industries. Currently, Bryan presents IBM i training to organizations worldwide in a variety of environments, including onsite training, video programs, and online learning. In addition to Programming in RPG IV, his books include Control Language Programming for IBM i (MC Press, 2011) and RPG IV Jump Start (29th Street Press, 2001).

Dan Riehl
Dan Riehl is President of The 400 School, Inc., a leading provider of technical training for IBM i systems. He is also President of the IT Security and Compliance Group, LLC, which provides security consulting, training, and software for IBM i. For more than 20 years, Dan has been a writer and technical editor for System iNEWS magazine, where he writes articles related to system security, system management, and other technical topics.

Contents
CONTENTS

PREFACE

INTRODUCTION TO CONTROL LANGUAGE
Chapter 1 What Is CL?

Chapter Overview
What CL Is
What CL Is Not
Controlling Workflow with CL
CL Execution Environment and Restrictions
An Introductory Program
Chapter Summary
Key Terms
Review Questions

Chapter 2 Control Language Command Names
Chapter Overview
Verbs and Subjects
Modifiers and Subject Phrases
Command Aliases
Chapter Summary
Key Terms
Review Questions

Chapter 3 Command Parameters
Chapter Overview
Command Parameters
   Required and Optional Parameters
   Entering Parameters with Keyword Notation
   Entering Parameters with Positional Notation
   The Order of Parameters
   Positional Keyword Limits
   Using *N
   Mixing Keyword and Positional Notation
Types of Command Parameters
Parameter Special Values
Qualified Values
Value Lists
   Complex Lists
Chapter Summary
Key Terms
Review Questions
Exercises

Chapter 4 The IBM i User Interface
Chapter Overview
The IBM i Menu System
Command-Line Operations
   Command-Line Function Keys
The Prompt Facility
   The Command Prompt Display
   Determining Allowable Values
   Command-Prompt Function Keys
   Additional Parameters
   Prompt Special Characters
Finding the Right CL Command
   Using the CMD Menus
Chapter Summary
Key Terms
Review Questions
Exercises

BASIC CL PROGRAMMING
Chapter 5 Creating CL Programs

Chapter Overview
The Capabilities of CL Programs
Using a Source Physical File
How to Create a CL Program
   Adding a Source Member
   Using WDSc to Add a Source Member
   Using PDM to Add a Source Member
   Entering CL Commands into a Source Member
   Compiling the CL Source
   Using the CL Compiler
   CL Compiler Options
   CL Compiler Reports
   Analyzing Compiler Reports
   Diagnosing Compile-Time Errors
   Diagnosing Errors with WDSc
   Binding a Program
   Using a Shortcut
CL and the Original Program Model
Chapter Summary
Key Terms
Review Questions
Programming Assignments

Chapter 6 The Structure of a CL Program
Chapter Overview
Entering CL Source Statements
   Free-Format Statement Entry
   Upper and Lower Case
   Blank Lines
   Keyword and Positional Notation
   Entering Program Comments
   Command Continuation (+ and –)
   Using Labels
The Sections of a CL Source Member
   Program Information Section
   Program Linkage Section
   Declarations Section
   Procedure Section
Putting It All Together
Chapter Summary
Key Terms
Review Questions
Programming Assignments

Chapter 7 Declaring Program Variables
Chapter Overview
What Is a Program Variable?
   How to Declare a Variable
The DCL Command
   Naming Variables
   Specifying the Data Type
   Specifying the Variable Size
Coding in Style
   Initializing the Value of a Variable
   Assigning Values to *CHAR Variables
   Assigning Values to *LGL Variables
   Assigning Values to Numeric Variables
   Miscellaneous Rules for Initial Values
   Using DCL with Pointers
   Declaring Based Variables
   Declaring Defined Variables
   More DCL Examples
The DCLF Command
   DCLF Examples
Chapter Summary
Key Terms
Review Questions
Exercises
Programming Assignments

Chapter 8 Manipulating Variables with the CHGVAR Command
Chapter Overview
The CHGVAR (Change Variable) Command
   Using CHGVAR with Character Variables
   Using CHGVAR with Numeric Variables
   Using CHGVAR with Logical Variables
Performing Data Conversion with CHGVAR
   Converting Numeric Data to Character Data
   Converting Character Data to Numeric Data
Using a Variable to Specify VALUE
Using an Arithmetic Expression to Specify VALUE
Using a Character String Expression to Specify VALUE
Using Built-In Functions
   Using %SUBSTRING
   Using %BINARY
Using Built-In Functions in the Receiver Variable
The DMPCLPGM Command
Using Functions with Pointers
Chapter Summary
Key Terms
Review Questions
Exercises
Programming Assignments

Chapter 9 CL Control Structures
Chapter Overview
CL and Structured Programming
The GOTO Command
IF/ELSE Structure
   Nested IF Structures
   Using the ELSE Command
   Nested IF/THEN/ELSE Structures
DO Groups
SELECT/WHEN/OTHERWISE Structure
Program Looping and Iteration
   DOWHILE Command
   DOUNTIL Command
   DOFOR Command
   Loops and Early Exits
Using Subroutines
   The CALLSUBR Command
   Leaving a Subroutine
   Using a Return Value
The DCLPRCOPT Command
Chapter Summary
Key Terms
Review Questions
Exercises
Programming Assignments

Chapter 10 Expressions
Chapter Overview
What Is an Expression?
Using Arithmetic Expressions
   Arithmetic Order of Operations
   Using the %BIN Function
Using Character String Expressions
   Using the %SST Function
Using Relational Expressions
   Relational Operators
   Character Operands of Different Lengths
   Using Relational Expressions with the CHGVAR Command
Using Logical Expressions
   Evaluating Logical Relationships
   Using Logical Variables and Logical Constants
   Using More Than Two Operands
Expression Order of Evaluation
Chapter Summary
Key Terms
Review Questions
Exercises
Programming Assignments

Chapter 11 Controlling Workflow
Chapter Overview
Work Management Overview
   What Is a Job?
   What Is a Job Description?
   What Is a Job Queue?
   What Is a Library List?
Executing Programs with the CALL Command
   ILE Considerations
The Call Stack
Executing Programs with the TFRCTL Command
The RETURN Command
   High-Level Language Considerations
Executing Commands in Batch Using SBMJOB
   The CMD Parameter of the SBMJOB Command
   Other SBMJOB Parameters
   Job Definition Parameters for SBMJOB
   Library List Parameters for SBMJOB
   SBMJOB Output Parameters
   Scheduling Parameters for SBMJOB
   The Self-Submitting Program
Chapter Summary
Key Terms
Review Questions
Exercises
Programming Assignments

Chapter 12 Basic Error Handling
Chapter Overview
Types of Errors
Error Messages
Message Files
The CHKOBJ Command
The MONMSG Command
   Command-Level MONMSG
   Program-Level MONMSG
   Mixing Command- and Program-Level MONMSGs
   Monitoring for Generic Messages
   Specifying Multiple MONMSG Commands
   Errors Within a MONMSG
The Interactive Job Log
   Ignoring Error Messages
   Receiving Escape Message Text
Chapter Summary
Key Terms
Review Questions
Exercises
Programming Assignments

INPUT/OUTPUT IN A CL PROGRAM
Chapter 13 Passing Parameters

Chapter Overview
What Are Parameters?
Defining Parameters in a Called Program
Passing Constants to a Called Program
   Passing Character Constants
   Passing Logical Constants
   Passing Decimal Constants
Passing Variables to a Called Program
   The Mechanics of Passing Variables
Passing Parameters Using the TFRCTL Command
Passing Parameters Using the SBMJOB Command
Using Hexadecimal Notation
Chapter Summary
Key Terms
Review Questions
Exercises
Programming Assignments

Chapter 14 Retrieving and Changing External Attributes
Chapter Overview
Return Variables
The RTVJOBA Command
   The CHGJOB Command
System Values
   The RTVSYSVAL Command
   The CHGSYSVAL Command
   Categories of System Values
   Date/Time System Values
   System Control System Values
   Library List System Value
   Other System Values
The RTVUSRPRF Command
   The CHGUSRPRF Command
Other RTV Commands
Date Conversion Using the CVTDAT Command
Chapter Summary
Key Terms
Review Questions
Exercises
Programming Assignments

Chapter 15 Files and Data Areas
Chapter Overview
Working with Files
   Database Files
   Display Files
CL and SQL
File Existence Requirements for CL
Data Description Specifications
   DDS for Physical Files
   DDS for Logical Files
   DDS for Display Files
Files Without DDS
CL File Processing
   The DCLF Command
   The SNDRCVF Command
   The SNDF Command
   The RCVF Command
   The WAIT and ENDRCV Commands
CL OUTFILE Support
Data Areas
   Creating and Deleting a Data Area
   Displaying a Data Area's Contents
   Retrieving the Contents of a Data Area
   Changing the Contents of a Data Area
   The Local Data Area
Chapter Summary
Data Queues
Key Terms
Review Questions
Exercises
Programming Assignments

ADVANCED CL PROGRAMMING
Chapter 16 Advanced Message Handling

Chapter Overview
Messages
   What Is a Message?
   Message Queues
   Types of Messages
Commands Used to Send Messages
   The SNDMSG Command
   The SNDBRKMSG Command
   The SNDPGMMSG Command
   The SNDUSRMSG Command
Receiving Messages
The TOPGMQ Parameter
   RCVMSG Examples
Removing Messages
   RMVMSG Examples
Standard Error-Handling Routines
Chapter Summary
Key Terms
Review Questions
Exercises
Programming Assignments

Chapter 17 Advanced File Techniques
Chapter Overview
Using Files in a CL Program
Using File Overrides
   Using the OVRDBF Command
   Using the DLTOVR Command
   Using the OVRPRTF Command
Positioning Database Files
Preopening Database Files
Using OPNQRYF
Using CPYFRMQRYF
Chapter Summary
Key Terms
Review Questions
Exercises
Programming Assignments

Chapter 18 Advanced Command Prompting
Chapter Overview
Reviewing the Prompt Facility
Simple Command Prompting
Selective Prompting
Chapter Summary
Key Terms
Review Questions
Exercises
Programming Assignments

Chapter 19 Using IBM-Supplied APIs
Chapter Overview
Introduction to APIs
Using QCMD
Using QUSCMDLN
Using QCMDCHK
   Prompting with QCMDCHK
Using QCMDEXC
   QCMDEXC and Call Levels
Other APIs
ILE Bindable APIs
Chapter Summary
Key Terms
Review Questions
Exercises
Programming Assignments

Chapter 20 Displaying and Changing Command Properties
Chapter Overview
Displaying the Properties of a CL Command
Changing the Properties of a CL Command
Changing Parameter Default Values
Changing IBM-Supplied Commands
Chapter Summary
Key Terms
Review Questions
Exercises

Chapter 21 Understanding the Job Log
Chapter Overview
What Is a Job Log?
The LOG Attribute
Logging CL Commands
Analyzing the Job Log
Keeping a Lean Job Log
Chapter Summary
Key Terms
Review Questions
Exercises
Programming Assignments

Chapter 22 Understanding the Integrated Language Environment
Chapter Overview
What Is ILE?
   What Is a Procedure?
   What Is a Module?
   What Is a Program?
Creating ILE Modules and Programs
   One-Step Program Creation
   Multiple-Module Programs
Updating ILE Programs
   Adding Modules
Calling ILE Programs and Procedures
   Calling ILE Procedures Using a Static Call
Using Service Programs
Understanding Activation Groups
   Default Activation Group
   User-Named Activation Group
   System-Named Activation Group
   *CALLER Activation Group Option
   *ENTMOD Activation Group Option
   Activation Groups Made Easy
   Activation Groups and File Overrides
   Call Stack Level Scoping
   Activation Group Scoping
   Job Scoping
ILE Error Handling
   ILE Error-Handling Tips
Chapter Summary
Key Terms
Review Questions
Exercises
Programming Assignments

CREATING YOUR OWN COMMANDS
Chapter 23 User-Defined Commands

Chapter Overview
Why Commands?
The Components of a Command
Command Definition Statements
   The CMD Statement
   The PARM Statement
   The QUAL Statement
   Other Command Definition Statements
The CRTCMD Command
Chapter Summary
Key Terms
Review Questions
Exercises
Programming Assignments

Chapter 24 Command Processing Programs
Chapter Overview
Writing a Command Processing Program
Parameters in the CPP
Analyzing the CPP
Processing List Parameters in the CPP
Using QCMDEXC as a CPP
Chapter Summary
Key Terms
Review Questions
Exercises
Programming Assignments

Chapter 25 Advanced Command Facilities
Chapter Overview
Adding Help to Your Commands
Using the GENCMDDOC Command
UIM Tag Language
Associating a Panel Group with a Command
Validity Checking Programs
Other Advanced Command Topics
Chapter Summary
Key Terms
Review Questions
Exercises
Programming Assignments

APPENDICES
Appendix A The Most-Often-Used CL Commands
Appendix B Program Development Tools
Appendix C Program Testing and Debugging

INDEX
Related titles
Complete CLComplete CL
IBM i Security Administration and ComplianceIBM i Security Administration and Compliance
IBM i5/iSeries PrimerIBM i5/iSeries Primer
Mastering IBM iMastering IBM i
Programming in RPG IVProgramming in RPG IV
Remote System Explorer, TheRemote System Explorer, The
 
  Special Offer Code  
Enter your Special Offer Code here:
  Search for  

  Our Products  
Browse all »»
HTML for the Business Developer
Free-Format RPG IV, 3rd Edition
Programming in RPG IV

If download option is selected, Adobe Acrobat 5.0 or later is required to read our e-books*


Windows PC, Mac OS9/OSX, and Linux