CL Programming
Figures
About CL Programming (SC41-5721)
Introduction
Control Language
Procedure
Module
Program
Service Program
Command Syntax
CL Procedures
Command Definition
Menus
Objects and Libraries
Objects
Libraries
Messages
Message Descriptions
Message Queues
Testing Functions
CL Programming
Creating a CL Program
Interactive Entry
Batch Entry
Parts of a CL Procedure
Example of a Simple CL Program
Commands Used in CL Procedures
Commands Entered on the RQSDTA and CMD Parameters
CL Commands
Using CL Procedures
Working with Variables
Declaring a Variable
Using Variables to Specify a List or Qualified Name
Lowercase Characters in Variables
Variables Replacing Reserved or Numeric Parameter Values
Changing the Value of a Variable
Trailing Blanks on Command Parameters
Writing Comments in CL Procedures
Controlling Processing within a CL Procedure
Using the GOTO Command and Labels
Using the IF Command
Using the DO Command and DO Groups
Using the ELSE Command
Using Embedded IF Commands
Using the *AND, *OR, and *NOT Operators
Using the %BINARY Built-In Function
Using the %SUBSTRING Built-In Function
Using the %SWITCH Built-In Function
Using the Monitor Message (MONMSG) Command
Values That Can Be Used as Variables
Retrieving System Values
Retrieving Configuration Source
Retrieving Configuration Status
Retrieving Network Attributes
Retrieving Job Attributes
Retrieving Object Descriptions
Retrieving User Profile Attributes
Retrieving Member Description Information
Working with CL Procedures
Logging CL Procedure Commands
CL Module Compiler Listings
Errors Encountered during Compilation
Obtaining a Procedure Dump
Displaying Module Attributes
Displaying Program Attributes
Return Code Summary
Compiling Source Programs for a Previous Release
Previous-Release (*PRV) Libraries
Installing CL Compiler Support for a Previous Release
Controlling Flow and Communicating between Programs and Procedures
CALL Command
CALLPRC Command
RETURN Command
Passing Parameters between Programs and Procedures
Using the CALL Command
Common Errors When Calling Programs and Procedures
Using Data Queues to Communicate between Programs and Procedures
Remote Data Queues
Comparisons with Using Database Files as Queues
Similarities to Message Queues
Prerequisites for Using Data Queues
Managing the Storage Used by a Data Queue
Allocating Data Queues
Examples Using a Data Queue
Creating Data Queues Associated with an Output Queue
Sample Data Queue Entry
Using Data Areas to Communicate between Procedures and Programs
Local Data Area
Group Data Area
Program Initialization Parameter (PIP) Data Area
Remote Data Areas
Creating a Data Area
Data Area Locking and Allocation
Displaying a Data Area
Changing a Data Area
Retrieving a Data Area
Retrieve Data Area Examples
Changing and Retrieving a Data Area Example
Objects and Libraries
Object Types and Common Attributes
Functions Performed on Objects
Functions the System Performs Automatically
Functions You Can Perform Using Commands
Libraries
Library Lists
Displaying a Library List
Using Generic Object Names
Searching for Multiple Objects or a Single Object
Using Libraries
Creating a Library
Specifying Authority for Libraries
Security Considerations for Objects
Default Public Authority for Newly Created Objects
Default Auditing Attribute for Newly Created Objects
Placing Objects in Libraries
Deleting and Clearing Libraries
Displaying Library Names and Contents
Displaying and Retrieving Library Descriptions
OS/400 Globalization
Describing Objects
Displaying Object Descriptions
Retrieving Object Descriptions
RTVOBJD Example
Creation Information for Objects
Detecting Unused Objects on the System
Moving Objects from One Library to Another
Creating Duplicate Objects
Renaming Objects
Compressing or Decompressing Objects
Compression of Objects
Temporarily Decompressed Objects
Automatic Decompression of Objects
Deleting Objects
Allocating Resources
Displaying the Lock States for Objects
Working with Objects in CL Procedures and Programs
Accessing Objects in CL Programs
Exceptions: Accessing Command Definitions, Files, and Procedures
Checking for the Existence of an Object
Working with Files in CL Procedures
Referring to Files in a CL Procedure
Opening and Closing Files in a CL Procedure
Declaring a File
Sending and Receiving Data with a Display File
Writing a CL Program to Control a Menu
Overriding Display Files in a CL Procedure
Working with Multiple Device Display Files
Receiving Data from a Database File
Overriding Database Files in a CL Procedure or Program
Referring to Output Files from Display Commands
Advanced Programming Topics
Using the QCAPCMD Program
Using the QCMDEXC Program
Using the QCMDEXC Program with DBCS Data
Using the QCMDCHK Program
Using Message Subfiles in a CL Program or Procedure
Allowing User Changes to CL Commands at Run Time
Using the Prompter within a CL Procedure or Program
Selective Prompting for CL Commands
QCMDEXC with Prompting in CL Procedures and Programs
Using the Programmer Menu
Uses of the Start Programmer Menu (STRPGMMNU) Command
Command Analyzer Exit Points
Application Programming for DBCS Data
Designing DBCS Application Programs
Converting Alphanumeric Programs to Process DBCS Data
Using DBCS Data in a CL Program
Sample CL Programs
Initial Program for Setup (Programmer)
Moving an Object from a Test Library to a Production Library (Programmer)
Saving Specific Objects in an Application (System Operator)
Recovery from Abnormal End (System Operator)
Submitting a Job (System Operator)
Timing Out While Waiting for Input from a Device Display
Retrieving Program Attributes
Loading and Running an Application from Tapes or Diskettes
Responsibilities of the Application Writer
Defining Messages
Creating a Message File
Message Files in Independent ASPs
Determining the Size of a Message File
Adding Messages to a File
Assigning a Message Identifier
Defining Messages and Message Help
Assigning a Severity Code
Defining Substitution Variables
Specifying Validity Checking for Replies
Sending an Immediate Message and Handling a Reply
Defining Default Values for Replies
Specifying Default Message Handling for Escape Messages
Example of Describing a Message
Defining Double-Byte Messages
System Message File Searches
Searching for a Message File
Overriding Message Files
Types of Message Queues
Creating or Changing a Message Queue
Job Message Queues
Working with Messages
Sending Messages to a System User
Sending Messages from a CL Program
Messages
Examples of Sending Messages
Call Stack Entry Identification on SNDPGMMSG
Receiving Messages in a CL Procedure or Program
Retrieving Messages in a CL Procedure
Removing Messages from a Message Queue
Monitoring for Messages in a CL Program or Procedure
Default Handling
Notify Messages
Status Messages
Preventing the Display of Status Messages
Break-Handling Programs
QSYSMSG Message Queue
Messages Sent to QSYSMSG Message Queue
Sample Program to Receive Messages from QSYSMSG
Using the System Reply List
Message Logging
Job Log
QHST History Log
Format of the History Log
Processing the QHST File
QHST Job Start and Completion Messages
Deleting QHST Files
Defining Commands
Overview of How to Define Commands
Step Description
Authority Needed for the Commands You Define
Example of Creating a Command
How to Define Commands
Using the CMD Statement
Defining Parameters
Data Type and Parameter Restrictions
Defining Lists for Parameters
Defining a Simple List
Defining a Mixed List
Defining Lists within Lists
Defining a Qualified Name
Defining a Dependent Relationship
Possible Choices and Values
Using Prompt Control
Conditional Prompting
Additional Parameters
Using Key Parameters and a Prompt Override Program
Procedure for Using Prompt Override Programs
CL Sample for Using the Prompt Override Program
Creating Commands
Command Definition Source Listing
Errors Encountered when Processing Command Definition Statements
Displaying a Command Definition
Effect of Changing the Command Definition of a Command in a Procedure or Program
Changing Command Defaults
Writing a Command Processing Program or Procedure
Writing a CL or HLL Command Processing Program
Writing a REXX Command Processing Procedure
Writing a Validity Checking Program
Examples of Defining and Creating Commands
Calling Application Programs
Substituting a Default Value
Displaying an Output Queue
Displaying Messages from IBM Commands More Than Once
Creating Abbreviated Commands
Deleting Files and Source Members
Deleting Program Objects
Debugging Programs
Debugging ILE Programs
The ILE Source Debugger
Debug Commands
Preparing a Program Object for a Debug Session
Starting the ILE Source Debugger
Adding Program Objects to a Debug Session
Removing Program Objects from a Debug Session
Viewing the Program Source
Changing a Module Object
Stepping through the Program Object
Stepping over Program Objects
Stepping into Program Objects
Displaying Variables
Changing the Value of Variables
Attributes of a Variable Examples
Equating a Name with a Variable, Expression, or Command
Source Debug National Language Support for ILE CL
Debugging OPM Programs
Debug Mode
The Call Stack
Handling Unmonitored Messages
Breakpoints
Traces
Display Functions
Displaying the Values of Variables
Changing the Values of Variables
Using a Job to Debug Another Job
Debugging at the Machine Interface Level
Security Considerations
Appendix A. TFRCTL Command
Using the TFRCTL Command
Passing Parameters
Appendix B. Job Log Output Files
Directing a Job Log
Model for the Primary Job Log
Appendix C. IBM-Supplied Libraries in Licensed Programs (LP)
IBM-Supplied Libraries for the OS/400 Licensed Program
IBM-Supplied Libraries for Other iSeries Licensed Programs
Appendix D. Abbreviations of CL Commands and Keywords
CL Command Verb Abbreviations
CL Command Abbreviations
CL Command Keyword Abbreviations
Appendix E. Notices
Programming Interface Information
Trademarks
Bibliography
Index
[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]
(C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.