| About this title |
The effective use of Control Language (CL) is a critical skill for anyone working with IBM i on the IBM Power Systems (formerly i5, iSeries, and System i). But why settle for just enough CL knowledge to get by? From the simplest task to the most complex process, CL is at the heart of your server. Become a CL guru and fully leverage the abilities of your system. All it takes is a little time, effort, and Complete CL, 5th Edition.
Author and expert Ted Holt returns to bring you the latest version of this bestselling classic, pulling together all of the CL basics plus the latest innovations in one thorough, well-organized, and easy-to-read package. In a clear, straightforward manner, Ted shows you how to write both simple and advanced CL programs, understand the strengths and limitations of CL, avoid common mistakes, and much more. With this resource, you will master CL and extend the capabilities of your system. Programmers, operators, security officers, system administrators, or any IT professional working with IBM i will greatly benefit by reading this book.
Complete CL, 5th Edition is fully updated to include the numerous enhancements to the IBM i operating system, including a beefed-up compiler with new control structures, new data types, a new way to create documentation, a relaxation of old limits, and more.
This new edition has:
- A complete explanation of subroutines, with examples
- Information on the INCLUDE command
- Explanations of the new variable types, including pointer and based variables
- Coverage of the *NULL constant and overlaying variables
- Examples of using overlaying variables instead of the substring function
- An explanation of the new parameters for the DCL command
- Information on the CLOSE command
Plus, you'll develop the skills needed to:- Manipulate strings with built-in functions and operators
- Code looping and decision structures
- Use data queues and data areas
- Process display and database files
- Avoid the pitfalls of adopted authorities
- Code both batch and interactive programs in CL
- Compile CL programs and modules and then bind modules into programs
|
About author |
Ted Holt — Ted Holt has been working in the IT industry since 1981, primarily with IBM midrange computers. His industry experience includes the fields of manufacturing, healthcare, education, retail, and wholesale. Ted holds a master's degree in computer science and has taught in community colleges, universities, and vocational/technical schools.
Ted is the author of several books on programming topics, including Open Query File Magic!, Complete CL, Power CL, and the MC Press Encyclopedia of Tips, Techniques, and Programming Practices for iSeries and AS/400. He is also a frequent contributor to several magazines.
|
Contents |
Chapter 1: INTRODUCTION
WHO NEEDS CL?
WHO HAS CL?
CAPABILITIES OF CL
LIMITATIONS OF CL
Chapter 2: A FIRST LOOK AT CL
THE PARTS OF A CL PROCEDURE
THE PGM Command
The COPYRIGHT Command
The Declarations
Global MONMSG
The Body of a Procedure
The ENDPGM Command
The Include CL Source (INCLUDE) Command
ENTERING THE SOURCE CODE WITH SEU
The Source Physical File
Starting SEU
Formatting the Statements with F4
Uppercase or Lowercase?
Positional Parameters or Keywords?
Continuing on the Next Line
Indented or Unindented?
COMPILING THE PROCEDURE
The CRTBNDCL Command
Output of CRTBNDCL
EXECUTING THE PROGRAM
OPTIONAL COMPONENTS OF A CL PROCEDURE
Blank Lines
Comment Lines
Comments on Command Lines
Chapter 3: CONSTANTS AND VARIABLES
WHAT IS A CONSTANT?
Character Constants
Decimal Constants
Integer Constants
Hexadecimal Constants
Logical Constants
The *NULL Constant
WHAT ARE VARIABLES?
Declaring Variables
Coding for Clarity
Where Variables Can Be Used
Parameters
OVERLAID VARIABLES
POINTER VARIABLES AND BASED VARIABLES
BASED VARIABLES
Chapter 4: BASIC OPERATORS AND FUNCTIONS
THE CHGVAR COMMAND
ARITHMETIC OPERATORS
Substring Function
OVERLAID VARIABLES
CONCATENATING STRINGS
SIMULATING ARRAYS IN CL
BINARY CONVERSION
Logical Operations
EXPRESSIONS AND OPERATOR HIERARCHY
THE CVTDAT COMMAND
Chapter 5: CONTROL STATEMENTS
THE IF COMMAND
Simple Logical Expressions
Complex Logical Expressions
THE DO AND ENDDO COMMANDS
Single-Level DO Groups
Nesting DO Groups
Nesting IF Commands
THE ELSE COMMAND
Using Do with Else
THE SELECT COMMAND
THE DOWHILE COMMAND
THE DOUNTIL COMMAND
THE DOFOR COMMAND
THE LEAVE AND ITERATE COMMANDS
THE GOTO COMMAND
SUBROUTINES
The Syntax of Subroutines
The Subroutine Stack
THE CALL AND CALLPRC COMMANDS
Passing Variables as Parameters
Passing Constants as Parameters
THE ENDPGM AND RETURN COMMANDS
THE TFRCTL COMMAND
Chapter 6: MESSAGE MANAGEMENT
WHAT IS A MESSAGE?
MESSAGE QUEUES
Permanent Message Queues
Job Message Queues
TYPES OF MESSAGES
New versus Old
Purpose of the Message
Impromptu and Predefined Messages
USING PREDEFINED MESSAGES
Message Files
Message Descriptions
THE SNDPGMMSG COMMAND
What to Say in the Message
Who Should Get the Message
Type of Message
Getting the Reply
Message Key
THE SNDUSRMSG COMMAND
Sending Impromptu Messages
Sending Predefined Messages
Type of Message
Who Gets the Message
Receiving the Reply
MESSAGES THAT CAN BE MONITORED
Parameters
Program-Level (Global) MONMSG
Command-Level MONMSG
Specific and Generic Monitoring
THE RCVMSG COMMAND
Get the Message from Where?
Which Message to Receive?
Message Received—Now What?
How Long to Wait?
Remove the Message Received?
Examples of RCVMSG
OTHER MESSAGE MANAGEMENT COMMANDS
Remove Messages (RMVMSG)
Send Reply (SNDRPY)
Send Message (SNDMSG)
Send Break Message (SNDBRKMSG)
DSPMSG and WRKMSG
Clear Message Queue (CLRMSGQ)
THE SYSTEM REPLY LIST
Purpose of the System Reply List
Using the System Reply List
Pitfalls
MESSAGE SUBFILES
The Display File
The CL Program
Chapter 7: INTERPROGRAM AND INTERMODULE COMMUNICATIONS
USING PARAMETERS
Parameter Variables
Parameter Constants
Limitations
USING DATA AREAS
The CRTDTAARA and DLTDTAARA Commands
The CHGDTAARA, RTVDTAARA, and DSPDTAARA Commands
Special Data Areas
USING SWITCHES
Turning Switches On and Off
Testing the Switches
Using the Switches
USING MESSAGES
Another Look at SNDPGMMSG
Another Look at RCVMSG
USING DATA QUEUES
Types of Data Queues
The CRTDTAQ and DLTDTAQ Commands
Sending, Receiving, and Clearing Data Queues
Retrieving Data Queue Description
Receiving from Data Queue without Deletion
Utility Commands
Advantages of Data Queues
Disadvantages of Data Queues
Chapter 8: JOB AND SYSTEM INTERFACE
LIBRARY LIST SUPPORT
Retrieving System Values
CHANGING SYSTEM VALUES
THE RTVJOBA AND CHGJOB COMMANDS
THE RTVUSRPRF, CHGUSRPRF, AND CHGPRF COMMANDS
THE RTVNETA COMMAND
SUMMARY OF THE RETRIEVE (RTV) COMMANDS
Chapter 9: USING FILES
RECORD-BY-RECORD PROCESSING OF A FILE
The DCLF Command
The RCVF, WAIT, and ENDRCV Commands
RCVF and RANDOM INPUT
The SNDF and SNDRCVF Commands
The CLOSE Command
PROCESSING A FILE AS A WHOLE
Creating and Deleting Files
Processing Database File Members
The OVRXXXF and DLTOVR Commands
Sorting with OPNQRYF
CAPTURING OUTPUT USING QTEMP
Using Permanent Work Files
Using Outfiles
Capturing OUTPUT(*PRINT)
Chapter 10: USING QUOTES
USING QUOTES IN CL
EMBEDDED QUOTES
Expressions, Character Strings, and Command Strings
Multiple Quotes
Using an "E Variable
Chapter 11: MANAGING OBJECTS
CREATING OBJECTS: THE CRTXXX COMMANDS
DELETING OBJECTS: THE DLTXXX COMMANDS
CHECKING EXISTENCE: THE CHKOBJ COMMAND
RETRIEVING DESCRIPTION: THE RTVOBJD COMMAND
RETRIEVING DESCRIPTION: THE RTVMBRD COMMAND
CREATING DUPLICATES: THE CRTDUPOBJ COMMAND
MANIPULATING OBJECTS: MOVOBJ, CHGOBJD, AND RNMOBJ
ALLOCATING: THE ALCOBJ COMMAND
Chapter 12: BATCH JOB PROCESSING
THE CONCEPT OF BATCH PROCESSING
JOB QUEUES
THE SBMJOB COMMAND
AN UNEXPECTED PROBLEM WITH SBMJOB
WORKING WITH SUBMITTED JOBS
THE QSYSOPR MESSAGE QUEUE
SELF-SUBMITTING PROGRAMS
Chapter 13: ADVANCED TOPICS
HOW TO CODE SELECTIVE PROMPTING
A Common Mistake
Making the Prompt Selective
USING QCMDCHK
Calling QCMDCHK
Selective Prompting and QCMDCHK
USING QCMDEXC
Why Bother with QCMDEXC in CL?
Commands Not Allowed
USING QCLSCAN
Calling QCLSCAN
USING QDCXLATE
Standard Translations
Using DLYJOB
DLYJOB with DLY
DLYJOB with RSMTIME
USING RCLRSC AND RCLACTGRP
RETRIEVING CL SOURCE
The RTVCLSRC Command
Chapter 14: SECURITY CONSIDERATIONS
SECURING THE *PGM OBJECT
An Example
Securing an Object
Take Care of *PUBLIC
ADOPTING AUTHORITY
Ownership
Adopting Authority
Another Example
Adopted Authority from Other Programs in the Call Stack
Other Risks of Adopted Authority
COMMAND LINES
Limited Capabilities
Pros and Cons of Command Lines
Appearing Command Lines
Chapter 15: SIGN-ON PROGRAMS
USING JOB DESCRIPTIONS
WHAT JOB DESCRIPTIONS CANNOT DO
SAMPLE SIGN-ON PROGRAM
Chapter 16: DEBUGGING
THE STRDBG COMMAND
THE ENDDBG COMMAND
DEBUGGING VIEWS
AN EXAMPLE INTERACTIVE DEBUGGING SESSION
DEBUGGING IN SOURCE VIEW
OTHER IMPORTANT DEBUGGER COMMANDS
SUMMARY OF DEBUGGER COMMANDS
DEBUGGING IN LIST VIEW
DEBUGGING IN STATEMENT VIEW
OPM PROGRAMS AND THE ILE DEBUGGER
DEBUGGING ANOTHER JOB
THE DMPCLPGM COMMAND
Chapter 17: CL AND THE INTEGRATED LANGUAGE ENVIRONMENT
TYPES OF OBJECT CODE
BINDING
Binding by Copy
Binding by Reference
The Dynamic Call
COMPILATION
CRTCLMOD
CRTSRVPGM
CRTPGM
CRTBNDCL
ACTIVATION GROUPS
The Default Activation Group
ACTGRP(IDENTIFIER)
ACTGRP(*NEW)
ACTGRP(*CALLER)
Destroying Activation Groups
PARAMETER DESCRIPTIONS
PGM: Program Name
SRCFILE: Source File Name
SRCMBR: Source Member Name
TEXT: Text Description
DFTACTGRP: Default Activation Group
OPTION: Compiler Listing Options
USRPRF: Assumed User Profile
LOG: Log Commands
REPLACE: Replace Existing Program
TGTRLS: Target Release
AUT: Public Authority
SRTSEQ: Sort Sequence
LANGID: Language ID
DBGVIEW: Debugging View
ENBPFRCOL: Enable Performance Collection
ACTGRP: Activation Group Name
OPTIMIZE: Optimization
Appendix A: SOME UTILITY COMMANDS
MESSAGES
PROGRAMMING AIDS
PROGRAMMING SHORTCUTS
DATA QUEUES
OTHER COMMANDS
Appendix B: CL CODING STYLE
Appendix C: SAMPLE SIGN-ON PROGRAM
Appendix D: DEBUGGING OPM PROGRAMS
Appendix E: THE ORIGINAL PROGRAM MODEL
Appendix F: DIFFERENCES IN S/38 CL
Appendix G: FOR S/36 PROGRAMMERS
Index
|
Related titles |
|
|