Intrasystem Communications Programming

Intrasystem Communications Programming
AS/400
IBM
Intrasystem Communications
Programming
Version 4
SC41-5447-00
AS/400
IBM
Intrasystem Communications
Programming
Version 4
SC41-5447-00
Take Note!
Before using this information and the product it supports, be sure to read the general information under “Notices” on page v.
August Edition (August 1997)
This edition applies to the licensed program IBM Operating System/400, (Program 5769-SS1), Version 4 Release 1 Modification 0, and to all
subsequent releases and modifications until otherwise indicated in new editions.
Make sure that you are using the proper edition for the level of the product.
Order publications through your IBM representative or the IBM branch serving your locality. If you live in the United States, Puerto Rico, or
Guam, you can order publications through the IBM Software Manufacturing Solutions at 800+879-2755. Publications are not stocked at the
address given below.
IBM welcomes your comments. A form for readers’ comments may be provided at the back of this publication. You can also mail your
comments to the following address:
IBM Corporation
Attention Department 542
IDCLERK
3605 Highway 52 N
Rochester, MN 55901-7829 USA
or you can fax your comments to:
United States and Canada: 800+937-3430
Other countries: (+1)+507+253-5192
If you have access to Internet, you can send your comments electronically to [email protected]; IBMMAIL, to
IBMMAIL(USIB56RZ).
When you send information to IBM, you grant IBM a nonexclusive right to use or distribute the information in any way it believes appropriate
without incurring any obligation to you.
 Copyright International Business Machines Corporation 1997. All rights reserved.
Note to U.S. Government Users — Documentation related to restricted rights — Use, duplication or disclosure is subject to restrictions set forth
in GSA ADP Schedule Contract with IBM Corp.
Contents
Notices . . . . . . . . . . . . . . . . . . . . . . . . . .
Programming Interface Information . . . . . . . . . . . .
Trademarks and Service Marks
. . . . . . . . . . . . .
About Intrasystem Communications Programming
(SC41-5447)
. . . . . . . . . . . . . . . . . . . .
Who Should Use This Book
. . . . . . . . . . . . .
Prerequisite and Related Information . . . . . . . . .
Information Available on the World Wide Web . . . .
.
.
.
.
Chapter 1. Introduction to Intrasystem
Communications . . . . . . . . . . . . . . . . . . .
Overview of Intrasystem Communications . . . . . . .
Using Intrasystem Communications to Test
Communications Applications . . . . . . . . . . . . .
.
.
.
.
v
v
v
vii
vii
vii
vii
1-1
1-1
1-2
Chapter 2. Configuring Intrasystem
Communications . . . . . . . . . . . . . . . . . . .
Defining the Intrasystem Communications Configuration
Example . . . . . . . . . . . . . . . . . . . . . . .
2-1
2-1
2-1
Chapter 3. Running Intrasystem Communications
Support . . . . . . . . . . . . . . . . . . . . . . . .
Vary On and Vary Off Support . . . . . . . . . . . . .
Example . . . . . . . . . . . . . . . . . . . . . . .
3-1
3-1
3-1
Chapter 4. Writing Intrasystem Application
Programs . . . . . . . . . . . . . . . . . . . . . .
. . . . .
Intersystem Communications Function File
Specifying the Program Device Entry Commands . .
Communications Operations . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . .
Starting a Session
Open/Acquire Operation . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
Starting a Transaction
Evoke Function
. . . . . . . . . . . . . . . . . .
Sending Data . . . . . . . . . . . . . . . . . . . . .
Write Operation . . . . . . . . . . . . . . . . . .
Force-Data Function . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . .
Confirm Function
Format-Name Function
. . . . . . . . . . . . . .
Subdevice Selection Function . . . . . . . . . . .
End-of-Group Function
. . . . . . . . . . . . . .
Function-Management-Header Function
. . . . .
Receiving Data . . . . . . . . . . . . . . . . . . . .
Read Operation . . . . . . . . . . . . . . . . . .
Invite Function . . . . . . . . . . . . . . . . . . .
Read-from-Invited-Program-Devices Operation . .
Waiting for a Display File, an ICF File, and a Data
Queue . . . . . . . . . . . . . . . . . . . . . .
Notifying the Remote Program of Problems . . . . .
Fail Function . . . . . . . . . . . . . . . . . . . .
Cancel Function . . . . . . . . . . . . . . . . . .
Negative-Response Function . . . . . . . . . . .
Using Additional Functions/Operations . . . . . . . .
Respond-to-Confirm Function . . . . . . . . . . .
 Copyright IBM Corp. 1997
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
4-1
4-1
4-2
4-3
4-3
4-3
4-3
4-3
4-4
4-4
4-4
4-4
4-4
4-4
4-4
4-4
4-4
4-4
4-4
4-5
.
.
.
.
.
.
.
4-5
4-5
4-5
4-5
4-5
4-6
4-6
Request-to-Write Function . . . . . . .
Allow-Write Function . . . . . . . . . .
Cancel-Invite Function . . . . . . . . .
Timer Function . . . . . . . . . . . . .
Get-Attributes Operation . . . . . . . .
Ending Transactions . . . . . . . . . . .
Detach Function . . . . . . . . . . . .
Ending Sessions . . . . . . . . . . . . .
Release Operation . . . . . . . . . . .
End-of-Session Function
. . . . . . .
Close Operation . . . . . . . . . . . .
Using Response Indicators . . . . . . . .
Receive-Confirm . . . . . . . . . . . .
Receive-End-of-Group . . . . . . . . .
Receive-Function-Management-Header
Receive-Fail . . . . . . . . . . . . . .
Receive-Cancel . . . . . . . . . . . .
Receive-Negative-Response
. . . . .
Receive-Turnaround . . . . . . . . . .
Receive-Detach . . . . . . . . . . . .
Using the Input/Output Feedback Area . .
. . . . . . . . . . .
Using Return Codes
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Chapter 5. Considerations for Intrasystem
Communications . . . . . . . . . . . . . . . . . .
Application Considerations . . . . . . . . . . . . . .
General Considerations . . . . . . . . . . . . . .
Open/Acquire Considerations . . . . . . . . . . .
Input Considerations . . . . . . . . . . . . . . . .
Confirm Considerations . . . . . . . . . . . . . .
Release, End-of-Session, and Close Considerations
Performance Considerations . . . . . . . . . . . . .
Prestarting Jobs for Program Start Requests . . .
Appendix A. Language Operations, Data
Description, Specifications Keywords, and
System-Supplied Formats . . . . . . . . .
Language Operations . . . . . . . . . . . . .
Data Description Specifications Keywords . .
System-Supplied Formats
. . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Appendix B. Return Codes, Messages, and Sense
Codes . . . . . . . . . . . . . . . . . . . . . . . .
Return Codes . . . . . . . . . . . . . . . . . . . . .
Major Code 00 . . . . . . . . . . . . . . . . . . . .
Major Code 02 . . . . . . . . . . . . . . . . . . . .
Major Code 03 . . . . . . . . . . . . . . . . . . . .
Major Code 04 . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
Major Codes 08 and 11
Major Code 34 . . . . . . . . . . . . . . . . . . . .
Major Code 80 . . . . . . . . . . . . . . . . . . . .
Major Code 81 . . . . . . . . . . . . . . . . . . . .
Major Code 82 . . . . . . . . . . . . . . . . . . . .
Major Code 83 . . . . . . . . . . . . . . . . . . . .
Failed Program Start Requests . . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
4-6
4-6
4-6
4-6
4-6
4-6
4-6
4-7
4-7
4-7
4-7
4-7
4-7
4-7
4-8
4-8
4-8
4-8
4-8
4-8
4-8
4-8
.
.
.
.
.
.
.
.
5-1
5-1
5-1
5-1
5-1
5-2
5-2
5-2
5-2
.
.
.
.
A-1
A-1
A-2
A-2
.
.
.
.
.
.
.
B-1
B-1
B-1
B-4
B-7
B-8
B-9
B-10
B-11
B-13
B-14
B-19
B-24
iii
Appendix C. Using Intrasystem Communications to
Test Applications
. . . . . . . . . . . . . . . . . .
Using Intrasystem Communications for Advanced
Program-to-Program Communications . . . . . . . .
Using Intrasystem Communications for Asynchronous
Communications
. . . . . . . . . . . . . . . . . . .
Using Intrasystem Communications with Binary
Synchronous Communications Equivalence Link . . .
Using Intrasystem Communications for Finance
Communications
. . . . . . . . . . . . . . . . . . .
Using Intrasystem Communications for Retail
Communications
. . . . . . . . . . . . . . . . . . .
Using Intrasystem Communications for Systems
Network Architecture Upline Facility
. . . . . . . . .
Appendix D. Program Examples
C-1
C-1
C-2
C-2
C-3
Description of the Single-Session Inquiry Program
Example . . . . . . . . . . . . . . . . . . . . . . . .
ILE C/400 Source Program for a Single-Session Inquiry
ILE C/400 Target Program for a Single-Session Inquiry
Description of the Two-Session Inquiry Program
Example . . . . . . . . . . . . . . . . . . . . . . .
COBOL/400 Source Program for a Two-Session
Inquiry . . . . . . . . . . . . . . . . . . . . . . . .
COBOL/400 Target Program for a Two-Session Inquiry
RPG/400 Source Program for a Two-Session Inquiry
RPG/400 Target Program for a Two-Session Inquiry
D-1
D-1
D-9
D-14
D-14
D-33
D-39
D-56
C-4
C-5
Bibliography . . . . . . . . . . . . . . . . . . . . . . H-1
AS/400 Books . . . . . . . . . . . . . . . . . . . . H-1
System/36 Communications Books . . . . . . . . . H-1
. . . . . . . . . . D-1
Index
. . . . . . . . . . . . . . . . . . . . . . . . . .
X-1
Figures
1-1.
1-2.
A-1.
A-2.
B-1.
B-2.
D-1.
D-2.
D-3.
D-4.
D-5.
D-6.
D-7.
Overview of Intrasystem Communications . .
A Source Program Communicating with
Multiple Target Programs
. . . . . . . . . .
Language Operations
. . . . . . . . . . . .
Valid Operations for Programming Languages
Actions for Return Code 0000 . . . . . . . .
Reason Codes for Rejected Program Start
Requests . . . . . . . . . . . . . . . . . .
DDS Source for a Single-Session Source
Program Using SRCICFF
. . . . . . . . . .
DDS Source for a Single-Session Source
Program Using DSPFIL
. . . . . . . . . . .
Source Program Example — CSRCPGM . .
DDS Source for a Single-Session Target
Program Using TGTICFF
. . . . . . . . . .
DDS Source for a Single-Session Source
Program Using CUSMSTP . . . . . . . . . .
DDS Source for a Single-Session Target
Program Using LGCMSTF . . . . . . . . . .
.
Target Program Example — CTGTPGM
1-1
D-8.
1-2
A-1
A-1
B-2
D-9.
D-10.
D-11.
B-25
D-12.
D-2
D-13.
D-2
D-4
D-14.
D-15.
D-9
D-9
D-9
D-11
D-16.
D-17.
D-18.
D-19.
iv
Intrasystem Communications Programming V4R1
DDS Source for a Two-Session Source
Program Using INTFIL . . . . . . . . . . .
DDS for Source Program Two-Session
. . . . . . . . . . .
Inquiry Using DSPFIL
Source Program Example — CSDINT . . .
DDS Source for a Two-Session Target
Program Using CFILE . . . . . . . . . . .
DDS Source for a Two-Session Target
Program Using PFILE . . . . . . . . . . .
Target Program Example — CTDINT
(User-Defined Formats)
. . . . . . . . . .
DDS Source for a Two-Session Source
Program Using INTFIL . . . . . . . . . . .
DDS Source for Source Program
Two-Session Inquiry Using DSPFIL . . . .
Source Program Example — RSDINT . . .
DDS Source for an ICF File Used by a
Target Program
. . . . . . . . . . . . . .
DDS Source for a Database File Used by a
. . . . . . . . . . . . . .
Target Program
. . .
Target Program Example —RTDINT
D-15
D-16
D-20
D-34
D-34
D-35
D-39
D-40
D-44
D-56
D-57
D-58
Notices
References in this publication to IBM products, programs, or services do not imply that IBM intends to make these available in
all countries in which IBM operates. Any reference to an IBM product, program, or service is not intended to state or imply that
only that IBM product, program, or service may be used. Subject to IBM's valid intellectual property or other legally protectable
rights, any functionally equivalent product, program, or service may be used instead of the IBM product, program, or service.
The evaluation and verification of operation in conjunction with other products, except those expressly designated by IBM, are
the responsibility of the user.
IBM may have patents or pending patent applications covering subject matter in this document. The furnishing of this document does not give you any license to these patents. You can send license inquiries, in writing, to the IBM Director of
Licensing, IBM Corporation, 500 Columbus Avenue, Thornwood, NY 10594, U.S.A.
Licensees of this program who wish to have information about it for the purpose of enabling: (i) the exchange of information
between independently created programs and other programs (including this one) and (ii) the mutual use of the information
which has been exchanged, should contact the software interoperability coordinator. Such information may be available,
subject to appropriate terms and conditions, including in some cases, payment of a fee.
Address your questions to:
IBM Corporation
Software Interoperability Coordinator
3605 Highway 52 N
Rochester, MN 55901-7829 USA
This publication could contain technical inaccuracies or typographical errors.
This publication may refer to products that are announced but not currently available in your country. This publication may also
refer to products that have not been announced in your country. IBM makes no commitment to make available any unannounced products referred to herein. The final decision to announce any product is based on IBM's business and technical
judgment.
This publication contains examples of data and reports used in daily business operations. To illustrate them as completely as
possible, the examples include the names of individuals, companies, brands, and products. All of these names are fictitious
and any similarity to the names and addresses used by an actual business enterprise is entirely coincidental.
This publication contains small programs that are furnished by IBM as simple examples to provide an illustration. These examples have not been thoroughly tested under all conditions. IBM, therefore, cannot guarantee or imply reliability, serviceability,
or function of these programs. All programs contained herein are provided to you "AS IS". THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY DISCLAIMED.
Programming Interface Information
This book is intended to help the customer develop communications between two application programs on the same system. It
contains information about the intrasystem communications support provided by the AS/400 system. The Intrasystem Communications Programming book contains no programming interfaces for customers.
Trademarks and Service Marks
The following terms, denoted by an asterisk (*) in this publication, are trademarks of the IBM Corporation in the United States
or other countries or both:
Application System/400
AS/400
COBOL/400
IBM
ILE C/400
 Copyright IBM Corp. 1997
ILE COBOL/400
ILE RPG/400
RPG/400
Operating System/400
OS/400
400
v
Microsoft, Windows, and the Windows 95 logo are trademarks or registered trademarks of Microsoft Corporation.
PC Direct is a trademark of Ziff Communications Company and is used by IBM Corporation under license.
UNIX is a registered trademark in the United States and other countries licensed exclusively through X/Open Company Limited.
C-bus is a trademark of Corollary, Inc.
Java and HotJava are trademarks of Sun Microsystems, Inc.
Other company, product, and service names, which may be denoted by a double asterisk (**), may be trademarks or service
marks of others.
vi
Intrasystem Communications Programming V4R1
About Intrasystem Communications Programming (SC41-5447)
This book contains information about the intrasystem communications support provided by the AS/400 system. It is
intended to be used as a guide for developing communications between two application programs on the same system.
For a list of related publications, see the Bibliography.
Who Should Use This Book
This book is intended for the AS/400 application programmer
responsible for defining or using intrasystem communications
support. It is used for developing application programs that
use the support.
You should be familiar with the following information:
Ÿ Managing jobs and messages on the AS/400 system,
described in the System Operation book, SC41-4203.
Ÿ Using the intersystem communications function (ICF) file,
described in the ICF Programming book, SC41-5442.
Ÿ Communications configuration information described in
the Communications Configuration book, SC41-5401.
Prerequisite and Related Information
For information about other AS/400 publications (except
Advanced 36), see either of the following:
Ÿ The Publications Reference book, SC41-5003, in the
AS/400 Softcopy Library.
Ÿ The AS/400 Information Directory, a unique, multimedia
interface to a searchable database that contains
descriptions of titles available from IBM or from selected
other publishers. The AS/400 Information Directory is
shipped with the OS/400 operating system at no charge.
Information Available on the World Wide
Web
More AS/400 information is available on the World Wide
Web. You can access this information from the AS/400
home page, which is at the following uniform resource locator
(URL) address:
http://www.as4ðð.ibm.com
Select the Information Desk, and you will be able to access a
variety of AS/400 information topics from that page.
 Copyright IBM Corp. 1997
vii
viii
Intrasystem Communications Programming V4R1
Chapter 1. Introduction to Intrasystem Communications
AS/400 intrasystem communications allows two application
programs, which are running in two different jobs on the
same system, to communicate with each other through an
ICF file. Using intrasystem communications can help you
debug the programs before they are used to communicate
with a remote system over a communications line. AS/400
application programs can be written in the ILE C/400*, ILE
COBOL/400, or ILE RPG/400* programming languages to
use intrasystem communications.
The intrasystem communications support uses intersystem
communications function (ICF)1 data management to
handle the sending and receiving of data between the two
programs. For communications to begin between programs,
the intrasystem communications device description first
needs to be configured and varied on.
Note: Because intrasystem communications supports
process-to-process communications within the same system
without the use of communications lines, line and controller
descriptions are not used.
Overview of Intrasystem Communications
Figure 1-1 provides an overview of the Operating
System/400* (OS/400*) intrasystem communications support.
Application program A communicates with application
program B. ICF data management handles the communications functions and data from your program. The intrasystem
communications support handles the communications protocol needed for data transfer and communications between
the two programs.
Both the source program (Program A) and the program with
which it is communicating (Program B) must use the same
device description.
Figure 1-2 on page 1-2 shows how multiple target programs
can communicate with the same source program.
When using intrasystem communications, a source program
can acquire more than one session for a given device
description, and can issue more than one evoke function to
1
start multiple target programs. This means, for example, that
PGMA can establish a transaction with PGMB on one
session and another transaction with PGMC on another
session, and have all the transactions at the same time.
However, having established a communications transaction
with PGMB on a given session, PGMA cannot then establish
a transaction with PGMC on the same session.
Note: The term target program is used in this book to refer
to the program with which the source program communicates, even though the target program is not on a remote
system.
Intrasystem communications imposes no restrictions as to
the maximum number of sessions that can be associated
with a device. However, the maximum program device
(MAXPGMDEV) parameter on the Create ICF File
(CRTICFF) command specifies the maximum number of
program devices that you can use with the ICF file.
AS/4ðð System
┌──────────────────────────────────────────────────────────────┐
│
Process A
Process B
│
│ ┌──────────────────────────┐
┌───────────────────────────┐ │
│ │
Application
│
│
Application
│ │
│ │
Program A
│
│
Program B
│ │
│ │
│
│
│ │
│ │ ┌──────────────────────┐ │
│ ┌───────────────────────┐ │ │
│ │ │ ┌──────┐ ┌──────┐ │ │
│ │ ┌──────┐
┌──────┐ │ │ │
│ │ │ │ Data │ │ Data │ │ │
│ │ │ Data │
│ Data │ │ │ │
│ │ │ └┬─────┘ └─────&┘ │ │
│ │ └┬─────┘
└─────&┘ │ │ │
│ │ └───┼──────────────┼───┘ │
│ └───┼───────────────┼───┘ │ │
│ │
│
│
│
│
│
│
│ │
│ │
│
│
│
│
│
│
│ │
│ │ ┌───6──────────────┴───┐ │
│ ┌───6───────────────┴───┐ │ │
│ │ │
ICF
│ │
│ │
ICF
│ │ │
│ │ │
Data
│ │
│ │
Data
│ │ │
│ │ │
Management
│ │
│ │
Management
│ │ │
│ │ └───┬──────────────&───┘ │
│ └───┬───────────────&───┘ │ │
│ │
│
│
│
│
│
│
│ │
│ │
│
│
│
│
│
│
│ │
│ │ ┌───6──────────────┴───┐ │
│ ┌───6───────────────┴───┐ │ │
│ │ │
Intrasystem
│ │
│ │
Intrasystem
│ │ │
│ │ │
Communications
│ │
│ │
Communications
│ │ │
│ │ │
Support
│ │
│ │
Support
│ │ │
│ │ └───┬──────────────&───┘ │
│ └───┬───────────────&───┘ │ │
│ │
│
└─────┼───┼─────┘
│
│ │
│ │
└────────────────────┼───┼─────────────────────┘
│ │
│ │
│
│
│ │
│ └──────────────────────────┘
└───────────────────────────┘ │
└──────────────────────────────────────────────────────────────┘
Figure 1-1. Overview of Intrasystem Communications
The intersystem communications function (ICF) is a function of the operating system that allows a program to communicate interactively with
another program or system.
 Copyright IBM Corp. 1997
1-1
AS/4ðð System
┌─────────────────────────────────────────────────────────────────────────────────────────────┐
│ ProcessA
ProcessB
ProcessC
│
│ ┌─────────────────────────────────┐
┌──────────────────────┐
┌──────────────────────┐ │
│ │
PGMA
│
│
PGMB
│
│
PGMC
│ │
│ │ ┌──────────────┬──────────────┐ │
│ ┌──────────────────┐ │
│ ┌──────────────────┐ │ │
│ │ │ Acquire
│ Acquire
│ │
│ │
│ │
│ │
│ │ │
│ │ │ PGMDEVC
│ PGMDEVB
│ │
│ │
│ │
│ │
│ │ │
│ │ │ Evoke PGMC │ Evoke PGMB │ │
│ │
& │ │
│ │
& │ │ │
│ │ └───┬──────────┴──────────┬───┘ │
│ └────────────────┼─┘ │
│ └────────────────┼─┘ │ │
│ │
│
│
│
│
│
│
│
│
│ │
│ │
│
│
│
│
│
│
│
│
│ │
│ │ ┌───┼─────────────────────┼───┐ │
│ ┌────────────────┼─┐ │
│ ┌────────────────┼─┐ │ │
│ │ │
6
ICF
6
│ │
│ │
ICF
│ │ │
│ │
ICF
│ │ │ │
│ │ │
Data
│ │
│ │
Data
│ │
│ │
Data
│ │ │
│ │ │
│
Management
│
│ │
│ │
Management & │ │
│ │
Management & │ │ │
│ │ └───┼─────────────────────┼───┘ │
│ └────────────────┼─┘ │
│ └────────────────┼─┘ │ │
│ │
│
│
│
│
│
│
│
│
│ │
│ │
│
│
│
│
│
│
│
│
│ │
│ │ ┌───┼─────────────────────┼───┐ │
│ ┌────────────────┼─┐ │
│ ┌────────────────┼─┐ │ │
│ │ │
│
Intrasystem
│
│ │
│ │
Intrasystem │ │ │
│ │
Intrasystem │ │ │ │
│ │ │
│
Communications │
│ │
│ │ Communications│ │ │
│ │ Communications│ │ │ │
│ │ │
6
Support
6
│ │
│ │
Support
│ │ │
│ │
Support
│ │ │ │
│ │ │
'
'
│ │
│ │
' │ │
│ │
' │ │ │
│ │ └───'─────────────────────'───┘ │
│ └────────────────'─┘ │
│ └────────────────'─┘ │ │
│ └─────'─────────────────────'─────┘
└──────────────────'───┘
└──────────────────'───┘ │
│
'
'''''''''''''''''''''''''''''''
'
│
│
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
│
└─────────────────────────────────────────────────────────────────────────────────────────────┘
Figure 1-2. A Source Program Communicating with Multiple Target Programs
Using Intrasystem Communications to
Test Communications Applications
Intrasystem communications can be used to test new communications programs to be run using other communications
types. Using intrasystem communications can help you
debug the programs before they are used to communicate
with a remote system over a communications line.
During testing, you can check only those return codes
returned by intrasystem communications and issue only
those operations supported by intrasystem communications.
1-2
Intrasystem Communications Programming V4R1
It is also important to note that there are differences in the
way intrasystem communications supports certain read and
write operations and the way other communications types
support such operations. For example, intrasystem communications implicitly responds to a confirm request in the
AS/400 system environment, whereas advanced program-toprogram communications (APPC) does not. For further
details about using intrasystem communications to test other
communications types, refer to Appendix C.
Chapter 2. Configuring Intrasystem Communications
This chapter describes the commands used for configuring
intrasystem communications on your system.
When using intrasystem communications configuration commands, you can enter the commands in one of two ways:
Ÿ Using the command prompt. Enter the command and
press F4 (Prompt). A prompt menu is shown for the
command.
Ÿ Using direct entry. Enter the command and its parameters following the syntax described in the CL Reference
book.
In this chapter, the parameters of the CL commands that
apply to intrasystem communications are described.
Defining the Intrasystem Communications
Configuration
A configuration for intrasystem communications consists of
an intrasystem communications device description. The
device description describes the characteristics of the logical
connection between the two programs. Because programs
are communicating with each other on the same system, line
and controller descriptions are not supported. To use the
intrasystem communications device, it must first be configured and varied on. You can create or change an intrasystem communications device description using the
following commands:
Ÿ Create Device Description (Intrasystem) (CRTDEVINTR)
command
Ÿ Change Device Description (Intrasystem)
(CHGDEVINTR) command
The parameters for the CRTDEVINTR and CHGDEVINTR
commands are:
AUT
Specifies the authority you are granting users who do
not have specific authority to the object, are not on the
authorization list, or whose group has no specific
authority to the object.
*LIBCRTAUT: The system determines the authority for
the object by using the value specified on the CRTAUT
parameter on the CRTLIB command for the library containing the object to be created. If the value specified on
the CRTAUT parameter is changed, the new value will
not affect any existing objects. This is the default value.
*CHANGE: Change authority allows the user to perform
all operations on the object except those limited to the
owner or controlled by object existence authority and
object management authority. The user can change the
object and perform basic functions on the object.
Change authority provides object operational authority
and all data authority.
*ALL: All authority allows the user to perform all operations on the object except those limited to the owner or
controlled by authorization list management authority.
The user can control the object’s existence, specify the
security for the object, change the object, and perform
basic functions on the object. The user cannot transfer
ownership of the object.
*USE: Use authority allows the user to perform basic
operations on the object, such as displaying the object.
The user is prevented from changing the object. Use
authority provides object operational authority and read
authority.
*EXCLUDE: Exclude authority prevents other users
from accessing the object.
TEXT
Specifies text that briefly describes the object.
*BLANK: No text is specified. This is the default value.
DEVD
Specifies the name for the device description.
RMTLOCNAME
Specifies the remote location name with which your
program communicates. This parameter cannot be
specified on the CHGDEVINTR command.
ONLINE
Specifies if this device should be automatically varied on
during an initial program load (IPL).
*YES: This device is varied on automatically at IPL.
*NO: This device is not varied on automatically at IPL.
This is the default value.
 Copyright IBM Corp. 1997
'description': Specify no more than 50 characters,
enclosed in apostrophes, provided you do not use the
prompt screen.
Example
CRTDEVINTR DEVD(INTRALOC)
RMTLOCNAME(INTRARMT)
ONLINE(\YES) AUT(\CHANGE)
TEXT('This is an intrasystem
device description')
This command creates a device named INTRALOC and a
remote location name INTRARMT, allowing two programs to
communicate within the same system.
2-1
2-2
Intrasystem Communications Programming V4R1
Chapter 3. Running Intrasystem Communications Support
This chapter contains the information you need to run the
intrasystem communications support.
Vary On and Vary Off Support
Once an intrasystem communications device has been configured, you can use the Vary Configuration (VRYCFG)
command to activate and deactivate the device configuration.
This can also be done from the WRKCFGSTS display.
Use the VRYCFG command and specify CFGTYPE(*DEV)
and STATUS(*ON) to vary on the configured device
description.
Use the VRYCFG command and specify CFGTYPE(*DEV)
and STATUS(*OFF) to vary off the configured device
description.
The following parameters are applicable to intrasystem communications:
CFGOBJ
Specifies the name of the description for the device to
be varied on or off.
CFGTYPE
Specifies the type of configuration description to be
varied on or off. This is a required parameter. The only
valid entry for intrasystem communications is:
*DEV: Device configuration
STATUS
Specifies the status of the configuration object.
*ON: The object is varied on.
*OFF: The object is varied off.
RANGE
Specifies what configuration elements should be varied,
either the configuration element specified (*OBJ) or the
configuration element specified and its attached config-
 Copyright IBM Corp. 1997
uration elements (*NET). Devices are considered not to
have attached configuration elements. For devices, you
can specify either RANGE(*OBJ) or RANGE(*NET).
VRYWAIT
Specifies whether the Ethernet, token-ring, X.25, or
switched SDLC, BSC, or asynchronous line description
is varied on asynchronously or synchronously. Specify
how long the system waits for vary on to be completed
(for synchronous vary on) after which the communications file is opened and the session is acquired.
If the VRYWAIT parameter is specified on the VRYCFG
command for a line description that is not Ethernet,
token-ring, X.25, or switched SDLC, BSC, or asynchronous, the parameter is accepted but ignored.
*CFGOBJ: The VRYWAIT parameter value specified in
the line description is used.
*NOWAIT: The system does not wait for vary on completion. The line is varied on asynchronously.
vary-on-wait: Specify a value ranging from 15 through
180 seconds in 1-second intervals. The system waits
until either the line is varied on or the timer expires
before completing the VRYCFG command.
ASCVRYOFF
Specifies whether the vary off is asynchronous. This
parameter is not allowed when STATUS(*ON) is specified.
*NO: The vary off is synchronous.
*YES: The vary off is asynchronous.
Example
VRYCFG CFGOBJ(INTRALOC) CFGTYPE(\DEV)
STATUS(\ON) RANGE(\OBJ)
This command varies on the configured device description
INTRALOC.
3-1
3-2
Intrasystem Communications Programming V4R1
Chapter 4. Writing Intrasystem Application Programs
CRTICFF
Create ICF File. This command allows you
to create an ICF file and file level attributes.
CHGICFF
Change ICF File. This command allows
you to change the file attributes of the ICF
file.
OVRICFF
Override ICF File. This command allows
you to temporarily change the file attributes
of the ICF file at run time. These changes
are only in effect for the duration of the job
and do not affect other users of the file.
DLTF
Delete File. This command allows you to
delete a file from the system.
DSPFD
Display File Description. This command
displays the file description of any file on
the system. The information may be
printed or displayed.
DSPFFD
Display File Field Description. This
command displays the description of the
fields in any file on the system. This information may be printed or displayed.
ADDICFDEVE
Add ICF Device Entry. This command
allows you to permanently add a program
device entry that contains a program device
name, remote location information, and
session-level attributes to an ICF file.
CHGICFDEVE
Change ICF Device Entry. This command
allows you to permanently change the
program device attributes previously added
with the ADDICFDEVE command.
An intersystem communications function (ICF) file must be
created before your application can use the intrasystem communications support. The ICF file is used to describe how
data is presented to the program with which your program is
communicating, and how data is received from that program.
If you are using DDS keywords, use the Create Intersystem
Communications Function File (CRTICFF) command to
create an ICF file. If you are using the system-supplied
formats (such as $$SEND), you do not need to create an
ICF file. The ICF file QICDMF, which is in the library QSYS,
is supplied by IBM for communications.
OVRICFDEVE
Override ICF Device Entry. This command
allows you to do the following:
The ICF file is a system object of type *FILE with a specific
user interface. This interface is made up of a set of commands and operations. The commands allow you to manage
the attributes of the file and the operations allow a program
to use the file. Commands allow you to create, delete,
change, and display the file description.
RMVICFDEVE
This chapter describes how an application program uses the
intersystem communications function (ICF) file and the intrasystem communications support. The program can be coded
using the ILE C/400, C Set ++, ILE COBOL/400, or ILE
RPG/400 programming languages, which allows the program
to do the following functions:
Ÿ Start a session by opening an ICF file and acquiring a
program device.
Ÿ Send and receive information by writing or reading to an
ICF file.
Ÿ End a session by releasing the program device and
closing the ICF file.
This chapter also includes a description of the read and write
operations that specify a record format containing specific
communications functions. Record formats can be defined
using data description specifications (DDS), or you may use
system-supplied formats.
After an operation is completed, a return code (and a highlevel language file status) is returned to your application.
The return code indicates whether the operation was completed successfully or unsuccessfully. Along with the return
code, exception messages may also be issued. Refer to
Appendix B for more information about return codes and to
the appropriate language reference books for more information about the high-level language file status.
Intersystem Communications Function File
Ÿ Temporarily add the program device
entry, the remote location information,
and the session-level attributes to the
ICF file.
Ÿ Temporarily change a program device
entry with the specified remote location
information and session-level attributes
for an ICF file. These changes are
only in effect for the job.
Remove ICF Device Entry. This command
allows you to permanently remove the
program device entry previously added to
an ICF file with the ADDICFDEVE
command or changed with the
CHGICFDEVE command.
The following commands are used to manage the ICF file,
and are described in detail in the ICF Programming book.
 Copyright IBM Corp. 1997
4-1
Specifying the Program Device Entry
Commands
The following describes the parameters for the
ADDICFDEVE, CHGICFDEVE, and OVRICFDEVE commands and lists the valid values for each parameter for intrasystem communications.
FILE
Specifies the name and library of the ICF file to which
you are adding or changing the program device entry.
The FILE parameter is not available on the
OVRICFDEVE command.
*LIBL: Intrasystem communications support uses the
library list to locate the ICF file.
*CURLIB: Intrasystem communications support uses
the current library for the job to locate the ICF file. If no
current library entry exists in the library list, intrasystem
communications uses QGPL.
filename: A 1- to 10-character value that specifies the
name of the ICF file.
library-name: A 1- to 10-character value that specifies
the library where the ICF file is located.
PGMDEV
Specifies the program device name that is defined in the
ICF file and specified in the application. The total
number of devices that can be acquired to an ICF file is
determined by the MAXPGMDEV parameter on the
CRTICFF or CHGICFF command.
pgm-device-name: Enter a 1- to 10- character value for
the program device name being defined. This name is
used on device-specific input and output operations to
identify the program device and the attributes.
RMTLOCNAME
Specifies the remote location name with which your
program communicates. A remote location name must
be specified on the ADDICFDEVE command or an
OVRICFDEVE command. If a remote location name is
not specified, a major and minor error code are returned
when the program device is acquired.
*REQUESTER: The name used to refer to the communications device through which the program was started.
The session that is assigned when the program device is
acquired is the same session that receives the program
start request. If the program is not started as a result of
a program start request, the acquire operation for the
program device fails. The target program always uses
*REQUESTER as the remote location name in the ICF
file to connect to the session that the source program
uses to send the program start request.
remote-location-name: Enter a 1- to 8-character name
for the remote location name that should be associated
with the program device.
4-2
Intrasystem Communications Programming V4R1
FMTSLT
Specifies the type of record format selection used for
input operations for all devices.
*PGM: The program determines what record formats
are selected. If an input (read) operation with a record
format name is specified, that format is always selected.
If an input operation without a record format is specified,
the default format (the first record format in the file) is
always selected. This also means that if any record
identification (RECID) keywords are specified in the data
description specifications (DDS) for the file, they are not
taken into consideration when the record is selected.
*RECID: The RECID keywords specified in DDS for the
file are used to specify record selection. If no RECID
keywords are specified in the file, an error message is
sent and an acquire operation for the program device
will fail.
*RMTFMT: The remote format names received from the
sending program are used to select the record format.
CMNTYPE
Identifies the communications type for which you define
a program device entry. You should specify the value
*INTRA or *ALL for this parameter.
*INTRA: The prompt for all intrasystem
communications-supported attributes.
Note: When you specify *REQUESTER for the remote
location name (RMTLOCNAME), you are only prompted
for the attributes of the Format Select parameter
(FMTSLT) and the Secure from Override parameter
(SECURE).
BATCH
Specifies if batch processing is performed for the
session. If you specify RMTLOCNAME(*REQUESTER),
this parameter is ignored. The program that issues the
evoke function determines whether batch processing can
occur.
*NO: Specifies that batch processing does not occur.
*YES: Specifies that batch processing occurs.
Note: Function-management-header, cancel, and
negative-response functions are only valid if
BATCH(*YES) is specified.
SECURE
The SECURE parameter is valid only on the
OVRICFDEVE command. This parameter does not
apply to the ADDICFDEVE or CHGICFDEVE commands. This parameter is used to restrict the effects of
override processing.
*NO: Specifies no protection from other program device
overrides.
*YES: Specifies program device override protection
from override commands started in earlier programs.
Communications Operations
Evoke Function
This section provides a description of the operations you can
code into a program that uses intrasystem communications
support to communicate with another program.
Your program uses the evoke function to start a transaction
with a target program after you start a session. It is not valid
if your program is already communicating with another
program on the same session.
Starting a Session
A communications session is a logical connection by which a
program running in one job can communicate with another
program running in a different job. A communications
session is established with an acquire operation, and is
ended with a release operation or end-of-session function.
Open/Acquire Operation
Your application program uses the acquire operation to
establish the session on which your program will communicate with another program. Intrasystem communications
uses the value of each parameter that was specified on the
ADDICFDEVE or OVRICFDEVE command for the program
device.
The parameters are used to determine the following session
characteristics:
Format selection option: This indicates the type of processing that needs to be done to determine what record
format to use on an input operation. Intrasystem communications supports all three format selection options: *PGM,
*RECID, and *RMTFMT.
Batch option: This indicates whether or not batch processing is performed for the session. The following functions
are only valid if BATCH(*YES) is specified on the
ADDICFDEVE or OVRICFDEVE command:
Ÿ Function-management-header function
Ÿ Cancel function
Ÿ Negative-response function
Starting a Transaction
A transaction is a logical connection between two programs.
Use an evoke function to start a transaction between your
program and another program.
1
The program that issues an evoke function (the source
program) is initially in send state unless, for example, it also
issues a read operation, an allow-write function, or an invite
function to the other program. The source program would
then be in receive state and the other program can send
data.
The program with which the source program communicates
(the target program) is initially in receive state, and should
issue read operations until a receive-turnaround indication is
received.
The program that is in send state controls the transaction,
and determines what the other program must do. For
example, if a program that is in send state sends data, then
the program in receive state should issue a read operation to
receive the data (it cannot also send data).
With the evoke function your program can specify the following information:
Ÿ The name of the program with which your program is to
communicate
Ÿ The library in which the other program exists (optional)
Ÿ User-defined program initialization parameters (optional)
Ÿ Synchronization level (optional)
Ÿ Security information (optional)
If your program is using the EVOKE DDS keyword, you can
specify all of the above information. If your program is using
one of the evoke system-supplied formats, you can specify
all of the above except for synchronization level. In this
case, synchronization or confirmation is not allowed.
If you specify program initialization parameters (PIP)1 with
the evoke function, each parameter that is sent should be
equal in length to the corresponding parameter specified in
the target program. If it is longer than the parameter length
in the target program, truncation occurs. If it is shorter than
the parameter length in the target program, results that are
not predictable may occur.
For information on how to code the evoke function, refer to
the ICF Programming book and the DDS Reference book.
The program initialization parameter (PIP) is the initial parameter value passed to a target program as input or used to set up the process
environment.
Chapter 4. Writing Intrasystem Application Programs
4-3
Sending Data
Subdevice Selection Function
You can send data during a transaction using the write operation. With the write operation, you can, for example, specify
the end of a group of records, or indicate when your program
has finished sending data.
Your program uses the subdevice selection function to
specify to the other program the device to which the output is
to be directed. Intrasystem communications sends the
subdevice code as a separate record before sending the
data.
Write Operation
Note: The subdevice function is ignored on any write operation except for the first operation in a group.
The write operation is used to send data records to another
program. Each write operation sends only one data record.
Intrasystem communications supports various functions that
are discussed following this description. These functions
may be issued by your program to another program either
with or without data. The only exception is the functionmanagement-header function, which requires data to be sent.
Only one write operation can be issued at a time. Therefore,
if your program issues a second write operation while the
first one has not been received by the other program, the
second write operation will not complete until the data previously sent is read by the other program.
Force-Data Function
Your program uses the force-data function to send communications data currently held in the output buffer. However,
because intrasystem communications does not buffer data,
the force-data function does not provide any additional function.
Confirm Function
Your program uses the confirm function to indicate to the
other program that a response is needed before an operation
can complete. Once a confirm function is issued, control
does not return to your program until the other program with
which you are communicating responds to the confirm.
Note: The confirm function is allowed only if the transaction
was started with a synchronization level of confirm on the
evoke function.
Format-Name Function
Your program uses the format-name function to send the
record format name, along with data, to the other program.
This is the record format name that should be used by the
other program on the corresponding read operation.
Note: The value *RMTFMT for the FMTSLT parameter
needs to be specified by the other program on the
ADDICFDEVE or OVRICFDEVE command for the record
format name to be used.
4-4
Intrasystem Communications Programming V4R1
End-of-Group Function
Your program uses the end-of-group function to indicate to
the other program that this is the last record in a group. It
does not indicate, however, that your program is ready to
receive data. The session remains in a send state.
Function-Management-Header Function
Your program uses the function-management-header function
to indicate to the other program that function-managementheader data is being sent. Function-management-header
data contains control information for the data that is to follow,
and is only valid under the following conditions:
Ÿ If the program is running in batch mode (BATCH(*YES)
was specified on the ADDICFDEVE or OVRICFDEVE
command)
Ÿ If data is being sent (the data length is greater than
zero)
Intrasystem communications inserts the characters FMH
before the data being sent.
Receiving Data
Intrasystem communications supports various functions
designed to obtain data from the other program.
Read Operation
Your application program uses the read operation to obtain
data or control information from the other program. This
operation causes the user to wait for the data if it is not
immediately available. You can use the read operation by
itself or in combination with other write operations, in which
case the write operation is performed first, followed by the
read operation.
Invite Function
Your application program uses the invite function to request
input data from another program, but it receives control
without waiting for the input. To obtain the data, you must
issue either a read or a read-from-invited-program-devices
operation. This function can be issued by itself or in combination with other write operations.
Read-from-Invited-Program-Devices
Operation
You can use the read-from-invited-program-devices operation
to obtain data from any program that has responded to an
invite function previously issued in your program. If data
becomes available to your program from more than one
program device before the read-from-invited-program-devices
operation is issued, your program receives the data that was
first made available.
Waiting for a Display File, an ICF File, and
a Data Queue
Use data queues when a program must wait for a display
file, an ICF file, and a data queue, in any combination, at the
same time. The following commands are used with the
specified DTAQ parameter:
Ÿ
Ÿ
Ÿ
Ÿ
Ÿ
Ÿ
Create Display File (CRTDSPF)
Change Display File (CHGDSPF)
Override Display File (OVRDSPF)
Create ICF File (CRTICFF)
Change ICF File (CHGICFF)
Override ICF File (OVRICFF)
Use these commands to indicate a data queue that will have
entries placed in it when one of the following occurs:
Ÿ An enabled command key or Enter key is pressed from
an invited display device
Ÿ Data becomes available when the session is invited for
an ICF device
Ÿ A user-defined entry is made to a data queue by a job
running on the system
For more information, see the CL Programming book and the
ICF Programming book.
Notifying the Remote Program of
Problems
Your program uses the fail, cancel, and negative-response
functions to indicate that an error has occurred during a
transaction with the target program.
Fail Function
Your program issues the fail function to indicate that it has
detected an error in the data while it was sending or
receiving data. The fail function can be sent in either send
or receive state. No data can be sent with the fail function.
If a program that is in the send state issues a fail function,
either the data just sent was in error or some other condition
occurred. Intrasystem communications support informs the
other program of the error by returning a 0302 return code.
The last record before the fail function was issued is still sent
to the other program.
If a program is in the receive state and issues a fail function,
intrasystem communications support discards the incoming
data, informs the other program that a fail is being sent by
returning a 0402 return code, and changes the state of your
program’s session from receive to send state.
In either case, the program that issued a fail function should
send, and the program that received the fail must receive.
If both programs issue a fail function at the same time, the
program that was receiving will be successful and should
send. The program that was sending receives a fail return
code.
Cancel Function
Your application program can issue a cancel function to indicate that it detected an error in the data it was sending. The
cancel function is only valid under the following conditions:
Ÿ If your program is running in batch mode (BATCH(*YES)
was specified on the ADDICFDEVE or OVRICFDEVE
command)
Ÿ Within a group of records
Ÿ When the program is in send state
When your program is sending data and issues a cancel
function, intrasystem communications support informs the
other program that a cancel is being sent. No data may be
sent with a cancel operation.
The program that issues a cancel function should send, and
the program that receives the cancel must receive.
Issuing a cancel function is similar to issuing a fail function
when your program is sending data.
Negative-Response Function
Your application program can use a negative-response function to indicate that it detected an error in the data it was
receiving. The negative-response function is only valid under
the following conditions:
Ÿ If your program is running in batch mode (BATCH(*YES)
was specified on the ADDICFDEVE or OVRICFDEVE
command)
Ÿ Within a group of records, or as the first function after
receiving an end-of-group function
Ÿ When the program is in receive state, but an invite function has not yet been issued or is currently not in effect
When your program issues a negative-response function,
intrasystem communications support discards any data being
received, and informs the other program that a negativeresponse is being sent.
Chapter 4. Writing Intrasystem Application Programs
4-5
Your program can also send eight bytes of sense data with
the negative-response function to inform the other program
about the reason for the error. Intrasystem communications
checks this data to ensure that the first four bytes are 10xx,
08xx, or 0000, where x is a digit. If not, the function is
rejected, with a return code of 831B. If your program does
not supply sense data, then intrasystem communications
sends the code 08110000.
Issuing a negative-response function is similar to issuing a
fail function when your program is receiving data.
Using Additional Functions/Operations
Intrasystem communications supports the following additional
functions or operations.
Respond-to-Confirm Function
Your program uses the respond-to-confirm function to send a
positive response to a received confirm request. The positive response indicates that data was received without error
or that the request received may be performed (such as a
detach).
You can issue the respond-to-confirm function only after
receiving a confirm request from the other program.
A respond-to-confirm function is not required, however, and
an implicit positive response is sent if the next operation is
not a fail, cancel, negative-response, or end-of-session function.
Request-to-Write Function
Your program uses the request-to-write function to indicate
that it wants to send something to the other program rather
than continue receiving data. The other program decides,
however, whether to stop sending data and when it will stop.
After issuing a request-to-write function, your program must
continue to receive data until it receives a return code that
indicates the other program is ready to begin receiving (if it
decides to do so). Your program, in response to the return
code, can then begin to send its data, perform other processing, or end.
Your program can issue the request-to-write function only
when no invite function is in effect, and only when your
program is in the receive state.
Allow-Write Function
Your program issues the allow-write function to inform the
program with which it is communicating that it is finished
sending data and is ready to receive.
Intrasystem communications sends data and an indication to
the other program that allow-write is being sent. If the opera-
4-6
Intrasystem Communications Programming V4R1
tion is successful, a return code of 0001 is returned to indicate that your program is ready to receive data.
Cancel-Invite Function
Your program uses the cancel-invite function to attempt to
cancel an outstanding invite function for which no data has
been received. Cancel-invite is only valid when an invite
function is still in effect.
When your program issues a cancel-invite function, intrasystem communications determines if data has been
received from the other program. If no data has been
received, the invite is canceled, and your program is
changed from an invite state to send state.
If data has already been received from the other program,
the invite is not canceled, and a return code of 0412 is
returned. Your program must then issue a read or readfrom-invited-program-devices operation to receive the data
that the other program has already sent.
Timer Function
Your program can use the timer function to set the maximum
amount of time your program waits to receive data when
issuing the read-from-invited-program-devices operation.
Get-Attributes Operation
Your program uses the get-attributes operation to determine
the status of the session. It can be issued at any time during
a session. The operation gets the current status information
about the session to which your program is communicating.
Ending Transactions
The detach function is used to end an active transaction
between your program and the program with which it is communicating.
Detach Function
Your program uses the detach function to inform the other
program that your program is finished sending data and
wants to end the transaction.
Intrasystem communications sends the data and indicates to
the other program that the current record is the last record.
When a detach function is issued with a confirm function, the
transaction is ended by your program if a positive response
is received, and no further input or output operations with the
other program is allowed. When a detach function is issued
without a confirm function, the transaction ends without
waiting for a response from the other program. When the
target program receives the detach, it can no longer communicate with the source program and must end the logical con-
nection to the session by ending the session. A source
program must issue an evoke function to establish communications again with a target program after sending or
receiving a detach function.
When a detach function is issued by a target program, its
logical connection to the session, as well as to the transaction, is ended.
Ending Sessions
The following function and operations can be used by your
program to end a session.
Release Operation
Your program uses the release operation to attempt to end
the program’s attachment to a session. Depending on how
the session was started, the release operation produces different results:
Ÿ If the session is associated with the source program, the
release operation ends the session immediately (unless
some error condition occurs). The operation frees the
resources (allocated to the program) used during the
session. If the release operation is not successful, the
end-of-session function can be issued to end the
session. The release operation is only valid when a
transaction is not active.
Ÿ If the session is associated with the target program, the
release operation only temporarily ends the connection
to the source program. The session is kept active, and
is not available for use by other programs until the target
program issues an end-of-session function or ends. If a
detach has not been done (that is, the transaction is still
active), an acquire can be issued to continue communications on that session.
End-of-Session Function
Your program uses the end-of-session function to end a
session with another program. Unlike the release operation,
the end-of-session function always ends the session.
However, if the function is issued during an active transaction, intrasystem communications abnormally ends the
session.
When your program issues an end-of-session function, intrasystem communications ends the program’s attachment to
the session and frees the resources in the AS/400 system
used during the session. The resources are made available
to other programs in the AS/400 system that want to establish a session.
2
Close Operation
Your program uses the close operation to close the ICF file
and to end the program’s attachment to any active session
the program has acquired. If the close operation is issued to
a session that was established by a source program, intrasystem communications ends the session and deallocates all
resources that were allocated for the file. If a transaction is
active when the close operation is issued, both the session
and the transaction are abnormally ended.
If the close operation is issued to a session associated with a
target program, the connection to the program is only temporarily ended. The session is kept active and is not available
for use by other programs until the target program issues an
end-of-session function or ends.
Using Response Indicators
Response indicators2 are defined to your program in the
ICF file and are set on each input operation. However, these
indicators are optional and major and minor return codes can
also be used to indicate the status of input operations.
Receive-Confirm
Your program uses the receive-confirm response indicator to
receive an indication from the other program that the record
it received contained a confirm request. A received confirm
request indicates the other program is expecting your
program to perform a specific action to synchronize the programs. This action can be a respond-to-confirm function to
respond positively or a fail or end-of-session function to
respond negatively. Your program can also do a normal
input/output operation to respond positively.
The presence of the confirm request is also indicated by the
minor return codes 14, 15, 17, 1C, 44, 45, and 47 with the
major return code 00 (user data received) or 02 (user data
received but program is being ended), or by the minor return
codes 14, 15, 17, and 1C with the major return code 03 (no
data received).
Receive-End-of-Group
The receive-end-of-group response indicator is used to indicate that the other program has sent the last record in a
group.
The presence of the end-of-group function is also indicated
by the minor return codes 03, 07, 17, and 47 with the major
return code 00 (user data received) or 02 (user data received
A response indicator is a 1-character field passed with an input record from the system to a program to provide information about the data
record.
Chapter 4. Writing Intrasystem Application Programs
4-7
but program is being ended), or by the minor return codes 03
and 17 with the major return code 03 (no data received).
Receive-Function-Management-Header
Your program uses the receive-function-management-header
response indicator to receive an indication from the other
program that function-management-header data was
received. The first three characters of the received data are
the characters FMH.
The presence of function-management-header data is also
indicated by the minor return codes 04, 05, 07, 44, 45, and
47 with the major return code 00 (user data received) or 02
(user data received but program is being ended).
Receive-Fail
Your program uses the receive-fail response indicator to
receive an indication that the other program encountered an
error when it was sending or receiving data, and your
program should take the appropriate recovery action. Your
program remains in receive state after receiving the receivefail indicator and should continue to issue read operations.
Receipt of a fail request is also indicated by the minor return
code 02 with the major return code 03 (no data received) or
04 (output exception occurred).
The failure notification is always received without user data.
Receive-Cancel
Your program uses the receive-cancel response indicator to
receive an indication that the other program encountered an
error when it was sending data.
Receipt of a cancel request is also indicated by the minor
return codes 30 and 31 with the major return code 83.
The cancel notification is always received without user data.
Receive-Negative-Response
Your program uses the receive-negative-response response
indicator to receive an indication that the other program
encountered an error when it was receiving data.
Receive-Turnaround
Your program uses the receive-turnaround response indicator
to receive an indication from the other program indicating
that it is ready to receive data.
The presence of the turnaround indication is also indicated
by the minor return codes 00, 04, 14, and 44 with the major
return code 00 (user data received) or 02 (user data received
but program is being ended), or by the minor return codes 00
and 14 with the major return code 03 (no data received).
Receive-Detach
Your program uses the receive-detach response indicator to
receive an indication when the received data ends a transaction (the detach request has been received).
The presence of the detach request is also indicated by the
minor codes 08 (detach only) and 1C (detach and confirm
request) with the major return codes 00 (user data received),
02 (user data received but program is being ended), or 03
(no data received).
Using the Input/Output Feedback Area
Your program may have access to the file-dependent
input/output (I/O) feedback area. If it does, you should be
aware of certain fields when writing applications using intrasystem communications:
Actual received data length
This field contains the length of the data received on
an input operation.
Major return code
This field contains the major return code indicating
the status of input and output operations.
Minor return code
This field contains the minor return code indicating
the status of input and output operations.
Request-to-write indicator
This field indicates whether the other program has
requested permission to send data.
Format name
This field contains the record format name used to
receive the data on an input operation.
Your program must issue an input operation to receive the
eight character sense code that the other program (or intrasystem) sends with the negative-response indication.
Using Return Codes
Receipt of a negative-response function is also indicated by
the 8319 return code. Refer to Appendix B for a description
of the return code.
After each operation, an ICF return code is returned to your
program. Your program should check this return code to
determine:
Ÿ The status of the operation just completed
Ÿ The operation that should be issued next
4-8
Intrasystem Communications Programming V4R1
Example: On an input operation, a major return code of 00
indicates that data was received. Along with this major code,
intrasystem communications could return one of these minor
codes:
Ÿ 01: Indicates that your program should continue
receiving data.
Ÿ 08: Indicates the other program has ended the transaction. Your program can do one of the following:
– If it is a source program, issue another evoke function or end the session.
– If it is the target program, end the session or go to
end of job.
Ÿ 1C: Indicates the program with which your program is
communicating wants to end the transaction and
requested confirmation. Your program must first
respond either positively or negatively to the confirmation
request. If your program responds positively, it should
continue as for the 08 minor code. If it responds negatively, it should then inform the other program why it
responded negatively or it can go to end of job without
performing error recovery. In any case, if your program
responds negatively, it is responsible for the appropriate
error recovery.
Example, Error Condition: Another example would be a
major code of 83. In this case, an error was detected that
may be recoverable. Different minor codes can be returned,
just as for the 00 major. For example, if your program
receives a CD minor return code, your program has issued a
confirm function that is currently not allowed. Your program
is using a transaction that was not started with a synchronization level of confirm. For this return code, your program is
responsible for the necessary error recovery. The session
and transaction are still active and you can recover from this
error by issuing the operation without the confirm function.
It is recommended that your program check the ICF return
codes at the completion of every operation to ensure that the
operation completed successfully or that the appropriate
recovery action can be taken.
Refer to Appendix B for a description of the return codes
that can be returned to your application when it is using intrasystem communications.
Chapter 4. Writing Intrasystem Application Programs
4-9
4-10
Intrasystem Communications Programming V4R1
Chapter 5. Considerations for Intrasystem Communications
This chapter describes the application and performance considerations for intrasystem communications.
Application Considerations
Before writing programs that use intrasystem communications, you must understand some of the characteristics of the
AS/400 environment.
Ÿ To increase performance, two communicating programs
can change states implicitly without using the turnaround
indication by synchronizing their input and output operations. For example, if Program A is sending data and
issues a read operation to Program B, which is receiving
data, Program B can issue a write operation without
having received a turnaround indication. Program A is
then ready to receive data and Program B can send
data.
General Considerations
Open/Acquire Considerations
These general considerations apply to your program and the
program with which it is communicating.
The following information describes how the acquire operation is used to start a session between the source program
(Program A) and the program with which it is communicating
(Program B).
Ÿ The first operation following the acquire operation by a
source program should be a write operation with an
evoke function specified. The evoke function starts the
program with which the source program is going to communicate.
Ÿ The source program can send program initialization
parameters, with the evoke function, to the other
program only if the other program supports the receipt of
these parameters.
Ÿ Target programs on the AS/400 system establish a connection to the session and transaction (started by the
source program) by issuing an acquire operation to the
program device associated with the remote location
name *REQUESTER (requesting program device).
Ÿ When a program is in receive state, it can issue a read
operation, an invite function, or a request-to-write function. A write operation issued with a fail function can
also be used if your program is to send an error condition to the other program.
Ÿ When a program is in send state, all operations except
open (to the opened ICF file), acquire (to the same
program device), negative-response, and the request-towrite function are generally valid.
Ÿ When a program is receiving data, it should continue to
issue input operations until one of the following is
received:
– A minor return code indicating that your program
may now send data. The RCVTRNRND keyword
can also be used.
– A minor return code indicating that detach has been
received. The RCVDETACH keyword can also be
used.
– A major and minor return code indicating an error
condition, for example, any of the 80 major return
codes.
– Data that contains an error, in which case the
program should issue a negative-response or fail
function.
 Copyright IBM Corp. 1997
Ÿ If Program B acquires a program device, other than the
requesting program device, a new session is established
and the connection with the source program (Program A)
is not established. No error is indicated because it is
valid for Program B to be a target on one session and to
be a source program on another session. If the program
issues an input operation as the first operation to the
newly established session, and an evoke function has
not yet been issued, it will receive a return code indicating that no transaction is active.
Ÿ Multiple sessions (that run at the same time) can be
established with multiple programs. The program device
names are used to distinguish the sessions within your
program.
Input Considerations
The following information describes the input considerations
for your program.
Ÿ The receive indicators RCVTRNRND, RCVDETACH,
RCVENDGRP, and RCVCONFIRM can be received
either with data or without data (indicators only). Your
program should examine the major return codes in the
communications device-dependent feedback area to
determine if the record contains data. A major code of
00 or 02 indicates data has been received, and a major
code of 03 indicates no data has been received.
Ÿ The actual received data length can be determined from
the file-dependent I/O feedback area.
Ÿ When a write operation is issued following an invite, the
system performs an implicit cancel-invite function and
your program can begin sending data to the other
program, provided data was not waiting to be received.
Ÿ When a read operation is issued following a write, or following a read in which turnaround was received, the
system performs an implicit allow-write function and
begins waiting for data from the other program.
5-1
Confirm Considerations
The following information describes how the confirm function
is used by both your program and the other program with
which it is communicating.
Ÿ Your program requests that the other program confirm
receiving the data by issuing an output request with the
confirm function.
Ÿ Your program is notified that it has received a confirmation request from the other program in the following
ways:
– A major return code of 00 or 02, with the minor
return codes 14, 15, 17, 1C, 44, 45, or 47, or a
major return code of 03 with the minor return codes
14, 15, 17, or 1C.
– The RCVCONFIRM indicator is set.
Once your program has received a confirmation request,
it must either respond positively or negatively to the
request as follows:
– To respond positively, issue the respond-to-confirm
function, or issue any input/output operation except
the fail, negative-response, or end-of-session function.
– To respond negatively to the request, do the following:
- Issue a fail function. In this case, your program
is responsible for the appropriate level of error
recovery.
- Abnormally end the transaction and session by
issuing either an end-of-session function or a
close operation.
Ÿ When it is essential to your application program that the
other program be started before you issue output operations to it, specify the confirm function with the evoke
function. The evoke function will not complete until the
other program responds to the confirmation request.
Ÿ Because the output operation with the confirm function
specified waits for a positive or negative response before
control is returned to the program, the source and target
programs should be coded to minimize the amount of
time between receiving the confirm request and sending
the response. If the program receiving the confirm
request performs complex processing before sending a
response, the delay time can be significant.
Release, End-of-Session, and Close
Considerations
The following information describes how the close operation
and release and end-of-session functions are used to end
communications between your program and the program with
which it is communicating.
Ÿ The close operation and end-of-session function are
5-2
Intrasystem Communications Programming V4R1
valid in any state, but will abnormally end an active
transaction with the other program and could also indicate a logic error in the program.
Ÿ The target program cannot begin error recovery using
release, close, and open and acquire logic. When a permanent session error occurs, the source program is
responsible for recovery.
Ÿ A release operation performed by the target program
does not perform a detach function. The transaction
with the source program can be resumed by a subsequent acquire of the requesting program device. That
acquire can be performed either by the program that initially had the transaction or by another program running
in the same job.
Ÿ A transaction remains allocated to a target job until the
job ends even though a close or release operation was
issued and a detach sent. As long as the job is active,
the Work with Active Jobs (WRKACTJOB) command or
the Work Configuration Status (WRKCFGSTS) command
shows the job as an intrasystem communications target
program. You can use the end-of-session function to
end the session associated with a job. In this case, the
job no longer shows as active.
Performance Considerations
If your program issues more than one evoke function, poor
system performance may result. This is because each evoke
function that results in a successful transaction causes a job
to be started on the system. Because job initializations
require a fair amount of system resources, you should design
your application to minimize evoke functions.
In general, your program should issue multiple evoke functions only when jobs are long-running or when multiple target
jobs need to run at the same time. If you issue a large
number of evoke functions in your program, you can use prestart jobs, described on 5-2, to minimize the time required to
start a job.
Prestarting Jobs for Program Start
Requests
A program start request is a request made by your program
to start another program. When your program issues an
evoke function, this signals a program start request to the
intrasystem communications support.
To minimize the time required to carry out a program start
request, you can use the prestart jobs entry to start a job for
the other program before it receives the program start
request. To use prestart jobs, you need to define both communications and prestart job entries in the same subsystem
description, and make certain programming changes to the
prestart job program with which your program communicates.
For information about how to use prestart jobs, refer to the
ICF Programming book.
Appendix A. Language Operations, Data Description, Specifications
Keywords, and System-Supplied Formats
This appendix contains charts that show the following for
intrasystem communications:
Ÿ All valid language operations supported by ICF
Ÿ Valid operations for each programming language that
supports ICF
Ÿ Data description specifications (DDS) processing
keywords
Ÿ System-supplied formats
Language Operations
Figure A-1 describes the language operations supported by
ICF.
Figure A-1. Language Operations
ICF Operations
Description
Open
Opens the ICF file.
Acquire
Establishes a session.
Get attributes
Used to determine the status of the
session.
Read
Obtains data from a specific session.
Read-from-invitedprogram-devices
Obtains data from any session that has
responded to an invite function.
Write
Passes data records from the issuing
program to the other program in the
transaction.
Write/Read
Allows a write operation followed by a
read operation. Valid for ILE C/400, C
Set ++ for OS/400, and ILE RPG/400
only.
Release
Attempts to end a session.
Close
Closes the ICF file.
Figure A-2 shows all the valid operations for each programming language that supports ICF ( LE C/400, C Set ++ for
OS/400, ILE COBOL/400, and ILE RPG/400 programming
languages).
Figure A-2. Valid Operations for Programming Languages
ICF Operation
ILE RPG/400
Operation Code
ILE COBOL/400
Procedure Statement
ILE C/400 Function
Open
OPEN
OPEN
fopen, _Ropen
Acquire
ACQ
ACQUIRE
_Racquire
Get attributes
POST
ACCEPT
_Rdevatr
Read
READ
READ
fread, _Rreadn
Read-from- invitedprogram- devices
READ1
READ1
_Rreadindv
Write
WRITE
WRITE
fwrite, _Rwrite
Write/ Read
EXFMT
Not supported
_Rwriterd
Release
REL
DROP
_Rrelease
Close
CLOSE
CLOSE
fclose, _Rclose
1
A read operation can be directed either to a specific program device or to any invited program device. The support provided by the
compiler you are using determines whether to issue an ICF read or read-from-invited-program-devices operation, based on the format of the
read operation. For example, if a read is issued with a specific format or terminal specified, the read operation is interpreted as an ICF
read operation. Refer to the appropriate language reference book for more information.
 Copyright IBM Corp. 1997
A-1
Data Description Specifications Keywords
SECURITY
Security
SUBDEV
Subdevice
The following lists the data description specifications (DDS)
processing keywords that are valid for intrasystem communications.
SYNLVL
Synchronization level
TIMER
Timer
DDS Keyword
Description
VARLEN
Variable-length data
ALWWRT
Allow-write
CANCEL
Cancel
CNLINVITE
Cancel-invite
CONFIRM
Confirm
DETACH
Detach (End of transaction)
ENDGRP
End-of-group
EOS
End-of-session
EVOKE
Evoke
FAIL
Fail
FMH
Function-management-header
FMTNAME
Format-name
FRCDTA
Force-data
INVITE
Invite
NEGRSP
Negative-response
RCVCANCEL
Receive-cancel
RCVCONFIRM
Receive-confirm
RCVDETACH
Receive-detach
RCVENDGRP
Receive-end-of-group
RCVFAIL
Receive-fail
RCVFMH
Receive-function-management-header
RCVNEGRSP
Receive-negative-response
RCVTRNRND
Receive-turnaround
RECID
Record-identification
RQSWRT
Request-to-write
RSPCONFIRM
Respond-to-confirm
A-2
Intrasystem Communications Programming V4R1
System-Supplied Formats
The following lists all the keyword functions performed by the
system-supplied formats that are valid for intrasystem communications.
System-Supplied
*Formats
Description
$$CANL
Cancel with invite
$$CANLNI
Cancel
$$CNLINV
Cancel-invite
$$EOS
End-of-session
$$EVOK
Evoke with invite
$$EVOKET
Evoke with detach
$$EVOKNI
Evoke
$$FAIL
Fail
$$NRSP
Negative-response with invite
$$NRSPNI
Negative-response
$$RCD
Request-to-write with invite
$$SEND
Send with invite
$$SENDE
Send with end-of-group
$$SENDET
Send with detach
$$SENDFM
Send function-management-header
with invite
$$SENDNF
Send with function-managementheader
$$SENDNI
Send
$$TIMER
Timer
Appendix B. Return Codes, Messages, and Sense Codes
Return Codes
This section describes all the return codes that are valid for intrasystem communications.
These return codes are set in the I/O feedback area of the ICF file; they report the results of
each I/O operation issued by your application program. Your program should check the
return code and act accordingly. Refer to your high-level language book for more information on how to access these return codes.
Each return code is a four-digit hexadecimal value. The first two digits contain the major
code, and the last two digits contain the minor code.
With some return codes, a message is also sent to the job log or the system operator
message queue (QSYSOPR). You can refer to the message for additional information.
Notes:
1. In the return code descriptions, your program refers to the AS/400 application program
that issues the operation and receives a return code from ICF communications. The
other program refers to the application program with which your program is communicating through ICF.
2. Several references to input and output operations are made in the descriptions. These
operations can include DDS keywords and system-supplied formats, which are listed in
Appendix A.
Major Code 00
Major Code 00 – Operation completed successfully.
Description: The operation issued by your program
completed successfully.
Your program may have sent or received some data, or may have
received a message from the
system.
Action: Examine the minor return code
and continue with the next operation.
Code
Description/Action
0000
Description: For input operations issued by your program, 0000 indicates that
your program received some data with a turnaround indication. The other
program is ready to receive data.
For output operations issued by your program, 0000 indicates that the last
output operation completed successfully and that your program can continue to
send data.
Action: If your program received a turnaround on an input operation, issue an
input or output operation. For the actions which can be taken after 0000 is
received, refer to the following table:
 Copyright IBM Corp. 1997
B-1
Figure B-1. Actions for Return Code 0000
Type of Session
Last Operation Issued
Actions Your Program Can Take
Started by a source
program
Acquire or open
Issue an evoke or timer function, or a getattributes operation.
Issue another evoke function, issue a release
operation, continue local processing, or end.
Issue another output operation (except
evoke), or issue an input operation.
Continue local processing or end.
Issue an input or output operation.
Evoke with detach or
write with detach
Any other output operation
Started by a remote
program start
request1
End-of-Session
Acquire or open
Write with detach
Continue local processing or end. This
session has ended.
Any other output operation
Issue another output operation (except
evoke), or issue an input operation.
End-of-Session
Continue local processing or end.
1 A target program (started by a program start request) cannot issue an evoke function in this session;
it can issue an evoke function only in a different session that it has first acquired.
0001
Description: On a successful input operation, your program received some
data. Your program must continue to receive data until it receives a turnaround
indication (which allows your program to send data) or a detach indication.
Action: Issue another input operation. If your program detects a turnaround
indication, it can issue an output operation.
0003
Description: On a successful input operation, your program received some
data with an end-of-group indication.
Action: Issue an input operation to receive the next group of records.
0004
Description: On a successful input operation, your program received some
data with a function-management-header (FMH) and a turnaround indication.
The other program is ready to receive data.
Action: Issue an output operation.
0005
Description: On a successful input operation, your program received some
data with a function-management-header (FMH).
Action: Your program can issue another input operation to continue receiving
data until it receives a turnaround indication or a detach indication.
0007
Description: On a successful input operation, your program received a
function-management-header (FMH) and an end-of-group indication. Your
program should continue to receive data.
Action: Issue another input operation to receive the next group of records.
0008
Description: On a successful input operation, your program received a detach
indication with the last of the data. The communications transaction with the
other program has ended.
Action: If your program started the session, it can issue another evoke function (to start another program), issue a release operation (to perform local processing or to start another session), or end. If a program start request from the
other program started the transaction, your program can either issue an end-ofsession function or end.
0010
Description: On a successful output operation, your program received a
request-to-write indication. The other program wants to send data as soon as
possible. You should allow the other program to send this data.
Action: Issue an input operation as soon as possible.
0014
B-2
Description: On a successful input operation, your program received some
data with a turnaround indication. In addition, the other program requested
confirmation.
Intrasystem Communications Programming V4R1
Action: Process any data received with the request. If your program detects
no errors, respond to the confirm request with a respond-to-confirm
(RSPCONFIRM) function, then issue an input or output operation. If your
program does detect an error, issue a fail function, or end your program.
0015
Description: On a successful input operation, your program received some
data. In addition, the other program requested confirmation.
Action: Process any data received with the request. If your program detects
no errors, respond to the confirm request with a respond-to-confirm
(RSPCONFIRM) function, then issue an input operation. If your program does
detect an error, issue a fail function, or end your program.
0017
Description: On a successful input operation, your program received some
data with an end-of-group indication. In addition, the other program requested
confirmation.
Action: Process any data received with the request. If your program detects
no errors, respond to the confirm request with a respond-to-confirm
(RSPCONFIRM) function, then issue another input operation. If your program
does detect an error, issue a fail function, or end your program.
001C
Description: On a successful input operation, your program received some
data with a detach indication. In addition, the other program requested confirmation.
Action: If your program detects no errors, it should respond to the confirm
request with a respond-to-confirm (RSPCONFIRM) function, and then:
Ÿ If your program started the transaction, it can issue another evoke operation (to start another program), issue a release operation (to perform local
processing or to start another session), or end.
Ÿ If a program start request from the other program started the transaction,
your program can issue an end-of-session function or end.
If your program does detect an error, issue a fail operation. The transaction
remains active, and your program and the other program can perform the necessary error recovery. If your program detects an error and wants to end the
transaction abnormally, issue an end-of-session function, or end your program.
0044
Description: On a successful input operation, your program received some
data with a function-management-header (FMH) and a turnaround indication.
In addition, the other program requested confirmation.
Action: If your program detects no errors, respond to the confirm request with
a respond-to-confirm (RSPCONFIRM) function, then issue an output operation.
If your program does detect an error, issue a fail function, or end your program.
0045
Description: On a successful input operation, your program received some
data with a function-management-header (FMH). In addition, the other program
requested confirmation.
Action: If your program detects no errors, respond to the confirm request with
a respond-to-confirm (RSPCONFIRM) function, then issue an input operation.
If your program does detect an error, issue a fail function, or end your program.
0047
Description: On a successful input operation, your program received some
data with a function-management-header (FMH) and an end-of-group indication. In addition, the other program requested confirmation.
Action: If your program detects no errors, respond to the confirm request with
a respond-to-confirm (RSPCONFIRM) function, then issue an input operation.
If your program does detect an error, issue a fail function, or end your program.
Appendix B. Return Codes, Messages, and Sense Codes
B-3
Major Code 02
Major Code 02 – Input operation completed successfully, but your job is being ended
(controlled).
Description: The input operation issued by your program completed successfully. Your
program may have received some data or a message from the system. However, your
job is being ended (controlled).
Action: Your program should complete its processing and end as soon as possible.
The system eventually changes a job ended (controlled) to a job ended (immediate) and
forces all processing to stop for your job.
Code
Description/Action
0200
Description: On a successful input operation, your program received some
data with a turnaround indication. Also, your job is being ended (controlled).
The other program is ready to receive data from your program.
Action: Your program can issue an input or output operation. However, the
recommended action is to complete all processing and end your program as
soon as possible. The system eventually changes a job ended (controlled) to a
job ended (immediate) and forces all processing to stop for your job.
0201
Description: On a successful input operation, your program received some
data. Also, your job is being ended (controlled). Your program can continue to
receive data until it receives a turnaround indication (which allows your program
to send data) or a detach indication.
Action: Your program can issue another input operation. If your program
detects the equivalent of a turnaround indication, it can issue an output operation. However, the recommended action is to complete all processing and end
your program as soon as possible. The system eventually changes a job
ended (controlled) to a job ended (immediate) and forces all processing to stop
for your job.
0203
Description: On a successful input operation, your program received some
data with an end-of-group indication. Also, your job is being ended (controlled).
Action: Your program can issue an input operation to receive the next group
of records. However, the recommended action is to complete all processing
and end your program as soon as possible. The system eventually changes a
job ended (controlled) to a job ended (immediate) and forces all processing to
stop for your job.
0204
Description: On a successful input operation, your program received some
data with a function-management-header (FMH) and a turnaround indication.
Also, your job is being ended (controlled). The other program is ready to
receive data.
Action: Your program can issue an output operation. However, the recommended action is to complete all processing and end your program as soon as
possible. The system eventually changes a job ended (controlled) to a job
ended (immediate) and forces all processing to stop for your job.
0205
Description: On a successful input operation, your program received some
data with a function-management-header (FMH). Also, your job is being ended
(controlled).
Action: Your program can issue another input operation to continue receiving
data until it receives a turnaround indication or a detach indication. However,
the recommended action is to complete all processing and end your program
as soon as possible. The system eventually changes a job ended (controlled)
to a job ended (immediate) and forces all processing to stop for your job.
B-4
Intrasystem Communications Programming V4R1
0207
Description: On a successful input operation, your program received a
function-management-header (FMH) and an end-of-group indication. Also, your
job is being ended (controlled).
Action: Your program can issue another input operation to receive the next
group of records. However, the recommended action is to complete all processing and end your program as soon as possible. The system eventually
changes a job ended (controlled) to a job ended (immediate) and forces all processing to stop for your job.
0208
Description: On a successful input operation, your program received a detach
indication with the last of the data. The communications transaction with the
other program has ended. Also, your job is being ended (controlled).
Action: If your program started the session, it can issue another evoke function (to start another program), issue a release operation (to perform local processing or to start another session), or end. If a program start request from the
other program started the transaction, your program can either issue an end-ofsession function or end. However, the recommended action is to complete all
processing and end your program as soon as possible. The system eventually
changes a job ended (controlled) to a job ended (immediate) and forces all processing to stop for your job.
0214
Description: On a successful input operation, your program received some
data with a turnaround indication. In addition, the other program requested
confirmation. Also, your job is being ended (controlled).
Action: Process any data received with the request. If your program detects
no errors, respond to the confirm request with a respond-to-confirm
(RSPCONFIRM) function, then issue an input or output operation. If your
program does detect an error, issue a fail function, or end your program.
However, the recommended action is to complete all processing and end your
program as soon as possible. The system eventually changes a job ended
(controlled) to a job ended (immediate) and forces all processing to stop for
your job.
0215
Description: On a successful input operation, your program received some
data. In addition, the other program requested confirmation. Also, your job is
being ended (controlled).
Action: Process any data received with the request. If your program detects
no errors, respond to the confirm request with a respond-to-confirm
(RSPCONFIRM) function, then issue an input operation. If your program does
detect an error, issue a fail function, or end your program. However, the
recommended action is to complete all processing and end your program as
soon as possible. The system eventually changes a job ended (controlled) to a
job ended (immediate) and forces all processing to stop for your job.
0217
Description: On a successful input operation, your program received some
data with an end-of-group indication. In addition, the other program requested
confirmation. Also, your job is being ended (controlled).
Action: Process any data received with the request. If your program detects
no errors, respond to the confirm request with a respond-to-confirm
(RSPCONFIRM) function, then issue another input operation. If your program
does detect an error, issue a fail function, or end your program. However, the
recommended action is to complete all processing and end your program as
soon as possible. The system eventually changes a job ended (controlled) to a
job ended (immediate) and forces all processing to stop for your job.
021C
Description: On a successful input operation, your program received some
data with a detach indication. In addition, the other program requested confirmation. Also, your job is being ended (controlled).
Action: If your program detects no errors, it should respond to the confirm
request with a respond-to-confirm (RSPCONFIRM) function, and then:
Appendix B. Return Codes, Messages, and Sense Codes
B-5
Ÿ If your program started the transaction, it can issue another evoke operation (to start another program), issue a release operation (to perform local
processing or to start another session), or end.
Ÿ If a program start request from the other program started the transaction,
your program can issue an end-of-session function or end.
If your program does detect an error, issue a fail operation. The transaction
remains active, and your program and the other program can perform the necessary error recovery. If your program detects an error and wants to end the
transaction abnormally, issue an end-of-session function, or end your program.
However, the recommended action is to complete all processing and end your
program as soon as possible. The system eventually changes a job ended
(controlled) to a job ended (immediate) and forces all processing to stop for
your job.
0244
Description: On a successful input operation, your program received some
data with a function-management-header (FMH) and a turnaround indication.
In addition, the other program requested confirmation. Also, your job is being
ended (controlled).
Action: If your program detects no errors, respond to the confirm request with
a respond-to-confirm (RSPCONFIRM) function, then issue an output operation.
If your program does detect an error, issue a fail function, or end your program.
However, the recommended action is to complete all processing and end your
program as soon as possible. The system eventually changes a job ended
(controlled) to a job ended (immediate) and forces all processing to stop for
your job.
0245
Description: On a successful input operation, your program received some
data with a function-management-header (FMH). In addition, the other program
requested confirmation. Also, your job is being ended (controlled).
Action: If your program detects no errors, respond to the confirm request with
a respond-to-confirm (RSPCONFIRM) function, then issue an input operation.
If your program does detect an error, issue a fail function, or end your program.
However, the recommended action is to complete all processing and end your
program as soon as possible. The system eventually changes a job ended
(controlled) to a job ended (immediate) and forces all processing to stop for
your job.
0247
Description: On a successful input operation, your program received some
data with a function-management-header (FMH) and an end-of-group indication. In addition, the other program requested confirmation. Also, your job is
being ended (controlled).
Action: If your program detects no errors, respond to the confirm request with
a respond-to-confirm (RSPCONFIRM) function, then issue an input operation.
If your program does detect an error, issue a fail function, or end your program.
However, the recommended action is to complete all processing and end your
program as soon as possible. The system eventually changes a job ended
(controlled) to a job ended (immediate) and forces all processing to stop for
your job.
B-6
Intrasystem Communications Programming V4R1
Major Code 03
Major Code 03 – Input operation completed successfully, but no data received.
Description: The input operation issued by your program completed successfully, but
no data was received.
Action: Examine the minor return code and continue with the next operation.
Code
Description/Action
0300
Description: On a successful input operation, your program received a turnaround indication without any data. The session is still active.
Action: Issue an input or output operation.
0301
Description: On a successful input operation, your program received no data.
Your program must continue to receive input until it receives a turnaround or
detach indication.
Action: Issue an input operation.
0302
Description: On a successful input operation, your program received a fail
indication without any data. Either the other program has sent a fail function,
or the system has detected a break condition.
Action: Issue an input operation to receive the reason for the fail from the
other program.
0303
Description: On a successful input operation, your program received an endof-group indication without any data.
Action: Issue another input operation.
0308
Description: On a successful input operation, your program received a detach
indication without any data. The communications transaction with the other
program has ended. If you specified the DDS keyword RCVDETACH, the
receive-detach indicator is also set on.
Action: If your program started the session, it can issue another evoke function (to start another program), issue a release operation (to perform local processing or to start another session), or end. If a program start request from the
other program started the transaction, your program can either issue an end-ofsession function or end.
0309
Description: On a read-from-invited-program-devices operation, your program
did not receive any data. Also, your job is being ended (controlled).
Action: Your program can continue processing. However, the recommended
action is to complete all processing and end your program as soon as possible.
The system eventually changes a job ended (controlled) to a job ended (immediate) and forces all processing to stop for your job.
Messages:
CPF4741 (Notify)
0310
Description: On a read-from-invited-program-devices operation, the time
interval specified by a timer function in your program or by the WAITRCD value
specified for the ICF file expired.
Action: Issue the intended operation after the specified time interval has
ended. For example, if you were using the time interval to control the length of
time to wait for data, you can issue another read-from-invited-program-devices
operation to receive the data.
Note: Since no specific program device name is associated with the completion of this operation, the program device name in the common I/O
Appendix B. Return Codes, Messages, and Sense Codes
B-7
feedback area is set to *N. Therefore, your program should not make
any checks based on the program device name after receiving the 0310
return code.
Messages:
CPF4742 (Status)
CPF4743 (Status)
0314
Description: On a successful input operation, your program received a turnaround indication without any data. In addition, the other program requested
confirmation.
Action: If your program detects no errors, respond to the confirm request with
a respond-to-confirm (RSPCONFIRM) function, then issue an input or output
operation. If your program does detect an error, issue a fail function, or end
your program.
0315
Description: On a successful input operation, your program did not receive
any data. In addition, the other program requested confirmation.
Action: If your program detects no errors, respond to the confirm request with
a respond-to-confirm (RSPCONFIRM) function, then issue an input operation.
If your program does detect an error, issue a fail function, or end your program.
0317
Description: On a successful input operation, your program received an endof-group indication without any data. In addition, the other program requested
confirmation.
Action: If your program detects no errors, respond to the confirm request with
a respond-to-confirm (RSPCONFIRM) function, then issue an input operation.
If your program does detect an error, issue a fail function, or end your program.
031C
Description: On a successful input operation, your program received a detach
indication without any data. In addition, the other program requested confirmation.
Action: If your program detects no errors, it should respond to the confirm
request with a respond-to-confirm (RSPCONFIRM) function, and then:
Ÿ If your program started the transaction, it can issue another evoke operation (to start another program), issue a release operation (to perform local
processing or to start another session), or end.
Ÿ If a program start request from the other program started the transaction,
your program can issue an end-of-session function or end.
If your program does detect an error, issue a fail operation. The transaction
remains active, and your program and the other program can perform the necessary error recovery. If your program detects an error and wants to end the
transaction abnormally, issue an end-of-session function, or end your program.
Major Code 04
Major Code 04 – Output exception occurred.
Description: An output exception occurred because your program attempted to send
data when it should be receiving data. The data from your output operation was not sent
to the remote system. You can attempt to send the data later.
Action: Issue an input operation to receive the data.
B-8
Intrasystem Communications Programming V4R1
Code
Description/Action
0402
Description: Your program was sending data when a fail indication was
received. Your program is now in receive state.
Action: Issue an input operation.
Messages:
CPF48ð6 (Notify)
0412
Description: An output exception occurred because your program attempted
to send data when it should be receiving data that was sent by the other
program. The data from your output operation was not sent. Your program
can attempt to send the data later.
Action: Issue an input operation to receive the data.
Note: If your program issues another output operation before an input operation, your program receives a return code of 831C.
Messages:
CPF475ð (Notify)
CPF5ð76 (Notify)
Major Codes 08 and 11
Major Codes 08 and 11 – Miscellaneous program errors occurred.
Description: The operation just attempted by your program was not successful. The
operation may have failed because it was issued at the wrong time.
Action: Refer to the minor code description for the appropriate recovery action.
Code
Description/Action
0800
Description: The acquire operation just attempted by your program was not
successful. Your program tried to acquire a program device that was already
acquired and is still active.
Action: If the session associated with the original acquire operation is the one
needed, your program can begin communicating in that session since it is
already available. If you want a different session, issue another acquire operation for the new session by specifying a different program device name in the
PGMDEV parameter of the ADDICFDEVE, CHGICFDEVE, or OVRICFDEVE
command that precedes the program.
Messages:
CPD4ð77 (Diagnostic)
CPF5ð41 (Status)
CPF5ðAð (Status)
1100
Description: The read-from-invited-program-devices operation just attempted
by your program was not successful because your program tried this operation
when no program devices were invited and no timer function was in effect.
Action: Issue an invite function (or a combined operation that includes an
invite) followed by a read-from-invited-program-devices operation.
Messages:
CPF474ð (Notify)
Appendix B. Return Codes, Messages, and Sense Codes
B-9
Major Code 34
Major Code 34 – Input exception occurred.
Description: The input operation attempted by your program was not successful. The
data received was too long for your program's input buffer or was not compatible with the
record format specified on the input operation.
Action: Refer to the minor code description for the appropriate recovery action.
Code
Description/Action
3401
Description: The input operation issued by your program was not successful
because the length of the data record sent by the other system was longer than
the length specified for your program's input buffer. The length of the data
record received from the other system, if available, is in the actual-recordlength field in the I/O feedback area.
Action: Issue another input operation if your program can specify a record
size large enough to receive the data, plus any indicators for a file without a
separate indicator area. Otherwise, you should close the file, end your
program, correct the record size, then run your program again.
Messages:
CPF4768 (Notify)
3441
Description: A valid record format name was specified with format selection
type *RMTFMT or *RECID. However, although the data received matched one
of the record formats in the ICF file, it did not match the format specified on the
read operation.
Action: Correct your program to issue a read operation that does not specify a
record format name, or specify the correct record format name to process the
data based on the format selection option for the file.
Messages:
CPF5ð58 (Notify)
3451
Description: Your program specified a file record size that was not large
enough for the indicators to be included with the data sent by the other
program (for a file defined with a nonseparate indicator area). Your program
did not receive any data. For a file using a nonseparate indicator area, the
actual record length field in the device-dependent I/O feedback area contains
the number of indicators specified by the record format.
Action: End the session; close the file; correct the file record size; then open
the file again.
Messages:
CPF4768 (Notify)
B-10
Intrasystem Communications Programming V4R1
Major Code 80
Major Code 80 – Permanent system or file error (irrecoverable).
Description: An irrecoverable file or system error has occurred. The underlying communications support may have ended and your session has ended. If the underlying
communications support ended, it must be established again before communications can
resume. Recovery from this error is unlikely until the problem causing the error is
detected and corrected.
Action: You can perform the following general actions for all 80xx return codes. Specific actions are given in each minor code description.
Ÿ Close the file, open the file again, then establish the session. If the operation is still
not successful, your program should end the session.
Ÿ Continue local processing.
Ÿ End.
Note: If the session is started again, it starts from the beginning, not at the point where
the session error occurred.
Code
Description/Action
8081
Description: The operation attempted by your program was not successful
because a system error condition was detected.
Action: Your communications configurations may need to be varied off and
then on again. Your program can do one of the following:
Ÿ Continue local processing.
Ÿ Close the ICF file, open the file again, and establish the session again.
Ÿ End.
Messages:
CPF417ð
CPF451ð
CPF4566
CPF5257
8082
(Escape)
(Escape)
(Escape)
(Escape)
Description: The operation attempted by your program was not successful
because the device supporting intrasystem communications between your
program and the other program is not usable. For example, this may have
occurred because communications were stopped for the device by a Hold Communications Device (HLDCMNDEV) command. Your program should not issue
any operations to the device.
Action: Communications with the remote program cannot resume until the
device has been reset to a varied on state. If the device has been held, use
the Release Communications Device (RLSCMNDEV) command to reset the
device. If the device is in an error state, vary the device off and then on again.
Your program can attempt to establish the session again, continue local processing, or end.
Messages:
CPF4744 (Escape)
CPF5269 (Escape)
80B3
Description: The open operation issued by your program was not successful
because the ICF file is in use by another process.
Action: Wait for the file to become available, then issue another open operation. Otherwise, your program may continue processing, or it can end.
Appendix B. Return Codes, Messages, and Sense Codes
B-11
Consider increasing the WAITFILE parameter with the Change ICF File
(CHGICFF) or Override ICF File (OVRICFF) command to allow more time for
the file resources to become available.
Messages:
CPF4128 (Escape)
80EB
Description: The open operation attempted by your program was not successful due to one of the following:
Ÿ Your program used an option of update or delete to open the file, but that
option is not supported by the program device.
Ÿ Your program requested both blocked data and user buffers on an open
option, but these formats cannot be selected together.
Ÿ Your program tried to open a source file, but the file was not created as a
source file.
Ÿ There is a mismatch on the INDARA keyword between your program and
the ICF file as to whether or not a separate indicator area should be used.
Ÿ The file was originally opened as a shared file; however, no program
devices were ever acquired for the file before your program attempted the
current open operation.
Action: After performing one of the following actions, your program can try the
open operation again:
Ÿ If the update and delete options are not supported for the program device,
use an option of input, or output, or both.
Ÿ If your program tried selecting user buffers and blocked data together, it
should try selecting one or the other, but not both.
Ÿ If your program tried to open a non-source file as a source file, either
change the file name or change the library name.
Ÿ If there was a mismatch on the INDARA keyword, either correct the file or
correct your program so that the two match.
Ÿ If no program devices were previously acquired for a shared file, acquire
one or more program devices for the file.
Messages:
CPF4133
CPF4156
CPF4238
CPF425ð
CPF4345
CPF5522
CPF5549
80ED
(Escape)
(Escape)
(Escape)
(Escape)
(Escape)
(Escape)
(Escape)
Description: The open operation attempted by your program was not successful because there is a record format level mismatch between your program
and the ICF file.
Action: Close the file. Compile your program again to match the file level of
the ICF file, or change or override the file to LVLCHK(*NO); then open the file
again.
Messages:
CPF4131 (Escape)
80EF
Description: Your program attempted an open operation on a file or library for
which the user is not authorized.
Action: Close the file. Either change the file or library name on the open
operation, or obtain authority for the file or library from your security officer.
Then issue the open operation again.
Messages:
CPF41ð4 (Escape)
B-12
Intrasystem Communications Programming V4R1
80F8
Description: The open operation attempted by your program was not successful because one of the following occurred:
Ÿ The file is already open.
Ÿ The file is marked in error on a previous return code.
Action:
Ÿ If the file is already open, close the file and end your program. Remove
the duplicate open operation from your program, then issue the open operation again.
Ÿ If the file is marked in error, your program can check the job log to see
what errors occurred previously, then take the appropriate recovery action
for those errors.
Messages:
CPF4132 (Escape)
CPF5129 (Escape)
Major Code 81
Major Code 81 – Permanent session error (irrecoverable).
Description: An irrecoverable session error occurred during an I/O operation. Your
session cannot continue and has ended. Before communications can resume, the
session must be established again by using an acquire operation or another program
start request. Recovery from this error is unlikely until the problem causing the error is
detected and corrected. Operations directed to other sessions associated with the file
should work.
Action: You can perform the following general actions for all 81xx return codes. Specific actions are given in each minor return code description.
If your program initiated the session, you can:
Ÿ Correct the problem and establish the session again. If the operation is still not
successful, your program should end the session.
Ÿ Continue processing without the session.
Ÿ End.
If your session was initiated by a program start request from the other program, you can:
Ÿ Continue processing without the session.
Ÿ End.
Note: If the session is started again, it starts from the beginning, not at the point where
the session error occurred.
Code
Description/Action
8140
Description: A cancel reply was received from your program or from the operator in response to a notify message, or was the result of a system default,
causing the session to be ended. The session is no longer active.
Action: If your program started the session, issue an acquire operation to start
the session again. If your program was started by a program start request, it
can continue local processing or end.
Messages:
CPF51ð4 (Escape)
81E9
Description: An input operation was issued and the format selection option for
the ICF file was *RECID, but the data received did not match any record
formats in the file. There was no format in the file defined without a RECID
Appendix B. Return Codes, Messages, and Sense Codes
B-13
keyword, so there was no default record format to use. The session has
ended.
Action: Verify that the data sent by the other program was correct. If the data
was not correct, change the other program to send the correct data. If the data
was correct, add a RECID keyword definition to the file that matches the data,
or define a record format in the file without a RECID keyword so that a default
record format can be used on input operations. If your program started the
session, use another acquire operation to start the session again. If a program
start request started your program, continue local processing or end.
Messages:
CPF5291 (Escape)
Major Code 82
Major Code 82 – Open or acquire operation failed.
Description: Your attempt to establish a session was not successful. The error may be
recoverable or permanent, and recovery from it is unlikely until the problem causing the
error is detected and corrected.
Action: You can perform the following general actions for all 82xx return codes. Specific actions are given in each minor code description.
If your program was attempting to start the session, you can:
Ÿ Correct the problem and attempt to establish the session again. The next operation
could be successful only if the error occurred because of some temporary condition.
If the operation is still not successful, your program should end.
Ÿ Continue processing without the session.
Ÿ End.
If your session was initiated by a program start request from the other program, you can:
Ÿ Correct the problem and attempt to connect to the requesting program device again.
If the operation is still not successful, your program should end.
Ÿ Continue processing without the session.
Ÿ End.
Several of the minor codes indicate that an error condition must be corrected by
changing a value in the communications configuration or in the file.
Ÿ To change a parameter value in the communications configuration, vary the configuration off, make the change to the configuration description, then vary the configuration on.
Ÿ To change a parameter value in the file, use the ADDICFDEVE, CHGICFDEVE, or
OVRICFDEVE command.
Note: When a parameter can be specified both in the ADDICFDEVE or
OVRICFDEVE command and in the configuration, the value in the
ADDICFDEVE or OVRICFDEVE command overrides the value specified in
the configuration (for your program only). Therefore, in some cases, you
may choose to make a change with the ADDICFDEVE or OVRICFDEVE
command rather than in the configuration.
If no changes are needed in your file or in the configuration (and depending on what the
return code description says):
Ÿ If the attempted operation was an acquire, issue the acquire operation again.
Ÿ If the attempted operation was an open, close the file and issue the open operation
again.
B-14
Intrasystem Communications Programming V4R1
Code
Description/Action
8209
Description: The open or acquire operation issued by your program was not
successful because a prestart job is being canceled. One of the following may
have occurred:
Ÿ An End Job (ENDJOB), End Prestart Job (ENDPJ), End Subsystem
(ENDSBS), End System (ENDSYS), or Power Down System
(PWRDWNSYS) command was being issued.
Ÿ The maximum number of prestart jobs (MAXJOBS parameter) was
reduced by the Change Prestart Job Entry (CHGPJE) command.
Ÿ The value for the maximum number of program start requests allowed
(specified in the MAXUSE parameter on the ADDPJE or CHGPJE
command) was exceeded.
Ÿ Too many unused prestart jobs exist.
Ÿ The prestart job had an initialization error.
Action: Complete all processing and end your program as soon as possible.
Correct the system error before starting this job again.
Messages:
CPF4292 (Escape)
CPF5313 (Escape)
8233
Description: A program device name that was not valid was detected. Either
an ADDICFDEVE, CHGICFDEVE, or OVRICFDEVE command was not run, or
the program device name in your program does not match the program device
name specified in the ADDICFDEVE, CHGICFDEVE, or OVRICFDEVE
command for the session being acquired. The session was not started.
Action: If the error was in your program, change your program to specify the
correct program device name. If an incorrect identifier was specified in the
ADDICFDEVE, CHGICFDEVE, or OVRICFDEVE command, specify the correct
value in the PGMDEV parameter.
Messages:
CPF4288 (Escape)
CPF5ð68 (Escape)
8281
Description: On an unsuccessful open or acquire operation, a system error
condition was detected. For example, the file may previously have been in
error, or the file could not be opened due to a system error.
Action: Your communications configurations may need to be varied off and
then on again. Your program can do one of the following:
Ÿ Continue local processing.
Ÿ Close the ICF file, open the file again, and acquire the program device
again. However, if this results in another 8281 return code, your program
should close the file and end.
Ÿ Close the file and end.
Messages:
CPF4168
CPF4182
CPF4369
CPF437ð
CPF4375
CPF5257
CPF5274
CPF5317
CPF5318
8282
(Escape)
(Escape)
(Escape)
(Escape)
(Escape)
(Escape)
(Escape)
(Escape)
(Escape)
Description: The open or acquire operation attempted by your program was
not successful because the device supporting intrasystem communications
between your program and the other program is not usable. For example, this
Appendix B. Return Codes, Messages, and Sense Codes
B-15
may have occurred because communications were stopped for the device by a
Hold Communications Device (HLDCMNDEV) command. Your program should
not issue any operations to the device. The session was not started.
Action: Communications with the remote program cannot resume until the
device has been reset to a varied on state. If the device has been held, use
the Release Communications Device (RLSCMNDEV) command to reset the
device. If the device is in an error state, vary the device off, then on again.
Your program can attempt to acquire the program device again, continue local
processing, or end.
Messages:
CPF4298 (Escape)
CPF5269 (Escape)
82A8
Description: The acquire operation attempted by your program was not successful because the maximum number of program devices allowed for the ICF
file has been reached. The session was not started.
Action: Your program can recover by releasing a different program device and
issuing the acquire operation again. If more program devices are needed,
close the file and increase the MAXPGMDEV value for the ICF file.
Messages:
CPF4745 (Diagnostic)
CPF5ð41 (Status)
82A9
Description: The acquire operation issued by your program to a
*REQUESTER device was not successful due to one of the following causes:
Ÿ Your program has already acquired the *REQUESTER device.
Ÿ The job was started by a program start request with the *REQUESTER
device detached.
Ÿ The *REQUESTER device was released because an end-of-session was
requested.
Ÿ The job does not have a *REQUESTER device; that is, the job was not
started by a program start request.
Ÿ A CPI Communications requesting conversation is already allocated.
Ÿ A permanent error occurred on the session.
Action:
Ÿ If the *REQUESTER device is already acquired and your program expects
to communicate with the *REQUESTER device, use the program device
that acquired the *REQUESTER.
Ÿ If the *REQUESTER device is not available and your program expects to
communicate with the *REQUESTER device, the other program must send
a program start request without a detach function.
Ÿ If your program released its *REQUESTER device, correct the error that
caused your program to release its *REQUESTER device before trying to
acquire it.
Ÿ If this job does not have a *REQUESTER device, correct the error that
caused your program to attempt to acquire a *REQUESTER device.
Ÿ If a permanent error caused the acquire operation to fail, verify that your
program correctly handles the permanent error return codes (80xx, 81xx) it
received on previously issued input and output operations. Because your
program was started by a program start request, your program cannot
attempt error recovery after receiving a permanent error return code. It is
the responsibility of the other program to initiate error recovery.
Messages:
CPF4366 (Escape)
CPF538ð (Escape)
CPF5381 (Escape)
B-16
Intrasystem Communications Programming V4R1
82AA
Description: The open or acquire operation attempted by your program was
not successful because the remote location name specified on the
ADDICFDEVE, CHGICFDEVE, or OVRICFDEVE command does not match
any remote location configured on the system. The session was not started.
Action: Your program can continue local processing, or close the file and end.
Verify that the name of the remote location is specified correctly in the
RMTLOCNAME parameter on the ADDICFDEVE, CHGICFDEVE, or
OVRICFDEVE command.
Messages:
CPF41ð3
CPF4363
CPF4364
CPF4747
CPF53ð4
CPF5378
CPF5379
82AB
(Escape)
(Escape)
(Escape)
(Escape)
(Escape)
(Escape)
(Escape)
Description: The open or acquire operation attempted by your program was
not successful because the device description for the remote location was not
varied on. The session was not started.
Action: Your program can wait until the communications configuration is
varied on and then issue the acquire operation again, it can try the acquire
operation again using a different device description, continue local processing,
or end.
Messages:
CPF43ð4 (Escape)
CPF5355 (Escape)
82EA
Description: The open or acquire operation attempted by your program was
not successful. A format selection of *RECID was specified on the
ADDICFDEVE, CHGICFDEVE, or OVRICFDEVE command, but cannot be
used with the ICF file because the RECID DDS keyword is not used on any of
the record formats in the file. The session was not started.
Action: Close the ICF file. Change the record format selection (FMTSLT)
parameter to select formats by some means other than *RECID, or use a file
that has a RECID DDS keyword specified for at least one record format. Open
the file again.
Messages:
CPF4348 (Escape)
CPF5521 (Escape)
82EE
Description: Your program attempted an open or acquire operation to a
device that is not supported. Your program tried to acquire a device that is not
a valid ICF communications type, or it is trying to acquire the requesting
program device in a program that was not started by a program start request.
The session was not started.
Action: Your program can continue local processing or end. Verify that the
name of the remote location is specified correctly in the RMTLOCNAME parameter on the ADDICFDEVE, CHGICFDEVE, or OVRICFDEVE command. If your
program was attempting to acquire a non-ICF device, use the appropriate interface for that communications type. If your program was attempting to acquire a
requesting program device, verify that your program is running in the correct
environment.
Messages:
CPF41ð5 (Escape)
CPF4223 (Escape)
CPF4251 (Escape)
Appendix B. Return Codes, Messages, and Sense Codes
B-17
CPF476ð (Escape)
CPF5ð38 (Escape)
CPF555ð (Escape)
82EF
Description: Your program attempted an acquire operation, or an open operation that implicitly acquires a session, to a device that the user is not authorized
to, or that is in service mode. The session was not started.
Action: If the operation was an acquire, correct the problem and issue the
acquire again. If the operation was an open, close the file, correct the problem,
then issue the open operation again. To correct an authority error, obtain
authority for the device from your security officer or device owner. If the device
is in service mode, wait until machine service function (MSF) is no longer using
the device before issuing the operation again.
Messages:
CPF41ð4
CPF4186
CPF5278
CPF5279
82F4
(Escape)
(Escape)
(Escape)
(Escape)
Description: The open or acquire operation attempted by your program was
not successful because the open operation for input only is valid only for a
requesting program device.
Action: End your program, correct the ADDICFDEVE, CHGICFDEVE, or
OVRICFDEVE command, then run your program again.
Messages:
CPF4322 (Escape)
CPF5539 (Escape)
B-18
Intrasystem Communications Programming V4R1
Major Code 83
Major Code 83 – Session error occurred (the error is recoverable).
Description: A session error occurred, but the session may still be active. Recovery
within your program might be possible.
Action: You can perform the following general actions for all 83xx return codes. Specific actions are given in each minor code description.
Ÿ Correct the problem and continue processing with the session. If the error occurred
because of a resource failure on the system, a second attempt may be successful.
If the operation is still not successful, your program should end the session.
Ÿ Issue an end-of-session function and continue processing without the session.
Ÿ End.
Several of the minor codes indicate that an error condition must be corrected by
changing a value in the communications configuration or in the file.
Ÿ To change a parameter value in the communications configuration, vary the configuration off, make the change to the configuration description, then vary the configuration on.
Ÿ To change a parameter value in the file, use the ADDICFDEVE, CHGICFDEVE, or
OVRICFDEVE command.
Note: When a parameter can be specified both in the ADDICFDEVE or
OVRICFDEVE command and in the configuration, the value in the
ADDICFDEVE or OVRICFDEVE command overrides the value specified in
the configuration (for your program only). Therefore, in some cases, you
may choose to make a change with the ADDICFDEVE or OVRICFDEVE
command rather than in the configuration.
If no changes are needed in your file or in the configuration, and depending on what the
return code description says, you should notify the system operator that a change is
required to correct the error received.
Code
Description/Action
830B
Description: Your program attempted an operation that was not valid because
the session was not yet acquired or has ended. The session may have ended
because of a release operation, an end-of-session function, or a permanent
error. Your program may have incorrectly handled a previous error.
Action: Verify that your program does not attempt any operations without an
active session. Also verify that your program correctly handles the permanent
error or session-not-acquired return codes (80xx, 81xx, 82xx) it received on
previously issued input and output operations. To recover from an incorrectly
handled error condition, your program may or may not be able to issue another
acquire operation, depending on the return code.
Messages:
CPD4ð79
CPF4739
CPF5ð67
CPF5ð68
CPF5ð7ð
8319
(Diagnostic)
(Status)
(Escape)
(Escape)
(Escape)
Description: The other program sent a negative-response with sense data.
Action: Issue an input operation to receive the sense data.
Messages:
CPF4773 (Notify)
Appendix B. Return Codes, Messages, and Sense Codes
B-19
831A
Description: One of the following occurred:
Ÿ The evoke function attempted by your program was not successful.
Ÿ The other program issued an end-of-session function.
Ÿ The other program ended abnormally.
Action: Your program can issue an end-of-session function, issue a different
evoke function, or end.
Messages:
CPF48ð5 (Notify)
CPF48ð8 (Notify)
831B
Description: Your program tried to specify invalid sense data on a negativeresponse function, or it tried to send a negative-response that has already been
sent to the current chain. The data was not sent.
Action: Correct your program so that it does not issue the same negativeresponse more than once, and that it sends valid sense data on a negativeresponse function. Valid sense data must be either 0 or 8 bytes long. To send
8 bytes, the first four bytes must be 0000, 08xx, or 10xx, and the remaining
four bytes must be in the ranges 0-9, A-F, or a-f. If your program chooses to
send a negative-response without sense data, intrasystem communications
automatically sends 08110000 to the other program.
Messages:
CPF4774 (Notify)
831C
Description: Your program's previous output operation received a return code
of 0412, indicating that your program must receive information sent by the other
program; however, your program did not handle the return code correctly. The
current output operation was not successful because your program should have
issued an input operation to receive the information already sent by the other
program.
Action: Issue an input operation to receive the previous information.
Messages:
CPF4934 (Notify)
831E
Description: The operation attempted by your program was not valid, or a
combination of operations that was not valid was specified. The session is still
active. The error may have been caused by one of the following:
Ÿ Your program issued an operation that is not recognizable or not supported
by intrasystem communications.
Ÿ Your program requested a combination of operations or keywords that was
not valid, such as a combined write-then-read operation with the invite
function specified.
Ÿ Your program issued an input operation, or an output operation with the
invite or allow-write function, for a file that was opened for output only.
Ÿ Your program issued an output operation for a file that was opened for
input only.
Ÿ Your program issued a close operation with a temporary close option.
Action: Your program can try a different operation, issue a release operation
or end-of-session function, or end. Correct the error in your program before
trying to communicate with the other program.
If the file was opened for input only, do not issue any output operations; or, if
the file was opened for output only, do not issue any input operations, and do
not use the invite or allow-write function on an output operation. If such an
operation is needed, then release the session, close the ICF file, and open the
file again for input and output.
Messages:
B-20
Intrasystem Communications Programming V4R1
CPF4564
CPF4764
CPF4766
CPF479ð
CPF48ð3
CPF5132
CPF5149
831F
(Escape)
(Notify)
(Notify)
(Notify)
(Notify)
(Escape)
(Escape)
Description: Your program specified data or a length for the operation that
was not valid; however, the session is still active. One of the following caused
the error indication:
Ÿ On an output operation, your program tried to send a data record that was
longer than the MAXRCDLEN value specified for the ICF file.
Ÿ The program used a read or write operation that specified a data length
greater than the record format in the ICF file.
Ÿ If this was a timer function, the format of the timer interval was not
HHMMSS.
Ÿ If a system-defined format was used to specify the operation, or if the
variable-length-data-record (VARLEN) function was used, then the length
of the user buffer was not valid.
Action: If you want your program to recover, try the operation again with a
smaller data length. If you do not need your program to recover immediately,
do one of the following:
Ÿ Change the record format length in the ICF file, or change the record
length in your program and compile your program again.
Ÿ For an input operation, specify a data length equal to or less than the
record format length, or do not specify a length at all.
Ÿ If the timer function was used, verify that the format of the timer interval is
HHMMSS.
Ÿ For an output operation that used the variable-length-data-record
(VARLEN) function, verify that the length specified is less than the record
length specified for the ICF file when it was opened.
Messages:
CPF4762 (Notify)
CPF4765 (Notify)
CPF4767 (Notify)
8322
Description: Your program tried to issue a negative-response or a request-towrite function. These functions are only valid while your program is in receive
state.
Action: Your program can issue an output operation to continue sending data,
issue an input operation to begin receiving data, issue an end-of-session function to continue local processing, or end. Correct the error that caused your
program to attempt the operation that was not valid.
Messages:
CPF47ð3 (Notify)
CPF4775 (Notify)
8323
Description: Your program attempted to issue a cancel function when data
was received for your program. The cancel function is only valid in send state.
Action: Your program can issue an input operation to continue receiving data,
issue an end-of-session function, or end. Correct the error that caused your
program to attempt the invalid operation.
Messages:
CPF4776 (Notify)
Appendix B. Return Codes, Messages, and Sense Codes
B-21
CPF48ð9 (Notify)
8326
Description: Your program attempted to issue a negative-response function or
a cancel function to cancel a group of records when no records were previously
sent to start a group. The cancel function is only valid within a chain; it is not
valid preceding a chain or between chains. The session is still active.
Action: Correct the error that caused your program to attempt the invalid operation.
Messages:
CPF4779 (Notify)
CPF481ð (Notify)
8327
Description: The input or output operation issued by your program was not
successful because there was no active transaction. Either the transaction has
ended, or the transaction was never started.
Action: If your program wants to start a transaction, it can issue an evoke
function. Otherwise, it can issue an end-of-session function or end. If a coding
error in your program caused the error, correct your program.
Messages:
CPF5ð98 (Notify)
8329
Description: An evoke function that was not valid was detected in this
session. Your program was started by a program start request and, therefore,
cannot issue any evoke functions in this session.
Action: To recover, your program can try a different operation or function. To
issue an evoke function in a different session, first issue an acquire operation
(using a different program device name), then try the evoke function. Otherwise, your program can issue an end-of-session function, continue local processing, or end. If a coding error caused your program to attempt an evoke
that was not valid, correct your program.
Messages:
CPF5ð99 (Notify)
832A
Description: Both your program and the other program were attempting to
receive data at the same time.
Action: The other program is waiting to receive data from your program.
Issue an output operation. If a coding error in your program caused the error,
correct your program.
Messages:
CPF48ð7 (Notify)
832C
Description: A release operation following an invite function was detected.
Because your program issued the invite function, it cannot issue a release
operation to end the invited session.
Action: Issue an input operation to satisfy the invite function, or issue a
cancel-invite function to cancel the invite function; then try the release operation
again. Otherwise, issue an end-of-session function to end the session. If a
coding error caused your program to attempt a release operation that was not
valid, correct your program.
Messages:
CPF4769 (Notify)
832D
B-22
Description: Following an invite function, your program issued a request-towrite indication, a negative-response indication, a cancel reply, or an additional
invite function. This operation failed because the original invite function must
first be satisfied by an input operation.
Intrasystem Communications Programming V4R1
Action: Issue an input operation to receive the data that was invited. Otherwise, issue an end-of-session function to end the session. If a coding error
caused your program to attempt a request-to-write indication or an additional
invite function, correct your program.
Messages:
CPF4924 (Notify)
832F
Description: The evoke function or release operation issued by your program
was not successful because your program attempted the operation while the
current transaction was still active. The operation was not performed, but the
session is still active.
Action: Use the detach function to end the current transaction before issuing
an evoke function or release operation. Correct the error that caused your
program to issue an evoke function during an active transaction; then run your
program again.
Messages:
CPF5ð99 (Notify)
8330
Description: On a successful input operation, your program received a cancel
function with a turnaround indication. The other program has canceled the
group of records it was sending and is now ready to receive data from your
program. The session is still active.
Action: Normally, your program should discard the canceled data it received
from the other program, as the data may be in error. Your program can then
issue an output operation.
Messages:
CPF4782 (Notify)
8331
Description: On a successful input operation, your program received a cancel
function without a turnaround indication. The other program has canceled the
group of records it was sending, but it is still in send state, and your program is
still in receive state. The session is still active.
Action: Normally, your program should discard the canceled data it received
from the other program, as the data may be in error. Your program should
then issue another input operation.
Messages:
CPF4783 (Notify)
8334
Description: The evoke function attempted by your program was not valid. A
program name must be specified on the evoke function.
Action: Correct your program so that it issues the evoke correctly, then try the
operation again.
Messages:
CPF48ð4 (Notify)
83CD
Description: The input operation issued by your program was not successful
because your program attempted a confirm function for a transaction that was
started with a synchronization level of *NONE.
Action: Issue an end-of-session function and change your program to start the
transaction with a synchronization level of *CONFIRM.
Messages:
CPF5ð16 (Notify)
83D6
Description: The RSPCONFIRM function issued by your program was not
valid because the other program did not request confirmation, or because the
current transaction was started with a synchronization level of *NONE.
Appendix B. Return Codes, Messages, and Sense Codes
B-23
Action: If the other program did not request confirmation, correct the error that
caused your program to issue the RSPCONFIRM function. However, if both
programs expect to use confirmation processing, the transaction must be
started with a synchronization level of *CONFIRM.
Messages:
CPF4792 (Notify)
83E0
Description: Your program attempted an operation using a record format that
was not defined for the ICF file.
Action: Verify that the name of the record format in your program is correct,
then check to see whether the record format is defined in the file definition.
Messages:
CPF5ð54 (Notify)
83E8
Description: Your program attempted to issue a cancel-invite function to a
session that was not invited. One of the following may have occurred:
Ÿ The invite function was implicitly canceled earlier in your program by a
valid output operation.
Ÿ The invite function was satisfied earlier in your program by a valid input
operation.
Ÿ Your program had already canceled the invite function, then tried to cancel
it again.
Ÿ Your program never invited the session.
The session is still active.
Action: Your program can issue an input or output operation, issue an end-ofsession function, continue local processing, or end. However, you should
correct the error that caused your program to attempt the cancel-invite to a
session that was not invited.
Messages:
CPF4763 (Notify)
83F8
Description: Your program attempted to issue an operation to a program
device that is marked in error due to a previous I/O or acquire operation. Your
program may have handled the error incorrectly.
Action: Release the program device, correct the previous error, then acquire
the program device again.
Messages:
CPF5293 (Escape)
Failed Program Start Requests
Message CPF1269 is sent to the system operator message queue when the local system
rejects an incoming program start request. You can use the message information to determine why the program start request was rejected.
The CPF1269 message contains two reason codes. One of the reason codes can be zero,
which can be ignored. If only one nonzero reason code is received, that reason code represents the reason the program start request was rejected. If you are running in the
System/36 environment on your AS/400 system, there can be two nonzero reason codes.
These two reason codes occur when the OS/400 program cannot determine whether the
program start request was to start a job in the System/36 environment or by the OS/400
program. One reason code explains why the program start request was rejected in the
System/36 environment and the other explains why the program start request was rejected
by the OS/400 program. Whenever you receive two reason codes, you should determine
which environment the job was to run in and correct the problem for that environment.
B-24
Intrasystem Communications Programming V4R1
Figure B-2 on page B-25 describes reason codes for failed program start requests.
Figure B-2 (Page 1 of 2). Reason Codes for Rejected Program Start Requests
Reason
Code
401
402
403
404
405
406
407
408
409
410
411
412
501
502
503
504
505
506
507
508
602
604
605
704
705
706
707
708
709
710
711
712
713
714
715
718
722
723
725
726
801
802
803
804
805
806
807
901
902
903
Reason Description
Program start request received to a device that is not allocated to
an active subsystem.
Requested device is currently being held by a Hold Communications Device (HLDCMNDEV) command.
User profile is not accessible.
Job description is not accessible.
Output queue is not accessible.
Maximum number of jobs defined by subsystem description are
already active.
Maximum number of jobs defined by communications entry are
already active.
Maximum number of jobs defined by routing entry are already
active.
Library on library list is exclusively in use by another job.
Group profile cannot be accessed.
Insufficient storage in machine pool to start job.
System value not accessible.
Job description was not found.
Output queue was not found.
Class was not found.
Library on initial library list was not found.
Job description or job description library is damaged.
Library on library list is destroyed.
Duplicate libraries were found on library list.
Storage-pool defined size is zero.
Transaction program-name value is reserved but not supported.
Matching routing entry was not found.
Program was not found.
Password is not valid.
User is not authorized to device.
User is not authorized to subsystem description.
User is not authorized to job description.
User is not authorized to output queue.
User is not authorized to program.
User is not authorized to class.
User is not authorized to library on library list.
User is not authorized to group profile.
User ID is not valid.
Default user profile is not valid.
Neither password nor user ID was provided, and no default user
profile was specified in the communications entry.
No user ID.
A user ID was received but a password was not sent.
No password was associated with the user ID.
User ID does not follow naming convention.
User profile is disabled.
Program initialization parameters are present but not allowed.
Program initialization parameter exceeds 2000 bytes.
Subsystem is ending.
Prestart job is inactive or is ending.
WAIT(NO) was specified on the prestart job entry and no prestart
job was available.
The maximum number of prestart jobs that can be active on a
prestart job entry was exceeded.
Prestart job ended when a program start request was being
received.
Program initialization parameters are not valid.
Number of parameters for program not valid.
Program initialization parameters required but not present.
Appendix B. Return Codes, Messages, and Sense Codes
B-25
Figure B-2 (Page 2 of 2). Reason Codes for Rejected Program Start Requests
Reason
Code
1001
1002
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
2501
2502
2503
B-26
Reason Description
System logic error. Function check or unexpected return code
encountered.
System logic error. Function check or unexpected return code
encountered while receiving program initialization parameters.
Character in procedure name not valid.
Procedure not found.
System/36 environment library not found.
Library QSSP not found.
File QS36PRC not found in library QSSP.
Procedure or library name is greater than 8 characters.
Current library not found.
Not authorized to current library.
Not authorized to QS36PRC in current library.
Not authorized to procedure in current library.
Not authorized to System/36 environment library.
Not authorized to file QS36PRC in System/36 environment
library.
Not authorized to procedure in System/36 environment library.
Not authorized in library QSSP.
Not authorized to file QS36PRC in QSSP.
Not authorized to procedure in QS36PRC in QSSP.
Unexpected return code from System/36 environment support.
Problem phase program not found in QSSP.
Not authorized to problem phase program in QSSP.
Maximum number of target programs started (100 per System/36
environment).
System logic error. Function check or unexpected return code
encountered while processing a program start request.
Temporarily unable to allocate needed resources for a program
start request.
No subsystem accepting program start requests for this device.
Intrasystem Communications Programming V4R1
Appendix C. Using Intrasystem Communications to Test Applications
This appendix discusses the differences between intrasystem
communications and other communications types, such as
advanced program-to-program communications (APPC),
binary synchronous communications equivalence link
(BSCEL), Systems Network Architecture Upline Facility
(SNUF), asynchronous, retail, and finance communications,
in sending and receiving data. There may also be differences in the way the communications types support the start
of sessions and transactions, online messages, record
length, and return codes.
These differences should be noted, especially if you use
intrasystem communications to test new application programs
to be run using other communications types.
If your program expects to receive certain return codes and
messages, these codes and messages may not be the same
for intrasystem communications as they are for another communications type. You may only be able to observe a range
of messages, or you may have to refer to the return codes
section for a specific communications type to determine the
differences for each code.
Using Intrasystem Communications for
Advanced Program-to-Program
Communications
Advanced program-to-program communications (APPC)
allows programs on an AS/400 system to communicate with
programs on other systems having compatible communications support. It also provides the capability for two programs to communicate with each other while running on the
same AS/400 system. This capability is enabled when
LINKTYPE(*LOCAL) is specified when the APPC controller
description is created. We recommend this method to test
programs which you have written to use APPC. APPC is the
AS/400 implementation of the SNA LU session type 6.2
architecture. The following considerations apply when you
use intrasystem communications to test programs to be run
using APPC.
Confirm Function
When your program uses the confirm function, intrasystem communications sends a positive response to
a confirm request if the user does a valid read or
write operation. However, APPC requires the user to
use the RSPCONFIRM DDS keyword to send a positive response.
Intrasystem communications also supports the confirm
function with non-APPC functions, such as the end-ofgroup function. This results in more return codes for
intrasystem communications.
 Copyright IBM Corp. 1997
Conversation Types
APPC supports both basic and mapped conversation
types; intrasystem communications only supports the
equivalent of a mapped conversation. Programs
written for either basic or mapped conversations can
run using intrasystem communications. However,
intrasystem communications does no checking to
ensure the two communicating programs are both
using the same conversation type.
Evoke Function
When your program uses the evoke function to start
another program and you specify *USER for the user
ID on the SECURITY keyword, intrasystem communications always passes the user ID on the program
start request. However, APPC only passes the user
ID if the remote system accepts a user ID that has
already been verified.
Fail Function
If your program receives a fail indication, intrasystem
communications issues a 0302 return code when your
program is in the receive state, and a 0402 return
code when your program is in the send state.
However, APPC issues 83C7 through 83CC return
codes when a fail indication is received in the send or
receive state.
Force-Data Function
Intrasystem communications does not buffer data,
APPC does. If you use APPC, and your program
issues a write operation without specifying a function
that forces the data to be sent (for example, an invite
function, force-data function, or read operation), the
data is buffered so it can be sent later.
Output Operations
If your program attempts to send data when it should
be receiving data, an output exception occurs and
intrasystem communications sends your program a
0412 return code. If your program issues another
output operation, it receives a 831C return code.
APPC continues to send the 0412 return code.
Record Length
On input operations, if the length of the data record
sent by the other program is greater than the length
of your program input buffer, intrasystem communications returns a 3401 return code, and your program
can issue another read operation if it can specify a
record size large enough to receive the entire record.
APPC truncates the data to fit in your program’s input
buffer, and returns a 3431 return code with the data;
the data that was truncated is lost.
Variable Buffer Management (VARBUFMGT)
APPC supports the variable buffer management
(VARBUFMGT) DDS keyword, whereas intrasystem
communications does not.
C-1
Using Intrasystem Communications for
Asynchronous Communications
Asynchronous communications is a method of communications that allows an exchange of data with a remote
device or system, using either a start-stop line or an X.25
line. The following considerations apply when you use intrasystem communications to test programs to be run using
asynchronous communications.
Detach Function
Intrasystem communications requires that your
program issue a detach function to end a transaction
before ending the session. Asynchronous communications does not support the detach function, and
does not require a transaction to be ended before
ending the session.
Evoke Function
Intrasystem communications requires that your
program issue an evoke function as the first operation
after an acquire operation, whereas asynchronous
communications does not. Therefore, your first operation following an acquire operation must be an evoke
function when you use intrasystem communications to
test an application program which is to be run using
asynchronous communications.
Fail Function
For both intrasystem and asynchronous communications, your program issues the fail function to indicate
that it has detected an error in the data while it was
sending or receiving. However, whereas asynchronous communications always sends a 0302 return
code, intrasystem communications sends a 0302
return code when your program is in receive state,
and a 0402 return code when your program is in send
state. Also, asynchronous communications discards
all data waiting to be received by your application
whenever a fail indication is sent or received.
Function-Management-Header Function
If your program uses the function-managementheader function, intrasystem communications sends
the function-management-header data to the other
program. If your program uses asynchronous communications and issues a write function-managementheader function, it affects data translation, changes
certain characteristics of data on an asynchronous
communications line, or sends packet
assembler/disassembler (PAD) messages.
Number of Sessions
Intrasystem communications allows multiple sessions
per device; asynchronous communications allows only
one session per device.
Read or Write Operations
Asynchronous communications allows your program
to issue read and write operations in any order. Intrasystem communications normally requires that your
application program be in the send state to issue
output operations, and in the receive state to issue
C-2
Intrasystem Communications Programming V4R1
input operations; however, if your program is in the
send state, you may issue a read operation.
Translation
Asynchronous communications supports translation of
data from EBCDIC to ASCII, whereas intrasystem
communications does not.
Using Intrasystem Communications with
Binary Synchronous Communications
Equivalence Link
Binary synchronous communications (BSC) is a data
communications line protocol that uses a standard set of
transmission control characters and control character
sequences to send binary-coded data over a communications
line. The ICF support on the AS/400 system that provides
binary synchronous communications with another AS/400
system is referred to as binary synchronous communications equivalence link (BSCEL) support. The following
considerations apply when you use intrasystem communications to test programs to be run using binary synchronous
communications equivalence link (BSCEL).
Detach Function
Intrasystem communications requires that your
program use a detach function to end a transaction,
and the other program receives a minor return code
of 08 indicating that the detach function was sent. If
your program uses BSCEL and specifies
RMTBSCEL(*NO), BSCEL treats a detach function as
if it were an end-of-group function, and the receiving
program would never receive a 08 minor return code.
End-of-Group Function
Intrasystem communications issues a return code of
0003 or 0303 to the other program when your
program issues an end-of-group function (the '03'
minor code indicates an end of group). BSCEL
issues either a 0300 or 0301 return code to the
receiving program, depending on the value specified
for the GRPSEP parameter in the device description
or on the ADDICFDEVE, the CHGICFDEVE, or the
OVRICFDEVE command.
Evoke Function
Intrasystem communications requires that a source
program issue an evoke function as the first operation
after an acquire operation. However, if your program
uses BSCEL and you specify RMTBSCEL(*NO) on a
program device entry command, on the CRTDEVBSC
command, or the CHGDEVBSC command, the evoke
function is optional, and the first input or output operation from your program starts the transaction.
If your program uses intrasystem communications and
the evoke function fails, a notify message is sent to
your program with a reason code indicating why it
failed. If your program uses BSCEL and you specify
RMTBSCEL(*YES) and an evoke function fails, both a
notify message and an online message are sent to
your program and your program must issue a read
operation to receive the online message.
Fail Function
When intrasystem communications support receives a
fail function, a return code of 0402 or 0302 is returned
to your program, and you may correct the error indicated and continue sending data. When BSCEL
receives a fail function (an end-of-transmission, or
EOT, indication), a return code of 8197 or 8198 is
returned to your program, and the session is ended.
Number of Sessions
Intrasystem communications allows multiple sessions
per device; BSCEL allows only one session per
device.
Online Messages
Intrasystem communications does not send or receive
any online messages; BSCEL does support online
messages.
Program Start Requests
When using BSCEL, a source program that specifies
RMTBSCEL(*NO) for the communications session
can send data in the proper format for a program start
request with the program’s first output operation.
When using intrasystem communications, your source
program cannot issue a program start request; the
evoke function must be used to start another
program.
Receiving Data
If you are using intrasystem communications, a return
code of 0300 or 832A is used if both your program
and the program with which you are communicating
attempt to receive data at the same time. If you use
BSCEL, both programs will be waiting to receive data
indefinitely.
Receive-Turnaround Indication
If you use intrasystem communications, your program
may receive a turnaround indication on the same read
operation for which your program receives data.
BSCEL sends the turnaround indication as a separate
transmission after the data record is sent. Therefore,
you may need to issue an additional read operation
for BSCEL to receive the turnaround indication.
Record Blocking
Intrasystem communications does not support record
blocking (that is, you cannot specify the BLOCK
parameter on the program device entry commands);
BSCEL does support record blocking.
Record Length
Intrasystem communications supports a maximum
record length of 32767 bytes; BSCEL supports a
maximum record length of 8192 bytes.
Using Intrasystem Communications for
Finance Communications
Finance communications allows programs on an AS/400
system to communicate with programs using the SNA LU
session type 0 protocol. The following considerations apply
when you use intrasystem communications to test programs
to be run using finance communications.
Allow-Write and Request-to-Write Functions
Both intrasystem and finance communications require
that your program either send or receive at any given
time. However, whereas intrasystem communications
uses the allow-write and request-to-write functions as
a way of determining which program should send or
receive, finance communications does not. If you use
finance communications, and neither your program
nor the controller has sent a group of records, a contention state exists, in which either program may
attempt to send. If both the local and the controller
program send at the same time, the controller is designated the sender, and can send a negativeresponse indication to your program. When writing
programs that use finance communications, you need
to be aware of these contention error conditions.
Confirm, End-of-Group, Invite, or Read Functions Specified on Write Operations with Data
Intrasystem communications allows your program to
specify a confirm function on write operations with
data; finance communications does not. However,
finance communications supports a function similar to
the confirm function. When your program issues a
write operation with data, and the end-of-group function is also specified, the data is sent to the finance
controller, and the write operation does not complete
until a response is received from the controller.
If you specify invite or read functions on a write operation with data, however, the data is sent to the
finance controller as if an end-of-group function was
specified, but no response from the finance controller
is required.
Note: Data sent to a 3694 finance controller never
requires a response.
Force-Data Function
Intrasystem communications does not buffer data;
finance communications does. If you use finance
communications, and your program issues a write
operation and this is the first record in a group of
records, the data is sent immediately. However, if
your program sends subsequent records without
specifying a function that closes the group of records
(for example, end-of-group or invite functions or a
read operation), the data may be buffered to be sent
at a later time. Your program can use the force-data
function to ensure that data is sent when the write
operation is issued.
Appendix C. Using Intrasystem Communications to Test Applications
C-3
Number of Sessions
Intrasystem communications allows multiple sessions
per device; finance communications allows only one
session per device.
Read Operations
Intrasystem communications returns 0000 and 0001
return codes on read operations, finance communications does not. If you use finance communications;
your program must receive an entire group of records.
Therefore, your program can only receive the following return codes if the read operation is successful: 0003 (the last record in a group of records
has been received) or 0007 (a group of records was
received with a function management header as the
first record).
Sense Data
Finance communications returns sense data to your
program in an I/O feedback area that is accessible to
your program. Sense data is returned for any operation that fails with an 8319 or 831A return code.
However, intrasystem communications requires that
the user issue an input operation to receive the sense
data.
Write Operations
If you use intrasystem communications, your program
receives an error indication on a write operation if the
error indication is received before the write operation
is issued. When finance communications receives an
error indication before your program issues a write
operation, your program either receives the error indication on the write operation, or is required to issue
an input operation to receive the error indication if the
session is invited.
Using Intrasystem Communications for
Retail Communications
Retail communications allows programs on an AS/400
system to communicate with programs using SNA LU
session type 0 protocol. The following considerations apply
when you use intrasystem communications to test programs
to be run using retail communications.
Sending and Receiving Data
Intrasystem communications is half-duplex, that is,
your program can send or receive data, but cannot do
both at the same time. Retail communications allows
you to acquire sessions with retail controllers using a
Systems Network Architecture (SNA) bind command
that specifies a duplex protocol, that is, you can send
and receive data at the same time. Therefore, when
writing programs that use retail communications, you
should note that it does not support the usual rules
relating to when your program can send or receive
data.
Note: Due to this major difference between intrasystem and retail communications, using intrasystem
C-4
Intrasystem Communications Programming V4R1
communications may not be the most effective way to
test programs that use retail communications.
Confirm, End-of-Group, Invite, or Read Functions Specified on Write Operations with Data
Intrasystem communications allows your program to
specify a confirm function on write operations with
data; retail communications does not. However, retail
communications supports a function similar to the
confirm function. When your program issues a write
operation with data, and the end-of-group function is
also specified, the data is sent to the retail controller,
and the write operation does not complete until a
response is received from the controller.
If you specify invite or read functions on a write operation with data, however, the data is sent to the retail
controller as if an end-of-group function was specified,
but no response from the retail controller is required.
Detach Function
Intrasystem communications allows your program to
send data when using the detach function, but retail
communications does not. In addition, retail communications requires that any partially sent or partially
received group of records be closed before a detach
function is allowed. If any data or error indications
have been received from the retail controller but have
not yet been received by your program, the detach
function fails, and the return code 8322 is returned to
your program.
Evoke Function
When you use intrasystem communications and issue
an evoke function, you must specify the program
name. You may also use, for example, the SECURITY keyword and program initialization parameters,
and specify read operations or functions such as the
invite and function-management-header functions. If
the retail controller program specifies program initialization parameters or security information on the
evoke function, retail communications ignores this
information. If the function-management-header function is specified on an evoke function, retail communications issues an 831E return code.
Force-Data Function
Retail communications buffers data; intrasystem communications does not. If your program issues a write
operation without specifying a function that closes the
group of records (for example, an end-of-group, forcedata, or invite function or a read operation), the data
may be buffered so that it can be sent at a later time.
Specifying any of these functions ensures that all the
data is sent.
Invite Function
If your program sends a group of records and then
issues an invite function, intrasystem communications
closes the group of records that is being sent.
However, retail communications does not; the session
is simply invited.
Note: Retail communications does close a group of
records that your program is sending, however, when
you issue an invite function and it is specified on a
write operation with data.
Number of Sessions
Intrasystem communications allows multiple sessions
per device; retail communications allows only one
session per device.
Read Operations
Intrasystem communications returns a 0001 return
code on a read operation; retail communications does
not. A retail application program can receive one of
the following return codes: 0000 (one record was
received in a group of records); 0003 (the last record
was received or the only record of a group of records
was received); 0005 (the first record of a group of
records was received with a function-managementheader indication); or 0007 (a group of records was
received with function-management-header data as
the first record).
In addition, if you partially send a group of records on
a write operation, and then issue a read operation,
intrasystem communications closes the group of
records. However, retail communications only closes
a group of records on a read operation if it is specified on a write operation with data.
Sense Data
Retail communications returns sense data to your
program in an I/O feedback area that is accessible to
your program. Sense data is returned for any operation that fails with an 8319 or 831A return code.
However, intrasystem communications requires that
the user issue an input operation to receive the sense
data.
Write Operations
Intrasystem communications requires your program to
receive data when data is available to be received.
You cannot also send data while you are receiving.
However, retail communications allows your program
to issue write operations at any time. The only case
in which this is not true is when you receive an error
indication from the remote program.
Using Intrasystem Communications for
Systems Network Architecture Upline
Facility
The SNA upline facility (SNUF) is the communications
support that allows the AS/400 system to communicate with
CICS/VS and IMS/VS application programs on a host
system. The following considerations apply when you use
intrasystem communications to test programs to be run using
Systems Network Architecture upline facility (SNUF).
End-of-Group Function
Intrasystem communications issues a return code of
0003 or 0303 to indicate the end of a group of
records. SNUF issues a major return code of 00 with
minor return codes 01 or 03, or a major return code
03 with minor return codes 01 or 03, depending on
the value specified for the batch parameter on either
the Create Device Description (SNUF)
(CRTDEVSNUF) command or on the ADDICFDEVE
or OVRICFDEVE command.
Evoke Function
Intrasystem communications requires your program to
issue an evoke function after acquiring a session to
start the target program; SNUF does not.
Fail Function
Intrasystem communications can send and receive fail
indications in addition to cancel and negativeresponse indications. If your program receives a fail
function while in the receive state, intrasystem communications returns a 0302 return code. If your
program receives a fail function while in send state,
intrasystem communications returns a 0402 return
code. SNUF cannot receive a fail indication from the
host system, but can receive a cancel or negativeresponse indication, depending on the state of the
transaction. If your program issues a fail function
while in receive state, SNUF sends a negativeresponse indication to the host system. If your
program issues a fail function while in the send state,
SNUF sends a cancel indication to the host system.
Function-Management-Header Data
If a function-management-header indication is
received with data, intrasystem communications
inserts the characters FMH before the data that is
received. SNUF does not insert these characters;
instead, the return code indicates that the functionmanagement-header indication is being received.
Number of Sessions
Intrasystem communications allows multiple sessions
per device, SNUF allows only one session per device.
System Messages
Intrasystem communications does not send or receive
system messages. However, SNUF checks the
received data for system messages, and if they are
received, SNUF issues a major return code 00 with
the following minor return codes: 20, 21, 23, 25, 27,
28, 30, 31, 33, 35, 37, or 38.
Appendix C. Using Intrasystem Communications to Test Applications
C-5
C-6
Intrasystem Communications Programming V4R1
Appendix D. Program Examples
This appendix provides sample programs to demonstrate
how intrasystem communications is used. Program examples for the ILE C/400, C Set ++, COBOL*/400, and
RPG*/400 programming languages are provided with explanations.
In the ILE C/400 program example, both the source and the
target programs are provided to show how an application can
be involved in an interactive inquiry with a single ICF
session. A source program accepts inquiries from a display
device and sends a request to a target program. The source
program communicates with the display device through a
display file, and with the target program through an ICF file.
In the COBOL/400 and RPG/400 program examples, both
source and target programs are provided in an example that
illustrates how an application can be involved in an interactive inquiry with two ICF sessions. A source program
accepts inquiries from a display device and sends a request
to one of two target programs. The source program communicates with the display device through a display file, and
with the two target programs through a single ICF file. The
purpose of the example is to show how a source program
can communicate with two sessions from a single ICF file.
From the viewpoint of each of the two target programs, the
requester is the only session. Therefore, the target programs
do not require any unique logic to support the two-session
source.
For both source and target programs, the DDS source for the
ICF file, program listings, and an explanation of the programs
are provided.
both the display and the ICF files are opened. The work
station is implicitly acquired when the display file opens, but
because the ICF file is created with ACQPGMDEV(*NONE),
no ICF devices are acquired during open processing.
The ICF program device, ICF00, is explicitly acquired by the
source program using the acquire operation. After the
acquire, the source program starts the target program,
through a CL program, using an evoke function. The target
program also explicitly acquires a program device.
The source and target programs use their respective ICF
files with program device ICF00, which is defined as the
default program device from the acquire operation. Both programs will have only one session active at a time.
A customer inquiry prompt is displayed on the work station
by the source program. The source program uses a writewith-invite function to send a number entered by the user to
the target program, and then waits for data to be received
from the target program. The target program reads the
number sent by the source program, and searches a data file
for a customer record based on the number received. If a
record was found, it is sent to the source program; if not, a
fail indication is sent. The source program ends by sending
a detach request to the target program, issuing an end-ofsession operation, and closing the files that were opened.
ILE C/400 Source Program for a
Single-Session Inquiry
The following describes an ILE C/400 source program for a
single-session inquiry.
Description of the Single-Session Inquiry
Program Example
The following explanation describes the transaction between
a source program and a target program, and applies to the
ILE C/400 programs in this appendix.
The source program is started from a display station, and
 Copyright IBM Corp. 1997
Program Files: The ILE C/400 single-session source
program uses the following files:
SRCICFF
An ICF file used to send records to, and
receive records from, the target program.
DSPFIL
A display file used to enter requests that are
to be sent to the target program.
D-1
DDS Source: The DDS for the ICF file (SRCICFF) is illustrated in Figure D-1.
A\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
A\
\
A\
ICF FILE: SRCICFF
\
A\
USED IN INTRASYSTEM ILE C/4ðð PROGRAM EXAMPLES
\
A\
\
A\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
A
INDARA
A
R PGMSTR
A
EVOKE(CEXAMPLES/CTGTPGMCL)
A
SECURITY(2 \USER +
A
3 \USER)
A\
A
R CUST
A
INVITE
A
NUMBER
5
A\
A
R CINFO
A
CUSTNO
5
A
NAME
2ð
A
ADDR
2ð
A
CITY
2ð
A
STATE
2
A
ZIP
5
A
ACCBAL
6
A\
A
R SENDDETACH
A
DETACH
A\
A
R ENDSESSION
A
EOS
Figure D-1. DDS Source for a Single-Session Source Program
Using SRCICFF
The DDS source file for the display file (DSPFIL) is illustrated
in Figure D-2.
A\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
A\
\
A\
DISPLAY FILE: DSPFIL
\
A\
USED IN INTRASYSTEM ILE C/4ðð PROGRAM EXAMPLES
\
A\
\
A\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
A
INDARA
A
DSPSIZ(24 8ð \DS3)
A
PRINT(QSYSPRT)
A
CAð3(ð3 'END OF JOB')
A\
A
R HEADER
A
OVERLAY
A
2 4TIME
A
DSPATR(HI)
A
2 29'Customer Master Inquiry'
A
DSPATR(HI)
A
2 7ðDATE
A
EDTCDE(Y)
A
DSPATR(HI)
A\
A
R FOOT
A
24 4'F3 - End Job'
A
DSPATR(HI)
Figure D-2 (Part 1 of 2). DDS Source for a Single-Session
Source Program Using DSPFIL
A\
A\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
A\ PROMPT CUSTOMER NUMBER SCREEN
A\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
A\
A
R PROMPT
A
A
4
A
A
A
CNUMBR
5A I 4
A
A\
A\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
A\ CUSTOMER INFORMATION SCREEN
A\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
A\
A
R DTLSCR
A
6
A
CUSTNO
5A O 6
A
8
A
NAME
2ðA O 8
A
1ð
A
ADDR
2ðA O 1ð
A
12
A
CITY
2ðA O 12
A
14
A
STATE
2A O 14
A
14
A
ZIP
5A O 14
A
16
A
ACCBAL
6A O 16
OVERLAY
4'Enter Customer Number
(ðððð1 - - 99999)'
DSPATR(HI)
42DSPATR(CS)
RANGE('ðððð1' '99999')
25'Customer Information'
35DSPATR(HI)
25'Name'
35DSPATR(HI)
25'Address'
35DSPATR(HI)
25'City'
35DSPATR(HI)
25'State'
35DSPATR(HI)
41'Zip Code'
5ðDSPATR(HI)
25'Account Balance'
42DSPATR(HI)
Figure D-2 (Part 2 of 2). DDS Source for a Single-Session
Source Program Using DSPFIL
Configuration: The following command is needed to create
the intrasystem communications device associated with the
ICF file:
CRTDEVINTR DEVD(INTRADEV)
RMTLOCNAME(INTRARMT) ONLINE(\NO)
TEXT("THIS IS AN INTRASYSTEM DEVICE
DESCRIPTION")
ICF File Creation and Program Device Entry Definition:
The following command is needed to create the ICF file:
CRTICFF FILE(CEXAMPLES/SRCICFF)
SRCFILE(CEXAMPLES/QDDSSRC) SRCMBR(SRCICFF)
ACQPGMDEV(\NONE) MAXPGMDEV(1)
TEXT("SOURCE ICF FILE FOR SINGLE
SESSION PROGRAM")
It is not necessary to add a communications entry to the subsystem because the system automatically defines an entry
for the device created above when the program is processed.
However, the following command is an example of what you
would use if you decided to add a communications entry:
ADDCMNE
SBSD(QCMN) DEV(INTRADEV)
Note: Subsystem QCMN should be stopped before
ADDCMNE is entered, and then started again.
The following command is needed to define the program
device entry:
OVRICFDEVE PGMDEV(ICFðð) RMTLOCNAME(INTRARMT)
FMTSLT(\PGM)
The following CL program could be used to run the source
program:
D-2
Intrasystem Communications Programming V4R1
PGM PARM(&RMT)
DCL
VAR(&RMT)
TYPE(\CHAR) LEN(8)
CHGJOB
OUTQ(CEXAMPLES/INTOUTQ)
LOG(4 ðð \SECLVL)
LOGCLPGM(\YES)
OVRICFDEVE PGMDEV(ICFðð) RMTLOCNAME(&RMT)
FMTSLT(\PGM)
CALL CEXAMPLES/CSRCPGM
ENDPGM
The following CL program is used to start the target program
evoked by the source program (which calls the program
CTGTPGM shown in the example):
.1ð/
The get_cust_num() function is called to get a customer number from the user using DSPFIL.
.11/
The get_cust_info() function is called to send a customer number to the target program, and then to
receive the customer information if it was found by
the target program.
.12/
The get_cust_num() function gets a customer number
from the user. The program displays the customer
number inquiry, and reads the number.
.13/
The get_cust_info() function sends the customer
number to the target program, and then receives the
customer information sent by the target program.
The customer number is copied into the output buffer
of the ICF file for record format CUST defined in
SRCICFF. CUST is specified on the _Rformat function, and a write is issued to the ICF file. The record
format CINFO defined in SRCICFF to receive the
customer information from the target is specified, and
a read is issued to the ICF file.
PGM
ADDLIBLE
LIB(CEXAMPLES)
OVRICFDEVE PGMDEV(ICFðð)
RMTLOCNAME(\REQUESTER)
CALL PGM(CEXAMPLES/CTGTPGM)
ENDPGM
Program Explanation: The following explains the structure
of the program example illustrated in Figure D-3 on
page D-4. The ICF file used in the example is defined by
the user, and uses externally described data formats (DDS).
The reference numbers in the explanation below correspond
to the numbers in the following program example.
The major return code is checked for a successful
operation. If a 00 major return code is received, the
customer information is displayed by calling the
display_info() function, and control returns to main().
If a 00 major return code was not received, then a
check is made to see if a 0302 or a 0402 return code
was received, indicating that the target program
issued a fail operation because it could not find customer information based on the number sent. If none
of the above return codes is received, then an unexpected error has occurred and the program ends.
All output operations to the ICF file in the example are done
using the write statement with the record format name specified previously with a _Rformat function.
.1/
The display file descriptions (DSPFIL) are included in
the program.
.2/
The ICF file descriptions (SRCICFF) are included in
the program.
.14/
.3/
The routines are defined so the ILE C/400 compiler
knows the type of value returned and the type of
parameters passed, if any.
The display_info() function writes the customer information received from the target program to the work
station.
.15/
The end_job() procedure is called when F3 is pressed
to issue a detach operation to the target program, followed by an end-of-session operation to end the
session.
.16/
The end_error() procedure is called if an error has
occurred in trying to end the session. A detach is not
issued since the target may have ended abnormally.
.17/
The send_eos() procedure issues the end-of-session
operation to the ICF file.
.18/
The pos_resp() function checks for a 00 major return
code in the display/ICF I/O feedback area.
.19/
The fail_rt_cd() function checks for a 0302 or a 0402
return code in the display/ICF I/O feedback area.
.2ð/
The get_access_to_fb() function accesses the
display/ICF I/O feedback area by first accessing the
common I/O feedback area to obtain an offset. The
offset is added to the pointer to the common I/O feedback area to get access to the display/ICF I/O feedback area. The _Riofbk function returns a pointer to
the common I/O feedback area.
.4/
The ICF file is opened for record I/O with the separate indicator area option specified.
.5/
The display file is opened for record I/O with the separate indicator area option specified.
.6/
The separate indicator area is initialized and defined
for DSPFIL. The variable dsp_indic is a 99 character
array.
.7/
Program device ICF00 is explicitly acquired with the
_Racquire function. A session is implicitly acquired
for the work station when DSPFIL is opened.
.8/
The PGMSTR format name is specified and an evoke
operation is performed with the _Rwrite function.
.9/
The program loops until either F3 is pressed from the
work station, which sets an indicator in the display
file’s separate indicator area, or an error occurs in the
transaction with the target program.
Appendix D. Program Examples
D-3
Program name . . .
Library name . .
Source file . . . .
Library name . .
Source member name
Text Description .
Compiler options .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Language level options
Source margins:
Left margin . . . . .
Right margin . . . .
Sequence columns:
Left Column . . . . .
Right Column . . . .
Define name . . . . . .
Generation options . .
:
:
:
:
:
:
:
:
. . . . :
\ \ \ \ \
P R O L O G
CSRCPGM
CEXAMPLES
QCSRC
CEXAMPLES
CSRCPGM
Source C program for Intra
\SOURCE
\NOXREF
\NOSHOWUSR
\NOPPONLY
\NODEBUG
\GEN
\EXTENDED
. . . . :
. . . . :
1
32767
.
.
.
.
.
.
.
1
2
3
4
5
6
7
8
9
1ð
11
12
13
14
15
16
17
18
19
2ð
21
22
23
24
25
26
27
28
29
3ð
31
32
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
:
:
:
:
:
Print file . . . . . . . . . . :
Library name . . . . . . . . :
Message flagging level . . . . :
Compiler message:
Message limit . . . . . . . . :
Message limit severity . . . :
Replace program object . . . . :
User profile . . . . . . . . . :
Authority . . . . . . . . . . . :
Target Release . . . . . . . . :
Last change . . . . . . . . . . :
Source description . . . . . . :
Compiler . . . . . . . . . . . :
Line
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
\NOLIST
\NOANNO
QSYSPRT
\LIBL
ð
\NOXREF
\GEN
\NOMAX
3ð
\YES
\USER
\CHANGE
\CURRENT
9ð/ð8/21 1ð:23:36
Source C program for Intra
IBM ILE C/4ðð Compiler
\ \ \ \ \
S O U R C E
\NOSHOWSYS
\NOSECLVL
\NOSHOWSKP
\PRINT
\NOEXPMAC
\LOGMSG
\NOAGR
\NOATR
\NODUMP
\NOOPTIMIZE \NOALWBND
\ \ \ \ \
STMT
SEQNBR
\...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9........
|#pragma mapinc("dspf/prompt", "cexamples/dspfil(prompt)", "both", "p z")
|
|#pragma mapinc("dspf/dtlscr", "cexamples/dspfil(dtlscr)", "both", "p z")
|
.1/
|#include "dspf/prompt"
|
|#include "dspf/dtlscr"
|
|#pragma mapinc("icff/cust", "cexamples/srcicff(cust)", "output", "p z")
|
|#pragma mapinc("icff/cinfo", "cexamples/srcicff(cinfo)", "input", "p z")
|
.2/
|#include "icff/cust"
|
|#include "icff/cinfo"
|
|/\---------------------------------------------------------------------\/
|
|/\ SOURCE PROGRAM FOR INTRASYSTEM COMMUNICATIONS
\/
|
|/\ This program reads a customer number from the display. The number \/
|
|/\ is sent to the target program, ctgtpgm, which searches a data file \/
|
|/\ for information about the customer. If the information is found,
\/
|
|/\ then the data is received and printed on the display. If no infor- \/
|
|/\ mation is found for the given customer number, then the user is
\/
|
|/\ prompted for another number.
\/
|
|/\---------------------------------------------------------------------\/
|
|
|
|#define NOERROR ð
/\ No error occured \/
|
|#define ERROR 1
/\ An error occured \/
|
|#define NOEND ð
/\ F3 wasn't pressed \/
|
|#define END 1
/\ F3 was pressed, signals end \/
|
|#define OFF 'ð'
/\ Indicator off \/
|
|#define ON '1'
/\ Indicator on \/
|
|#include <stdio.h>
/\ Standard I/O header \/
|
|#include <recio.h>
/\ Record I/O header \/
|
|#include <stddef.h>
/\ Standard definitions \/
|
|#include <stdlib.h>
/\ General utilities \/
|
|#include <string.h>
/\ String handling utilities \/
|
|#include <xxfdbk.h>
/\ Feedback area structures \/
|
|
|
|
|
Figure D-3 (Part 1 of 6). Source Program Example — CSRCPGM
D-4
\ \ \ \ \
Intrasystem Communications Programming V4R1
1
2
3
4
5
6
7
8
9
1ð
11
12
13
14
15
16
17
18
19
2ð
21
22
23
24
25
26
27
28
29
3ð
31
32
INCNO
33
34
35
36
37
38
39
4ð
41
42
43
44
45
46
47
48
49
5ð
51
52
53
Line
54
55
56
57
58
59
6ð
61
62
63
64
65
66
67
68
69
7ð
71
72
73
74
75
76
77
78
79
8ð
81
82
83
84
85
86
87
88
89
9ð
91
92
93
94
95
96
97
98
99
|CEXAMPLES_DSPFIL_PROMPT_both_t prompt_dsp_i;
|CEXAMPLES_DSPFIL_DTLSCR_both_t dtlscr_dsp_o;
|
|CEXAMPLES_SRCICFF_CUST_o_t cust_icf_o;
|CEXAMPLES_SRCICFF_CINFO_i_t cinfo_icf_i;
|
|_XXIOFB_T \comm_fdbk;
/\ Pointer to common I/O feedback \/
|_XXIOFB_DSP_ICF_T \dsp_icf_fdbk;
/\ Pointer to dsp/ICF I/O feedback \/
|_RFILE \icffptr;
/\ Pointer to the ICF file \/
|_RFILE \dspfptr;
/\ Pointer to the display file \/
|.3/
|int get_cust_num(char??(99??));
|int get_cust_info(char??(99??));
|int display_info(char??(99??));
|int pos_resp(void);
|int fail_rt_cd(void);
|void end_job(void);
|void end_error(void);
|void send_eos(void);
|void get_access_to_fb(void);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
STMT
1
2
3
4
5
6
7
8
9
1ð
11
12
13
14
15
16
17
18
\...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9........
|main()
|
|{
|
|
char dsp_indic??(99??);
/\ Display separate indic area \/
|
|
|
|
/\ Open the ICF file \/
|
|.4/
|
|
if ((icffptr=_Ropen("CEXAMPLES/SRCICFF", "ar+ indicators=y riofb=y"))
|
|
== NULL) {
|
|
printf("ICF file failed to open.\n");
|
|
exit(ERROR);
|
|
}
|
|
|
|
/\ Open the display file \/
|
|.5/
|
|
if ((dspfptr=_Ropen("CEXAMPLES/DSPFIL", "ar+ indicators=y riofb=y"))
|
|
== NULL) {
|
|
printf("Display file failed to open.\n");
|
|
_Rclose(icffptr);
|
|
exit(ERROR);
|
|
}
|
|
|
|
/\ Set up separate indicator area space \/
|
|.6/
|
|
memset(dsp_indic, OFF, 99);
|
|
_Rindara(dspfptr, dsp_indic);
|
|
|
|
/\ Acquire a session \/
|
|.7/
|
|
_Racquire(icffptr, "ICFðð");
|
|
if (pos_resp() == ERROR)
|
|
printf("Acquire failed.\n");
|
|
else {
|
|
|
|
/\ Evoke the other program \/
|
|.8/
|
|
_Rformat(icffptr, "PGMSTR");
|
|
_Rwrite(icffptr, NULL, ð);
|
|
|
|
/\ Check if the evoke was successful \/
|
|
|
|
if (pos_resp() == ERROR) {
|
|
printf("Evoke failed.\n");
|
|
end_error();
|
|
return(ERROR);
|
|
}
|
|
|
33
34
35
36
37
38
39
4ð
41
42
43
44
45
46
47
48
49
5ð
51
52
53
SEQNBR
INCNO
54
55
56
57
58
59
6ð
61
62
63
64
65
66
67
68
69
7ð
71
72
73
74
75
76
77
78
79
8ð
81
82
83
84
85
86
87
88
89
9ð
91
92
93
94
95
96
97
98
99
Figure D-3 (Part 2 of 6). Source Program Example — CSRCPGM
Appendix D. Program Examples
D-5
1ðð
1ð1
1ð2
1ð3
1ð4
1ð5
1ð6
1ð7
Line
1ð8
1ð9
11ð
111
112
113
114
115
116
117
118
119
12ð
121
122
123
124
125
126
127
128
129
13ð
131
132
133
134
135
136
137
138
139
14ð
141
142
143
144
145
146
147
148
149
15ð
151
152
153
154
155
156
157
158
159
16ð
161
|
/\ While F3 isn't pressed get the customer number \/
|
|
/\ and display the customer record (if received) \/
|
|.9/
|
19 |
while (dsp_indic??(2??) == OFF) {
|
|
|
|
/\ read the customer number from the display \/
|
|.1ð/
|
2ð |
if (get_cust_num(dsp_indic) == NOEND)
|
STMT
\...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9........
|
|
|
/\ Attempt to get customer information from the \/
|
|
/\ target and display the customer record if found \/
|
|.11/
|
21 |
if (get_cust_info(dsp_indic) == ERROR) {
|
|
|
|
/\ An error occured in the transaction \/
|
|
|
22 |
end_error();
|
23 |
return(ERROR);
|
|
}
|
|
}
|
|
|
|
/\ F3 was pressed, end the session and the job \/
|
|
|
24 |
end_job();
|
|
}
|
25 |
_Rclose(icffptr);
|
26 |
_Rclose(dspfptr);
|
|}
|
|
|
|
|
|/\----------------------------------------------------------------------\/
|
|/\ Get a customer number from the display.
\/
|
|/\----------------------------------------------------------------------\/
|
|.12/
|
|get_cust_num(char dsp_indic??(99??))
|
|{
|
|
/\ Put out display and get information \/
|
|
|
1 |
_Rformat(dspfptr, "HEADER");
|
2 |
_Rwrite(dspfptr, NULL, ð);
|
3 |
_Rformat(dspfptr, "FOOT");
|
4 |
_Rwrite(dspfptr, NULL, ð);
|
5 |
_Rformat(dspfptr, "PROMPT");
|
6 |
_Rwrite(dspfptr, NULL, ð);
|
7 |
memset(dsp_indic, 'ð', 99);
|
8 |
_Rreadn(dspfptr, &prompt_dsp_i, sizeof(prompt_dsp_i), __DFT);
|
|
|
|
/\ Check if F3 (end the job) was pressed \/
|
|
|
9 |
if (dsp_indic??(2??) == OFF)
|
1ð |
return(NOEND);
|
|
else
|
11 |
return(END);
|
|}
|
|
|
|
|
|/\----------------------------------------------------------------------\/
|
|/\ Evoke the target program, and then send the customer number to the
\/
|
|/\ target. The target program should either send a customer record or \/
|
|/\ a fail indication (customer not in data file). The record is dis\/
|
|/\ played with a call to display_info.
\/
|
|/\----------------------------------------------------------------------\/
|
Figure D-3 (Part 3 of 6). Source Program Example — CSRCPGM
D-6
Intrasystem Communications Programming V4R1
1ðð
1ð1
1ð2
1ð3
1ð4
1ð5
1ð6
1ð7
SEQNBR
1ð8
1ð9
11ð
111
112
113
114
115
116
117
118
119
12ð
121
122
123
124
125
126
127
128
129
13ð
131
132
133
134
135
136
137
138
139
14ð
141
142
143
144
145
146
147
148
149
15ð
151
152
153
154
155
156
157
158
159
16ð
161
INCNO
Line
162
163
164
165
166
167
168
169
17ð
171
172
173
174
175
176
177
178
179
18ð
181
182
183
184
185
186
187
188
189
19ð
191
192
193
194
195
196
197
198
199
2ðð
2ð1
2ð2
2ð3
2ð4
2ð5
2ð6
2ð7
2ð8
2ð9
21ð
211
212
213
214
215
Line
216
217
218
219
22ð
221
222
223
224
225
226
227
228
229
STMT
1
2
3
4
5
6
7
8
9
1ð
11
12
13
14
1
2
3
4
\...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9........
|.13/
|
|get_cust_info(char dsp_indic??(99??))
|
|{
|
|
/\ Put number in ICF file and send it to the other program \/
|
|
|
|
strncpy(cust_icf_o.NUMBER, prompt_dsp_i.CNUMBR, 5);
|
|
_Rformat(icffptr, "CUST");
|
|
_Rwrite(icffptr, &cust_icf_o, sizeof(cust_icf_o));
|
|
|
|
/\ Check if the number was sent successfully \/
|
|
|
|
if (pos_resp() == ERROR) {
|
|
printf("Unexpected error in transaction.\n");
|
|
return(ERROR);
|
|
}
|
|
|
|
/\ Read the customer information \/
|
|
|
|
_Rformat(icffptr, "CINFO");
|
|
_Rreadn(icffptr, &cinfo_icf_i, sizeof(cinfo_icf_i), __DFT);
|
|
|
|
/\ Check if the record was returned, and if so print it on the \/
|
|
/\ display, or the fail indicator may have been received from \/
|
|
/\ the target program if the record wasn't found.
\/
|
|
|
|
if (pos_resp() == NOERROR)
|
|
|
|
/\ Display the record, and then return to main with the value \/
|
|
/\ returned from display_info.
\/
|
|
|
|
return(display_info(dsp_indic));
|
|
else
|
|
if (fail_rt_cd() == NOERROR)
|
|
return(NOERROR);
|
|
else {
|
|
printf("Unexpected error in transaction.\n");
|
|
return(ERROR);
|
|
}
|
|}
|
|
|
|
|
|/\----------------------------------------------------------------------\/
|
|/\ Display the customer information.
\/
|
|/\----------------------------------------------------------------------\/
|
|.14/
|
|display_info(char dsp_indic??(99??))
|
|{
|
|
/\ Put out header and footing on display \/
|
|
|
|
_Rformat(dspfptr, "HEADER");
|
|
_Rwrite(dspfptr, NULL, ð);
|
|
_Rformat(dspfptr, "FOOT");
|
|
_Rwrite(dspfptr, NULL, ð);
|
|
|
STMT
5
6
7
8
9
1ð
11
12
13
14
15
\...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9........
|
/\ Put out display of customer information \/
|
|
|
|
_Rformat(dspfptr, "DTLSCR");
|
|
strncpy(dtlscr_dsp_o.CUSTNO, cinfo_icf_i.CUSTNO, 5);
|
|
strncpy(dtlscr_dsp_o.NAME, cinfo_icf_i.NAME, 2ð);
|
|
strncpy(dtlscr_dsp_o.ADDR, cinfo_icf_i.ADDR, 2ð);
|
|
strncpy(dtlscr_dsp_o.CITY, cinfo_icf_i.CITY, 2ð);
|
|
strncpy(dtlscr_dsp_o.STATE, cinfo_icf_i.STATE, 2);
|
|
strncpy(dtlscr_dsp_o.ZIP, cinfo_icf_i.ZIP, 5);
|
|
strncpy(dtlscr_dsp_o.ACCBAL, cinfo_icf_i.ACCBAL, 6);
|
|
_Rwrite(dspfptr, &dtlscr_dsp_o, sizeof(dtlscr_dsp_o));
|
|
memset(dsp_indic, 'ð', 99);
|
|
_Rreadn(dspfptr, NULL, ð, __DFT);
|
|
|
SEQNBR
INCNO
162
163
164
165
166
167
168
169
17ð
171
172
173
174
175
176
177
178
179
18ð
181
182
183
184
185
186
187
188
189
19ð
191
192
193
194
195
196
197
198
199
2ðð
2ð1
2ð2
2ð3
2ð4
2ð5
2ð6
2ð7
2ð8
2ð9
21ð
211
212
213
214
215
SEQNBR
INCNO
216
217
218
219
22ð
221
222
223
224
225
226
227
228
229
Figure D-3 (Part 4 of 6). Source Program Example — CSRCPGM
Appendix D. Program Examples
D-7
23ð
231
232
233
234
235
236
237
238
239
24ð
241
242
243
244
245
246
247
248
249
25ð
251
252
253
254
255
256
257
258
259
26ð
261
262
263
264
265
266
267
268
269
Line
27ð
271
272
273
274
275
276
277
278
279
28ð
281
282
283
284
285
286
287
288
289
29ð
291
292
293
294
295
296
297
298
299
3ðð
3ð1
3ð2
3ð3
3ð4
16
17
18
1
2
3
1
2
3
|
/\ Check if F3 (end the job) was pressed \/
|
|
if (dsp_indic??(2??) == OFF)
|
return(NOEND);
|
else
|
return(END);
|}
|
|
|/\----------------------------------------------------------------------\/
|/\ F3 was pressed, end the job.
\/
|/\----------------------------------------------------------------------\/
|.15/
|void end_job()
|{
|
/\ Issue a detach to the target program, then end the session \/
|
|
_Rformat(icffptr, "SENDDETACH");
|
_Rwrite(icffptr, NULL, ð);
|
send_eos();
|}
|
|
|/\----------------------------------------------------------------------\/
|/\ Error, clean up.
\/
|/\----------------------------------------------------------------------\/
|.16/
|void end_error()
|{
|
send_eos();
|
_Rclose(icffptr);
|
_Rclose(dspfptr);
|}
|
|
|/\----------------------------------------------------------------------\/
|/\ Issue an end of session operation.
\/
|/\----------------------------------------------------------------------\/
|.17/
|void send_eos()
STMT
1
2
1
2
3
4
1
2
3
4
\...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9........
|{
|
|
_Rformat(icffptr, "ENDSESSION");
|
|
_Rwrite(icffptr, NULL, ð);
|
|}
|
|
|
|
|
|/\----------------------------------------------------------------------\/
|
|/\ Check the major return code for a successful operation - ðð.
\/
|
|/\----------------------------------------------------------------------\/
|
|.18/
|
|pos_resp()
|
|{
|
|
get_access_to_fb();
|
|
if (strncmp(dsp_icf_fdbk->major_ret_code, "ðð", 2) == ð)
|
|
return(NOERROR);
|
|
else
|
|
return(ERROR);
|
|}
|
|
|
|
|
|/\----------------------------------------------------------------------\/
|
|/\ Check the major/minor return code for a fail - ð3ð2 or ð4ð2.
\/
|
|/\----------------------------------------------------------------------\/
|
|.19/
|
|fail_rt_cd()
|
|{
|
|
get_access_to_fb();
|
|
if ((strncmp(dsp_icf_fdbk->major_ret_code, "ð3", 2) == ð ||
|
|
strncmp(dsp_icf_fdbk->major_ret_code, "ð4", 2) == ð) &&
|
|
strncmp(dsp_icf_fdbk->minor_ret_code, "ð2", 2) == ð)
|
|
return(NOERROR);
|
|
else
|
|
return(ERROR);
|
|}
|
|
|
Figure D-3 (Part 5 of 6). Source Program Example — CSRCPGM
D-8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Intrasystem Communications Programming V4R1
23ð
231
232
233
234
235
236
237
238
239
24ð
241
242
243
244
245
246
247
248
249
25ð
251
252
253
254
255
256
257
258
259
26ð
261
262
263
264
265
266
267
268
269
SEQNBR
27ð
271
272
273
274
275
276
277
278
279
28ð
281
282
283
284
285
286
287
288
289
29ð
291
292
293
294
295
296
297
298
299
3ðð
3ð1
3ð2
3ð3
3ð4
INCNO
3ð5
3ð6
3ð7
3ð8
3ð9
31ð
311
312
313
314
315
|
|/\----------------------------------------------------------------------\/
|/\ Get access to the display/ICF feedback area.
\/
|/\----------------------------------------------------------------------\/
|.2ð/
|void get_access_to_fb()
|{
1 |
comm_fdbk = _Riofbk(icffptr);
|
dsp_icf_fdbk = (_XXIOFB_DSP_ICF_T \)((char \)comm_fdbk +
2 |
comm_fdbk->file_dep_fb_offset);
|}
\ \ \ \ \
E N D
O F
S O U R C E
\ \ \ \ \
|
|
|
|
|
|
|
|
|
|
|
3ð5
3ð6
3ð7
3ð8
3ð9
31ð
311
312
313
314
315
Figure D-3 (Part 6 of 6). Source Program Example — CSRCPGM
ILE C/400 Target Program for a
Single-Session Inquiry
The following describes an ILE C/400 target program for a
single-session inquiry.
Program Files: The ILE C/400 single-session target
program uses the following files:
TGTICFF
CUSMSTP
CUSMSTL
An ICF file used to send records to, and
receive records from, the source program. It
is done with the file-level INDARA DDS
keyword, indicating a separate indicator area.
A physical file that contains customer records
to be sent to the source program.
A logical file used with CUSMSTP to access
the customer records.
DDS Source: The DDS for the ICF file (TGTICFF) is illustrated in Figure D-4.
A\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
A\
\
A\
ICF FILE: TGTICFF
\
A\
USED BY INTRASYSTEM ILE C/4ðð PROGRAM EXAMPLES
\
A\
\
A\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
A
INDARA
A
R CUST
A
NUMBER
5
A\
A
R CINFO
A
INVITE
A
CUSTNO
5
A
NAME
2ð
A
ADDR
2ð
A
CITY
2ð
A
STATE
2
A
ZIP
5
A
ACCBAL
6
A\
A
R NOCUST
A
FAIL
A\
A
R ENDSESSION
A
EOS
Figure D-4. DDS Source for a Single-Session Target Program
Using TGTICFF
The DDS source for the database file (CUSMSTP) is illustrated in Figure D-5.
A\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
A\
\
A\
PHYSICAL FILE: CUSMSTP
\
A\
USED TO CONTAIN CUSTOMER RECORDS FOR
\
A\
INTRASYSTEM ILE C/4ðð PROGRAM EXAMPLES
\
A\
\
A\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
A
R CUSREC
TEXT('Customer record')
A
PCUST
5
TEXT('Customer number')
A
PNAME
2ð
TEXT('Customer name')
A
PADDR
2ð
TEXT('Customer address')
A
PCITY
2ð
TEXT('Customer city')
A
PSTATE
2
TEXT('Customer state')
A
PZIP
5
TEXT('Customer zip code')
A
PACCBL
6
TEXT('Accounts receivable
balance')
Figure D-5. DDS Source for a Single-Session Source Program
Using CUSMSTP
The DDS source for the logical file (CUSMSTL) is illustrated
in Figure D-6.
A\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
A\
\
A\
LOGICAL FILE: LGCMSTF FOR
\
A\ CUSMSTP USED IN INTRASYSTEM ILE C/4ðð PROGRAM EXAMPLES \
A\
\
A\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
A
UNIQUE
A
R CUSREC
PFILE(CUSMSTP)
A
K PCUST
Figure D-6. DDS Source for a Single-Session Target Program
Using LGCMSTF
ICF File Creation and Program Device Entry Definition:
The following command is needed to create the ICF file:
CRTICFF FILE(CEXAMPLES/TGTICFF)
SRCFILE(CEXAMPLES/QDDSSRC)
SRCMBR(SRCICFF)
ACQPGMDEV(\NONE)
TEXT("TARGET ICF FILE FOR SINGLE
SESSION PROGRAM")
The following command is needed to define the program
device entry:
OVRICFDEVE PGMDEV(ICFðð)
RMTLOCNAME(\REQUESTER)
Program Explanation: The following explains the structure
of the program example illustrated in Figure D-7 on
page D-11. The ICF file used in the example is defined by
the user, and uses externally described data formats (DDS).
The reference letters in the example below correspond to
those in the following program example.
.1/
The database logical file descriptions (CUSMSTL) are
included in the program.
.2/
The ICF file descriptions (TGTICFF) are included in
the program.
Appendix D. Program Examples
D-9
.3/
The routines are defined so the ILE C/400 compiler
knows the type of value returned and the type of
parameters passed, if any.
.4/
The ICF file is opened for record I/O with the separate indicator area option specified.
.9/
The send_eos() procedure issues an end-of-session
operation to the ICF file to end the session.
.5/
The database logical file is opened for record input.
If an error occurs, the ICF file is closed and the
program ends.
.1ð/
.6/
The ICF00 program device is explicitly acquired with
the _Racquire function.
.7/
The program loops until either a detach is received,
or an error occurs in the transaction with the source
program.
The pos_resp() checks for a 00 major return code.
The return code is obtained by accessing the
common I/O feedback area to get a pointer to the
display/ICF I/O feedback area. A pointer to the
common I/O feedback area is returned from the
QXXIOFBK function. The offset to the display/ ICF
I/O feedback area is added to the common I/O feedback area pointer to get a pointer to the display/ICF
I/O feedback area.
.8/
The process_data() function receives a customer
number from the source program, reads the database
file using the number as the key, and either returns
D-10
Intrasystem Communications Programming V4R1
customer data to the source program or issues a fail
operation to tell the other program that customer
information could not be found for the given number.
Program name . . .
Library name . .
Source file . . . .
Library name . .
Source member name
Text Description .
Compiler options .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Language level options
Source margins:
Left margin . . . . .
Right margin . . . .
Sequence columns:
Left Column . . . . .
Right Column . . . .
Define name . . . . . .
Generation options . .
:
:
:
:
:
:
:
:
. . . . :
\ \ \ \ \
P R O L O G
CTGTPGM
CEXAMPLES
QCSRC
CEXAMPLES
CTGTPGM
Target C program for Intra
\SOURCE
\NOXREF
\NOSHOWUSR
\NOPPONLY
\NODEBUG
\GEN
\EXTENDED
. . . . :
. . . . :
1
32767
.
.
.
.
.
.
.
1
2
3
4
5
6
7
8
9
1ð
11
12
13
14
15
16
17
18
19
2ð
21
22
23
24
25
26
27
28
29
3ð
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
:
:
:
:
:
Print file . . . . . . . . . . :
Library name . . . . . . . . :
Message flagging level . . . . :
Compiler message:
Message limit . . . . . . . . :
Message limit severity . . . :
Replace program object . . . . :
User profile . . . . . . . . . :
Authority . . . . . . . . . . . :
Target Release . . . . . . . . :
Last change . . . . . . . . . . :
Source description . . . . . . :
Compiler . . . . . . . . . . . :
Line
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
\NOLIST
\NOANNO
QSYSPRT
\LIBL
ð
\NOXREF
\GEN
\NOMAX
3ð
\YES
\USER
\CHANGE
\CURRENT
9ð/ð9/11 ð8:52:ðð
Target C program for Intra
IBM ILE C/4ðð Compiler
\ \ \ \ \
S O U R C E
\ \ \ \ \
\NOSHOWSYS
\NOSECLVL
\NOSHOWSKP
\PRINT
\NOEXPMAC
\LOGMSG
\NOAGR
\NOATR
\NODUMP
\NOOPTIMIZE \NOALWBND
\ \ \ \ \
STMT
SEQNBR
\...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9........
|#pragma mapinc("dbf", "cexamples/cusmstl(\all)", "input", "p z")
|
|#pragma mapinc("icff/cust", "cexamples/tgticff(cust)", "input", "p z")
|
|#pragma mapinc("icff/cinfo", "cexamples/tgticff(cinfo)", "output", "p z")
|
.1/
|#include "dbf"
|
.2/
|#include "icff/cust"
|
|#include "icff/cinfo"
|
|/\----------------------------------------------------------------------\/
|
|/\ TARGET PROGRAM FOR INTRASYSTEM COMMUNICATIONS
\/
|
|/\ This program receives a customer number from the source program and \/
|
|/\ searches a data base file for customer information. If a record is \/
|
|/\ found, it is sent to the source program, otherwise a fail indication \/
|
|/\ is sent. This program waits for a detach from the source program
\/
|
|/\ to end.
\/
|
|/\----------------------------------------------------------------------\/
|
|
|
|#define NOERROR ð
/\ No error occurred \/
|
|#define ERROR 1
/\ An error occurred \/
|
|#include <stdio.h>
/\ Standard I/O header \/
|
|#include <recio.h>
/\ Record I/O header \/
|
|#include <stddef.h>
/\ Standard definitions \/
|
|#include <stdlib.h>
/\ General utilities \/
|
|#include <string.h>
/\ String handling utilities \/
|
|#include <xxfdbk.h>
/\ Feedback area structures \/
|
|
|
|
|
|CEXAMPLES_CUSMSTL_CUSREC_i_t cusrec_dbf_i;
|
|
|
|CEXAMPLES_TGTICFF_CUST_i_t cust_icf_i;
|
|CEXAMPLES_TGTICFF_CINFO_o_t cinfo_icf_o;
|
|
|
INCNO
1
2
3
4
5
6
7
8
9
1ð
11
12
13
14
15
16
17
18
19
2ð
21
22
23
24
25
26
27
28
29
3ð
Figure D-7 (Part 1 of 3). Target Program Example — CTGTPGM
Appendix D. Program Examples
D-11
31
32
33
34
35
36
37
38
39
4ð
41
42
43
44
45
46
47
48
49
5ð
51
52
53
Line
1
2
3
4
5
|_XXIOFB_T \comm_fdbk;
/\ Ptr to common I/O feedback \/
|_XXIOFB_DSP_ICF_T \dsp_icf_fdbk;
/\ Ptr to dsp/ICF I/O feedback \/
|_RFILE \icffptr;
/\ Ptr to the ICF file \/
|_RFILE \dbfptr;
/\ Ptr to the database file \/
|.3/
|int process_data(void);
|void send_eos(void);
|int pos_resp(void);
|
|main()
|{
|
/\ Open the the ICF file \/
|.4/
|
if ((icffptr = _Ropen("CEXAMPLES/TGTICFF", "ar+ indicators=y riofb=y"))
|
== NULL)
|
exit(ERROR);
|
|
/\ Open the the datbase file \/
|.5/
|
if ((dbfptr = _Ropen("CEXAMPLES/CUSMSTL", "rr riofb=y")) == NULL) {
|
_Rclose(icffptr);
|
exit(ERROR);
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
STMT
31
32
33
34
35
36
37
38
39
4ð
41
42
43
44
45
46
47
48
49
5ð
51
52
53
SEQNBR
\...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9........
54
55
56
57
58
59
6ð
61
62
63
64
65
66
67
68
69
7ð
71
72
73
74
75
76
77
78
79
8ð
81
82
83
84
85
86
87
88
89
9ð
91
92
93
6
7
8
9
1ð
11
1
2
|
|
/\ Acquire a session \/
|.6/
|
_Racquire(icffptr, "ICFðð");
|
|
/\ Check that the acquire was successful and get the record \/
|
|
if (pos_resp() == NOERROR) {
|
|
/\ Keep processing numbers until detach or eos is received \/
|.7/
|
while (process_data() == NOERROR)
|
;
|
send_eos();
|
}
|
|
/\ Close the ICF file \/
|
|
_Rclose(icffptr);
|}
|
|
|/\----------------------------------------------------------------------\/
|/\ This routine will get a customer number from the source program and \/
|/\ attempt to find the corresponding record in the physical file CUSMSTP\/
|/\ (by using logical file CUSMSTL). The file is searched using the
\/
|/\ customer number received as the key. If the record was found, it
\/
|/\ is sent to the source program, if not a fail is sent.
\/
|/\----------------------------------------------------------------------\/
|.8/
|process_data()
|{
|
_RIOFB_T \rio_fdbk;
/\ Ptr to partial I/O feedback \/
|
|
_Rformat(icffptr, "CUST");
|
_Rreadn(icffptr, &cust_icf_i, sizeof(cust_icf_i), __DFT);
|
|
/\ Check if the read was successful, and if so find the \/
|
/\ record in the data file searching by key
\/
|
Figure D-7 (Part 2 of 3). Target Program Example — CTGTPGM
D-12
Intrasystem Communications Programming V4R1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54
55
56
57
58
59
6ð
61
62
63
64
65
66
67
68
69
7ð
71
72
73
74
75
76
77
78
79
8ð
81
82
83
84
85
86
87
88
89
9ð
91
92
93
INCNO
94
95
96
97
98
99
1ðð
1ð1
1ð2
1ð3
1ð4
1ð5
1ð6
1ð7
Line
1ð8
1ð9
11ð
111
112
113
114
115
116
117
118
119
12ð
121
122
123
124
125
126
127
128
129
13ð
131
132
133
134
135
136
137
138
139
14ð
141
142
143
144
145
146
147
148
149
15ð
151
152
153
154
155
156
157
158
159
16ð
3 |
|
|
|
|
4 |
|
|
|
5 |
|
|
|
6 |
STMT
7
8
9
1ð
11
12
13
14
15
16
17
18
1
2
1
2
3
4
5
if (pos_resp() == NOERROR) {
/\ Read record from database file \/
rio_fdbk = _Rreadk(dbfptr, &cusrec_dbf_i, sizeof(cusrec_dbf_i),
__KEY_EQ, cust_icf_i.NUMBER, 5);
/\ Check to see if the record was found \/
if (rio_fdbk->num_bytes != ð) {
/\ Send the customer information to the source program \/
memcpy(cinfo_icf_o.CUSTNO, cusrec_dbf_i.PCUST, 5);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
\...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9........
|
memcpy(cinfo_icf_o.NAME, cusrec_dbf_i.PNAME, 2ð);
|
|
memcpy(cinfo_icf_o.ADDR, cusrec_dbf_i.PADDR, 2ð);
|
|
memcpy(cinfo_icf_o.CITY, cusrec_dbf_i.PCITY, 2ð);
|
|
memcpy(cinfo_icf_o.STATE, cusrec_dbf_i.PSTATE, 2);
|
|
memcpy(cinfo_icf_o.ZIP, cusrec_dbf_i.PZIP, 5);
|
|
memcpy(cinfo_icf_o.ACCBAL, cusrec_dbf_i.PACCBL, 6);
|
|
_Rformat(icffptr, "CINFO");
|
|
_Rwrite(icffptr, &cinfo_icf_o, sizeof(cinfo_icf_o));
|
|
}
|
|
else {
|
|
|
|
/\ Customer record was not found, send a fail \/
|
|
|
|
_Rformat(icffptr, "NOCUST");
|
|
_Rwrite(icffptr, NULL, ð);
|
|
}
|
|
|
|
/\ Check for successful return code \/
|
|
|
|
return(pos_resp());
|
|
}
|
|
/\ A detach was received, or a transaction error occurred. \/
|
|
/\ Return error to main so the program can end.
\/
|
|
|
|
return(ERROR);
|
|}
|
|
|
|
|
|/\----------------------------------------------------------------------\/
|
|/\ Issue an end of session operation.
\/
|
|/\----------------------------------------------------------------------\/
|
|.9/
|
|void send_eos()
|
|{
|
|
_Rformat(icffptr, "ENDSESSION");
|
|
_Rwrite(icffptr, NULL, ð);
|
|}
|
|
|
|
|
|/\----------------------------------------------------------------------\/
|
|/\ Check the major return code for a successful operation - ðð.
\/
|
|/\----------------------------------------------------------------------\/
|
|.1ð/
|
|pos_resp()
|
|{
|
|
comm_fdbk = _Riofbk(icffptr);
|
|
dsp_icf_fdbk = (_XXIOFB_DSP_ICF_T \)((char \)comm_fdbk +
|
|
comm_fdbk->file_dep_fb_offset);
|
|
if (strncmp(dsp_icf_fdbk->major_ret_code, "ðð", 2) == ð)
|
|
return(NOERROR);
|
|
else
|
|
return(ERROR);
|
|}
|
\ \ \ \ \
E N D
O F
S O U R C E
\ \ \ \ \
94
95
96
97
98
99
1ðð
1ð1
1ð2
1ð3
1ð4
1ð5
1ð6
1ð7
SEQNBR
INCNO
1ð8
1ð9
11ð
111
112
113
114
115
116
117
118
119
12ð
121
122
123
124
125
126
127
128
129
13ð
131
132
133
134
135
136
137
138
139
14ð
141
142
143
144
145
146
147
148
149
15ð
151
152
153
154
155
156
157
158
159
16ð
Figure D-7 (Part 3 of 3). Target Program Example — CTGTPGM
Appendix D. Program Examples
D-13
Description of the Two-Session Inquiry
Program Example
The following explanation describes the transaction between
a source program and two target programs, and applies to
the COBOL/400 and RPG/400 programs in this appendix.
The source program is started from a display station, and
both the display and ICF files are opened. The work station
is implicitly acquired when the display file opens, but
because the ICF file is created with ACQPGMDEV(*NONE),
no ICF devices are acquired during open processing.
The main menu, with a record format CIMENU, is written to
the display station and the program waits for a request from
the display station. Based on the request made from the
display station, the source program uses a write-with-invite
function to send an inquiry request to one of the target programs. The target program then sends a reply to the inquiry
using a read operation. Finally, the source program sends a
detach request and ends the session.
COBOL/400 Source Program for a
Two-Session Inquiry
The two ICF program devices, ICF00 and ICF01, must be
explicitly acquired by the source program using the acquire
operation. The source program then starts the two target
programs using an evoke function.
The following describes a COBOL/400 source program for a
two-session inquiry.
The source program uses a specific program device name.
Each target program uses an ICF file with a program device
name that is associated with the requesting program device.
The target program’s only session is the one used to communicate with the source program. When the target program
is started, the ICF file is implicitly opened if you are using the
RPG/400 language support. However, if you are using the
COBOL/400 language support, you need to open the ICF file
explicitly using the open operation. Because the file is
created with the requesting program device specified on the
ACQPGMDEV parameter, the requesting program device is
acquired when the ICF file is opened.
INTFIL
An ICF file used to send records to and receive
records from the target program.
DSPFIL
A display file used to enter requests that are to
be sent to the target program.
QPRINT
An AS/400 printer file used to print records, both
sent and received, as well as major and minor
ICF return codes.
DFILE
An output file that is used to assist in problem
analysis for non-recoverable session errors.
D-14
Intrasystem Communications Programming V4R1
Program Files: The COBOL/400 two-session source
program uses the following files:
DDS Source: The DDS for the ICF file (INTFIL) is illustrated in Figure D-8.
5714PW1 Rð1Mðð 88ð3ð1
SEU SOURCE LISTING
1ð/14/87 17:2ð:41
SOURCE FILE . . . . . . . QINTSRC/INTLIB
MEMBER . . . . . . . . . INTFIL
SEQNBR\...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8 ...+... 9 ...+... ð
A\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
A\
\
A\
ICF FILE
\
A\
USED IN SOURCE TWO SESSION PROGRAM
\
A\
\
A\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
A
INDARA
A
RCVFAIL(25 'RECEIVED FAIL')
A
RCVTRNRND(9ð)
A
R ITMRSP
A
RECID(1 'I')
A
RECITM
1
A
ITEMNO
6 ð
A
DESC
3ð
A
QTYLST
7 ð
A
QTYOH
7 ð
A
QTYOO
7 ð
A
QTYBO
7 ð
A
UNITQ
2
A
PRð1
7 2
A
PRð5
7 ð
A
UFRT
5 2
A
SLSTM
9 2
A
SLSTY
11 2
A
CSTTM
9 2
A
CSTTY
11 2
A
PRO
5 2
A
LOS
9 2
A
FILL1
56
A
R DTLRSP
A
RECID(1 'C')
A
RECCUS
1
A
CUSTNO
6 ð
A
DNAME
3ð
A
DLSTOR
6 ð
A
DSLSTM
9 ð
A
DSPMð1
9 ð
A
DSPMð2
9 ð
A
DSPMð3
9 ð
A
DSTTYD
11 ð
A
IDEPT
3 ð
A
FILL2
57
A
R DETACH
A
DETACH
A
R EOS
A
EOS
A
R EVKREQ
A
EVOKE(&LIB/&PGMID)
A
PGMID
1ðA P
A
LIB
1ðA P
A
R ITMREQ
A
INVITE
A
ITEMNO
6 ð
A
R DTLREQ
A
INVITE
A
CUSTNO
6 ð
A
R TIMER
A
TIMER(ðððð3ð)
PAGE 1
Figure D-8. DDS Source for a Two-Session Source Program Using INTFIL
Appendix D. Program Examples
D-15
The DDS source file for the display file (DSPFIL) is illustrated
in Figure D-9.
5714PW1 Rð1Mðð 88ð3ð1
SEU SOURCE LISTING
1ð/14/87 16:59:5ð
SOURCE FILE . . . . . . . QINTSRC/INTLIB
MEMBER . . . . . . . . . DSPFIL
SEQNBR\...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8 ...+... 9 ...+... ð
A\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
A\
\
A\
DISPLAY FILE
\
A\
USED IN SOURCE TWO SESSION PROGRAM
\
A\
\
A\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
A\ BEGINNING MENU
A\\\\\\\\\\\\\\\\\\\\
A
DSPSIZ(\DS3)
A
CFð1(99) CFð2(98) CFð3(97)
A
R CIMENU
TEXT('MENU FOR INQUIRY')
A
1 34'INQUIRY MENU'
A
3 1'Select one of the following:'
A
4 3'1. Order inquiry'
A
5 3'2. Buyer inquiry'
A
11 1'Option:'
A
OPTION
1N I 11 9VALUES('1' '2')
A
19 5DFT('CMD KEY 1 - END ')
A
R DTLMNU
TEXT('
BUYER INQUIRY SCREEN 1')
A
2 2DFT('ENTER BUYER')
A
CUSTNO
6N ðI 2 2ð
A
19 5DFT('CMD KEY 1 - END ')
A
19 23DFT(' 2 - MAIN MENU ')
A\
A\\\\\\\\\\\\\\\\\\\\\\\\\\\\
A\ CUSTOMER INQUIRY SCREEN
A\\\\\\\\\\\\\\\\\\\\\\\\\\\\
A
R DTLSCR
TEXT('
BUYER INQUIRY SCR. #2')
A
1 3DFT('BUYER DPT LAST ORD
& THIS
+
A
$MTH1
&MTH2
$MTH3
THIS+
A
YTD CNAME')
A
CUSTN
6N
2 2
A
DEPT
3N ð
2 9
A
DLSTR
6N ð
2 13
A
DSLSM
9N ð
2 22
A
DSPM1
9N ð
2 32
A
DSPM2
9N ð
2 42
A
DSPM3
9N ð
2 52
A
DSTYD
11N ð
2 62
A
CNAME
5
2 74
A
19 5DFT('CMD KEY 1 - END ')
A
19 23DFT(' 2 - MAIN MENU ')
A\
A\\\\\\\\\\\\\\\\\\\\\\\\
A\ ITEM INQUIRY SCREEN
A\\\\\\\\\\\\\\\\\\\\\\\\
A
R ITMMNU
TEXT('ITEM INQUIRY SCREEN ONE')
A
2 2DFT('ENTER ITEM NUMBER')
A
ITEMNO
6N ðI 2 2ð
A
19 5DFT('CMD KEY 1 - END ')
A
19 23DFT(' 2 - MAIN MENU ')
A\\\\\\\\\\\\\\\\\\\\\\\\
A\ ITEM DISPLAY
A\\\\\\\\\\\\\\\\\\\\\\\\
A
R ITMSC2
TEXT('ITEM INQUIRY SCREEN TWO') OVE+
A
RLAY
A
4 2DFT('DESC-')
A
DSC
3ð
4 8
A
5 2DFT('QUANTITY AVAILABLE')
A
QAVAIL
7N ð
5 25
A
6 11DFT('ON HAND')
A
QTYH
7N ð
6 25
A
7 11DFT('ON ORDER')
Figure D-9 (Part 1 of 2). DDS for Source Program Two-Session Inquiry Using DSPFIL
D-16
Intrasystem Communications Programming V4R1
PAGE 1
A
QTYO
7N
A
A
QTYB
7N
A
A
UNT
2
A
A
PR1
7Y
A
A
PR5
7Y
A
A
UFR
5Y
A
A
A
A
A\\\\\\\\\\\\\\\\\\\\\\\\\\\\
A\ ITEM ADDITIONAL DISPLAY
A\\\\\\\\\\\\\\\\\\\\\\\\\\\\
A
R ITMSC3
A
A
A
SLSM
9Y
A
A
SLSY
11Y
A
A
CSTM
9Y
A
A
CSTY
11Y
A
A
PROFIT
5Y
A
A
LOSTS
9Y
A
A
A\\\\\\\\\\\\\\\\\\\\\\\\
A\
TIMOUT SCREEN.
A\\\\\\\\\\\\\\\\\\\\\\\\
A
R TIMOUT
A
A
A
A
TIMRSP
1
ð
ð
2
ð
2
2
2
2
2
2
2
7
8
8
9
9
1ð
1ð
11
11
12
12
13
19
19
19
25
11DFT('BACK ORDER')
25
2DFT('UNIT OF MEASURE')
3ð
2DFT('PRICE PER UNIT')
24EDTCDE(3)
8DFT('QUANTITY')
25EDTCDE(3)
8DFT('FREIGHT')
26EDTCDE(3)
32DFT('MORE... ')
5DFT('CMD KEY 1 - END ')
23DFT(' 2 - MAIN MENU ')
4ðDFT(' 3 - BUYER MENU')
5
5
6
6
7
7
8
8
9
9
1ð
1ð
19
19
TEXT('ITEM INQUIRY SCREEN 3
RLAY
2DFT('SALES MONTH')
16EDTCDE(1)
8DFT('Y-T-D')
14EDTCDE(1)
2DFT('COSTS MONTH')
16EDTCDE(1)
8DFT('Y-T-D')
14EDTCDE(1)
2DFT('PROFIT PCT')
22EDTCDE(1)
2DFT('LOST SALES')
16EDTCDE(1)
5DFT('CMD KEY 1 - END ')
23DFT(' 2 - MAIN MENU ')
') OVE+
TEXT('TIME OUT SCREEN')
OVE+
RLAY
2ð 2DFT('TARGET PROGRAM TIMED OUT. ENTER 1 TO TRY AGAIN OR 2 TO END.')
I 2ð 61
Figure D-9 (Part 2 of 2). DDS for Source Program Two-Session Inquiry Using DSPFIL
Configuration: The following command is needed to create
the intrasystem communications device associated with the
ICF file:
CRTDEVINTR DEVD(INTRADEV)
RMTLOCNAME(INTRARMT)
ONLINE(\NO)
TEXT("THIS IS AN INTRASYSTEM DEVICE
DESCRIPTION")
ICF File Creation and Program Device Entry Definition:
The command needed to create the ICF file is:
CRTICFF FILE(INTLIB/INTFIL)
SRCFILE(INTLIB/QINTSRC)
SRCMBR(INTFIL)
ACQPGMDEV(\NONE) MAXPGMDEV(2)
TEXT("SOURCE ICF FILE FOR TWO SESSION
PROGRAM")
It is not necessary to add a communications entry to the subsystem because the system automatically defines an entry
for the device created above when the program is processed.
However, the following is an example of what you would use
if you decided to add a communications entry:
ADDCMNE
SBSD(QCMN) DEV(INTRADEV)
Note: Subsystem QCMN should be stopped before
ADDCMNE is entered, and then restarted again. The commands needed to define the two program device entries are:
OVRICFDEVE PGMDEV(ICFðð)
RMTLOCNAME(INTRARMT)
FMTSLT(\RECID)
OVRICFDEVE PGMDEV(ICFð1)
RMTLOCNAME(INTRARMT)
FMTSLT(\RECID)
The CL program that could be used to run the source
program is:
CSDINTCL: PGM PARM(&RMT1 &RMT2)
DCL
VAR(&RMT1) TYPE(\CHAR)
LEN(8)
DCL
VAR(&RMT2) TYPE(\CHAR)
LEN(8)
CHGJOB
OUTQ(INTLIB/INTOUTQ)
LOG(4 ðð \SECLVL)
LOGCLPGM(\YES)
OVRICFDEVE PGMDEV(ICFðð)
RMTLOCNAME(&RMT1)
FMTSLT(\RECID)
OVRICFDEVE PGMDEV(ICFð1)
RMTLOCNAME(&RMT2)
FMTSLT(\RECID)
CALL INTLIB/CSDINT
ENDCSDINTCL: ENDPGM
A CL program that could be used as the target program
called by the source program (which calls the program
CTDINT shown in the example) is:
Appendix D. Program Examples
D-17
.5/
CTDINTCL: PGM
CHGJOB
OUTQ(INTLIB/INTOUTQ)
LOG(4 ðð \SECLVL)
LOGCLPGM(\YES)
ADDLIBLE INTLIB
OVRICFDEVE PGMDEV(RQSDEV)
RMTLOCNAME(\REQUESTER)
CALL INTLIB/CTDINT
RMVLIBLE INTLIB
MONMSG
MSGID(CPFðððð)
ENDCTDINTCL: ENDPGM
Program Explanation: The following explains the structure
of the program example illustrated in Figure D-10 on
page D-20. The ICF file used in the example is defined by
the user, and uses externally described data formats (DDS).
The reference numbers in the explanation below correspond
to the numbers in the following program example.
The device for the work station is implicitly acquired
when the DSPFIL file is opened.
Also, the evoke requests are issued to the remote
programs by passing control to section 16.
When control returns from section 16, the main menu
(record format CIMENU) is then written to the work
station.
.6/
All output operations to the ICF file in the example are done
using the write statement with the record format name coded
as an operand.
.1/
This section defines the ICF file (INTFIL) and the
display file (DSPFIL) used in the program.
.7/
DSPFIL is the display file used to receive user’s
requests and to report the information received based
on the request.
.2/
THE DSP-ERROR SECTION and CMN-ERROR
SECTION define the error handling procedures for I/O
errors on the DSPFIL and INTFIL. A DSPFIL I/O
error causes the program to end, and an error
message to be sent to the printer file. The section for
INTFIL file I/O errors checks the major/minor return
code to determine if the error is recoverable. If the
error is recoverable (major code 83), it sets a flag
(ERR-SW) to 1 and returns to the program.
.3/
The program opens the files to be used and initializes
the ICF file separate indicator area.
.4/
If the ERR-SW switch is set to 1, indicating that a
recoverable error has occurred, the program determines whether the open-retry count limit of nine has
been exceeded. If it has, the program goes to
section 19 and then ends. If the limit count is less
than nine, one is added to the count and control
passes to section 17 and then to section 3 to try to
open the file.
D-18
Intrasystem Communications Programming V4R1
A read operation is issued to the display device, and
the program waits for an input request from the user.
When a record is returned, the last record format
used (as specified in the RCD-FMT field in the I/O
control area) is checked. Based on the value in
RCD-FMT, the program branches to the appropriate
routine.
If a match is not found for the display record format,
the main menu (CIMENU) is written to the work
station and control is returned to section 6.
INTFIL is the ICF file used to send records to and
receive records from each of the two target programs.
INTFIL is established using the file-level keyword,
INDARA, indicating that a separate indicator area is
used.
The control area clause in the select statements of
INTFIL and DSPFIL is used to define the I/O feedback area. Information from the I/O feedback is used
to determine the major/minor return code, record
format, and function key pressed.
The two program devices used by the program are
explicitly acquired.
The MENU routine is called if the request is made
from the main menu (CIMENU). If the CMD-KEY variable is set to 01, indicating that the operator pressed
function key 1, the two transactions and sessions are
ended and the program ends. If the operator entered
option 1, the program writes the Item Inquiry menu
(ITMMNU) to the work station and returns to section
6.
If the option is not 1, the Buyer Inquiry menu
(DTLMNU) is written to the work station and control is
passed to section 6.
.8/
The ITMIN routine is called when the user is
requesting an item inquiry (record format ITMMNU).
If function key 1 (CMD-KEY = 01) is pressed, control
passes to section 19, and then to section 20, the two
transactions end, and the program ends. If function
key 2 is pressed, the inquiry request is canceled, the
main menu (CMENU) is written to the work station,
and the program returns to section 16.
The item number is read from the work station and
then the request is sent to the target program on
program device ICF01.
The request is sent to the appropriate target program
by writing data to the program device using format
ITMREQ. The INVITE keyword is specified as part of
the ITMREQ format to give the target program permission to send.
A timer is issued for 30 seconds before the read
operation. This is provided to allow the local program
to have a time out when no response is received from
the target program.
The read is an implied read-from-invited-programdevices because no record format is specified in the
read statement.
If a fail indication is received (the item number
requested was not found), the request is not validated
and a new item inquiry menu (ITMMNU) is written to
the display device.
Control goes to section 9 to process the item information based on the input data that was received, and
the result is written to the display using format
ITMSC2.
The program then returns to section 6.
.13/
The routine DTLRTN is called from section 6, and
handles the user’s request following the display of the
buyer information. Function key 1 ends the job, function key 2 displays the main menu (CMENU), and
pressing Enter displays the Buyer Inquiry menu
(DTLMNU). Control then returns to section 6.
.14/
The CUSTOMER-DETAIL routine issues the read
operation to the program device.
After returning from section 9, the program returns to
section 6.
.9/
This read is an implied read-from-invited-programdevices because no record format is specified on the
read statement.
The routine ITMOUT is called when the target
program responds to a request for an item record. If
the returned response is a fail indication (checked in
section 8), the request is invalidated and a new Item
Inquiry menu (ITMMNU) is written to the work station.
A check is made of the MAJ-MIN return code for possible error conditions on a successful return (control
is automatically passed to section 2 for unsuccessful
I/O operations). A 0310 return code means the
remote program has timed out. (The timer was
issued on the write operation.) If no data was
received (return codes of 03xx), the request is sent
again to the remote program. Finally, if the data
returns in the wrong format, control is passed to
section 17.
The program then performs the calculations to set the
quantity fields and writes the result to the requesting
work station using record format ITMSC2.
The program then returns to the calling routine.
.1ð/
The routine ITMRTN is called to process the next
user request. If function key 1 (CMD-KEY = 01) is
pressed, the transactions and session are ended in
section 19, and control goes to section 20 to end the
program.
If function key 2 is pressed, the main menu (CMENU)
is written to the work station. If function key 3 is
pressed, the Item Inquiry menu is written to the work
station, and the program returns to section 6. By
pressing Enter, the profit and loss figures are calculated and written to the work station before returning
control to section 6.
.11/
.12/
The buyer information received from the target
program is processed, and the result is written to the
user work station using screen format DTLBLK.
Control returns to the calling routine.
.15/
The PROFIT-LOSS routine calculates the profit and
loss figures for the second display of the requested
item number.
The DTLIN routine is called when a request is read
from the Buyer Inquiry menu (DTLMNU). If function
key 1 (CMD-KEY = 01) is pressed, the transactions
and sessions are ended. If function key 2 (CMD-KEY
= 02) is pressed, the main menu (CIMENU) is written
to the work station and the program returns to section
6.
The buyer inquiry request is sent to the target
program by writing data to the program device ICF00
using format DTLREQ. The INVITE keyword is specified as part of the DLTREQ format to give the target
program permission to send.
When the program start request is received at the
remote program, INTLIB is searched for CTDINTCL
and that program then starts. CTDINTCL is a CL
program that contains CL statements, as illustrated
on D-17.
.16/
The ERROR-RECOVERY routine ends the transactions and closes the files. The ERR-SW indicator
is set again, and control returns to the calling routine.
.17/
The EXIT-FORMAT-ERR routine is run when the
program detects data in an incorrect record format. It
writes an error message to the printer file, ends the
program, and implicitly ends the session.
.18/
The DETACH routine issues the detach function to
the ICF file for each of the two program devices. In
the program using the user-supplied format, the write
operation is issued using the record format name
DETACH.
.19/
The END-JOB routine releases the program devices
and close the files. The program ends.
Control goes to section 14 to retrieve the buyer detail
information.
Routine DTLRTN in section 14 is called to continue
the buyer information processing.
The EVOKE routine builds the evoke requests to
send to the remote programs. Because the DDS
keyword for the record format only specifies the field
identifiers with the record, this code moves the literal
value CTDINTCL to the field PGMID, and INTLIB to
the field LIB.
Appendix D. Program Examples
D-19
5738CB1 V2R1Mð 91ð524
IBM AS/4ðð COBOL/4ðð
INTLIB/CSDINT
RCH38321 1ð/ð8/9ð 11:ð9:19
Program . . . . . . . . . . . . . . :
CSDINT
Library . . . . . . . . . . . . . :
INTLIB
Source file . . . . . . . . . . . . :
QINTSRC
Library . . . . . . . . . . . . . :
INTLIB
Source member . . . . . . . . . . . :
CSDINT
1ð/ð8/9ð 11:ð8:48
Generation severity level . . . . . :
29
Text 'description' . . . . . . . . . :
COBOL Source Intra Program Example
Source listing options . . . . . . . :
\SOURCE
Generation options . . . . . . . . . :
\NONE
Message limit:
Number of messages . . . . . . . . :
\NOMAX
Message limit severity . . . . . . :
29
Print file . . . . . . . . . . . . . :
QSYSPRT
Library . . . . . . . . . . . . . :
\LIBL
FIPS flagging . . . . . . . . . . . :
\NOFIPS \NOSEG \NODEB \NOOBSOLETE
SAA flagging . . . . . . . . . . . . :
\NOFLAG
Flagging severity . . . . . . . . . :
ð
Replace program . . . . . . . . . . :
\YES
Target release . . . . . . . . . . . :
\CURRENT
User profile . . . . . . . . . . . . :
\USER
Authority . . . . . . . . . . . . . :
\LIBCRTAUT
Compiler . . . . . . . . . . . . . . :
IBM AS/4ðð COBOL/4ðð
5738CB1 V2R1Mð 91ð524
AS/4ðð COBOL/4ðð Source
INTLIB/CSDINT
RCH38321 1ð/ð8/9ð 11:ð9:19
STMT SEQNBR -A 1 B..+....2....+....3....+....4....+....5....+....6....+....7..IDENTFCN S COPYNAME
CHG DATE
1 ððð1ðð IDENTIFICATION DIVISION.
ð9/3ð/87
2 ððð2ðð PROGRAM-ID.
CSDINT.
11/15/88
ððð3ðð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
ð9/3ð/87
ððð4ðð\ THIS PROGRAM ASSIGNS TWO SESSIONS AS FOLLOWS:
\
11/15/88
ððð5ðð\
'ICFðð' TO INQUIRE ABOUT A BUYER'S PURCHASING STATUS
\
11/15/88
ððð6ðð\
BEFORE AN ORDER IS ALLOWED.
\
11/15/88
ððð7ðð\
'ICFð1' TO INQUIRE ABOUT THE AVAILABILITY OF AN ITEM
\
11/15/88
ððð8ðð\
BEING ORDERED (ITEM ððððð1 THRU 999999).
\
11/15/88
ððð9ðð\ A DISPLAY DEVICE IS USED TO ENTER THE REQUEST ( USING A
\
ð9/3ð/87
ðð1ððð\ BUYER AND AN ITEM MENU ) THAT IS SENT TO THE TARGET.
\
1ð/ð5/9ð
ðð11ðð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
ð9/3ð/87
3 ðð12ðð ENVIRONMENT DIVISION.
ð9/3ð/87
4 ðð13ðð CONFIGURATION SECTION.
ð9/3ð/87
5 ðð14ðð SOURCE-COMPUTER.
IBM-AS4ðð.
ð1/15/88
6 ðð15ðð OBJECT-COMPUTER.
IBM-AS4ðð.
ð1/15/88
7 ðð16ðð SPECIAL-NAMES.
I-O-FEEDBACK IS IO-FEEDBACK
ð9/3ð/87
8 ðð17ðð
OPEN-FEEDBACK IS OPEN-FBA.
ð9/3ð/87
9 ðð18ðð INPUT-OUTPUT SECTION.
ð9/3ð/87
1ð ðð19ðð FILE-CONTROL.
ð9/3ð/87
ðð2ððð\.1/
ð9/3ð/87
ðð21ðð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
ð9/3ð/87
ðð22ðð\
\
ð9/3ð/87
ðð23ðð\
F I L E
S P E C I F I C A T I O N S
\
ð9/3ð/87
ðð24ðð\
\
ð9/3ð/87
ðð25ðð\
INTFIL :
ICF FILE USED TO SEND A REQUEST TO ONE
\
1ð/ð5/9ð
ðð26ðð\
OF TWO DIFFERENT TARGET PROGRAMS. TWO
\
1ð/ð5/9ð
ðð27ðð\
SESSIONS ARE ACTIVE AT THE SAME TIME.
\
1ð/ð5/9ð
ðð28ðð\
\
ð9/3ð/87
ðð29ðð\
DSPFIL :
DISPLAY FILE USED TO ENTER A REQUEST TO BE
\
ð9/3ð/87
ðð3ððð\
SENT TO A TARGET PROGRAM.
\
1ð/ð5/9ð
ðð31ðð\
\
ð9/3ð/87
ðð32ðð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
ð9/3ð/87
11 ðð33ðð
SELECT INTFIL ASSIGN TO WORKSTATION-INTFIL-SI
11/21/88
12 ðð34ðð
ORGANIZATION IS TRANSACTION
ð9/3ð/87
13 ðð35ðð
CONTROL-AREA IS TR-CTL-AREA
ð9/3ð/87
14 ðð36ðð
FILE STATUS IS STATUS-IND MAJ-MIN.
ð9/3ð/87
15 ðð37ðð
SELECT DSPFIL ASSIGN TO WORKSTATION-DSPFIL
ð9/3ð/87
16 ðð38ðð
ORGANIZATION IS TRANSACTION
ð9/3ð/87
17 ðð39ðð
CONTROL-AREA IS DISPLAY-FEEDBACK
ð9/3ð/87
18 ðð4ððð
FILE STATUS IS STATUS-DSP.
ð9/3ð/87
19 ðð41ðð
SELECT QPRINT ASSIGN TO PRINTER-QSYSPRT.
ð9/3ð/87
2ð ðð42ðð DATA DIVISION.
ð9/3ð/87
21 ðð43ðð FILE SECTION.
ð9/3ð/87
22 ðð44ðð FD INTFIL
11/21/88
23 ðð45ðð
LABEL RECORDS ARE STANDARD.
ð9/3ð/87
24 ðð46ðð ð1 INTREC.
11/21/88
25 ðð47ðð
COPY DDS-ALL-FORMATS-I-O OF INTFIL.
11/21/88
26 +ððððð1
ð5 INTFIL-RECORD PIC X(196).
<-ALL-FMTS
+ððððð2\ INPUT FORMAT:ITMRSP
FROM FILE INTFIL
OF LIBRARY INTLIB
<-ALL-FMTS
+ððððð3\
<-ALL-FMTS
27 +ððððð4
ð5 ITMRSP-I
REDEFINES INTFIL-RECORD.
<-ALL-FMTS
28 +ððððð5
ð6 RECITM
PIC X(1).
<-ALL-FMTS
29 +ððððð6
ð6 ITEMNO
PIC S9(6).
<-ALL-FMTS
3ð +ððððð7
ð6 DESC
PIC X(3ð).
<-ALL-FMTS
31 +ððððð8
ð6 QTYLST
PIC S9(7).
<-ALL-FMTS
Figure D-10 (Part 1 of 13). Source Program Example — CSDINT
D-20
Intrasystem Communications Programming V4R1
Page
Page
1
2
5738CB1 V2R1Mð 91ð524
AS/4ðð COBOL/4ðð Source
INTLIB/CSDINT
STMT SEQNBR -A 1 B..+....2....+....3....+....4....+....5....+....6....+....7..IDENTFCN
32 +ððððð9
ð6 QTYOH
PIC S9(7).
33 +ðððð1ð
ð6 QTYOO
PIC S9(7).
34 +ðððð11
ð6 QTYBO
PIC S9(7).
35 +ðððð12
ð6 UNITQ
PIC X(2).
36 +ðððð13
ð6 PRð1
PIC S9(5)V9(2).
37 +ðððð14
ð6 PRð5
PIC S9(7).
38 +ðððð15
ð6 UFRT
PIC S9(3)V9(2).
39 +ðððð16
ð6 SLSTM
PIC S9(7)V9(2).
4ð +ðððð17
ð6 SLSTY
PIC S9(9)V9(2).
41 +ðððð18
ð6 CSTTM
PIC S9(7)V9(2).
42 +ðððð19
ð6 CSTTY
PIC S9(9)V9(2).
43 +ðððð2ð
ð6 PRO
PIC S9(3)V9(2).
44 +ðððð21
ð6 LOS
PIC S9(7)V9(2).
45 +ðððð22
ð6 FILL1
PIC X(56).
+ðððð23\ OUTPUT FORMAT:ITMRSP
FROM FILE INTFIL
OF LIBRARY INTLIB
+ðððð24\
46 +ðððð25
ð5 ITMRSP-O
REDEFINES INTFIL-RECORD.
47 +ðððð26
ð6 RECITM
PIC X(1).
48 +ðððð27
ð6 ITEMNO
PIC S9(6).
49 +ðððð28
ð6 DESC
PIC X(3ð).
5ð +ðððð29
ð6 QTYLST
PIC S9(7).
51 +ðððð3ð
ð6 QTYOH
PIC S9(7).
52 +ðððð31
ð6 QTYOO
PIC S9(7).
53 +ðððð32
ð6 QTYBO
PIC S9(7).
54 +ðððð33
ð6 UNITQ
PIC X(2).
55 +ðððð34
ð6 PRð1
PIC S9(5)V9(2).
56 +ðððð35
ð6 PRð5
PIC S9(7).
57 +ðððð36
ð6 UFRT
PIC S9(3)V9(2).
58 +ðððð37
ð6 SLSTM
PIC S9(7)V9(2).
59 +ðððð38
ð6 SLSTY
PIC S9(9)V9(2).
6ð +ðððð39
ð6 CSTTM
PIC S9(7)V9(2).
61 +ðððð4ð
ð6 CSTTY
PIC S9(9)V9(2).
62 +ðððð41
ð6 PRO
PIC S9(3)V9(2).
63 +ðððð42
ð6 LOS
PIC S9(7)V9(2).
64 +ðððð43
ð6 FILL1
PIC X(56).
+ðððð44\ INPUT FORMAT:DTLRSP
FROM FILE INTFIL
OF LIBRARY INTLIB
+ðððð45\
65 +ðððð46
ð5 DTLRSP-I
REDEFINES INTFIL-RECORD.
66 +ðððð47
ð6 RECCUS
PIC X(1).
67 +ðððð48
ð6 CUSTNO
PIC S9(6).
68 +ðððð49
ð6 DNAME
PIC X(3ð).
69 +ðððð5ð
ð6 DLSTOR
PIC S9(6).
7ð +ðððð51
ð6 DSLSTM
PIC S9(9).
71 +ðððð52
ð6 DSPMð1
PIC S9(9).
72 +ðððð53
ð6 DSPMð2
PIC S9(9).
73 +ðððð54
ð6 DSPMð3
PIC S9(9).
74 +ðððð55
ð6 DSTTYD
PIC S9(11).
75 +ðððð56
ð6 IDEPT
PIC S9(3).
76 +ðððð57
ð6 FILL2
PIC X(57).
+ðððð58\ OUTPUT FORMAT:DTLRSP
FROM FILE INTFIL
OF LIBRARY INTLIB
+ðððð59\
77 +ðððð6ð
ð5 DTLRSP-O
REDEFINES INTFIL-RECORD.
78 +ðððð61
ð6 RECCUS
PIC X(1).
79 +ðððð62
ð6 CUSTNO
PIC S9(6).
8ð +ðððð63
ð6 DNAME
PIC X(3ð).
5738CB1 V2R1Mð 91ð524
AS/4ðð COBOL/4ðð Source
INTLIB/CSDINT
STMT SEQNBR -A 1 B..+....2....+....3....+....4....+....5....+....6....+....7..IDENTFCN
81 +ðððð64
ð6 DLSTOR
PIC S9(6).
82 +ðððð65
ð6 DSLSTM
PIC S9(9).
83 +ðððð66
ð6 DSPMð1
PIC S9(9).
84 +ðððð67
ð6 DSPMð2
PIC S9(9).
85 +ðððð68
ð6 DSPMð3
PIC S9(9).
86 +ðððð69
ð6 DSTTYD
PIC S9(11).
87 +ðððð7ð
ð6 IDEPT
PIC S9(3).
88 +ðððð71
ð6 FILL2
PIC X(57).
RCH38321 1ð/ð8/9ð 11:ð9:19
S COPYNAME
CHG DATE
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
RCH38321 1ð/ð8/9ð 11:ð9:19
S COPYNAME
CHG DATE
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
Page
3
Page
4
Figure D-10 (Part 2 of 13). Source Program Example — CSDINT
Appendix D. Program Examples
D-21
+ðððð72\ INPUT FORMAT:DETACH
FROM FILE INTFIL
OF LIBRARY INTLIB
+ðððð73\
+ðððð74\
ð5 DETACH-I
REDEFINES INTFIL-RECORD.
+ðððð75\ OUTPUT FORMAT:DETACH
FROM FILE INTFIL
OF LIBRARY INTLIB
+ðððð76\
+ðððð77\
ð5 DETACH-O
REDEFINES INTFIL-RECORD.
+ðððð78\ INPUT FORMAT:EOS
FROM FILE INTFIL
OF LIBRARY INTLIB
+ðððð79\
+ðððð8ð\
ð5 EOS-I
REDEFINES INTFIL-RECORD.
+ðððð81\ OUTPUT FORMAT:EOS
FROM FILE INTFIL
OF LIBRARY INTLIB
+ðððð82\
+ðððð83\
ð5 EOS-O
REDEFINES INTFIL-RECORD.
+ðððð84\ INPUT FORMAT:EVKREQ
FROM FILE INTFIL
OF LIBRARY INTLIB
+ðððð85\
+ðððð86\
ð5 EVKREQ-I
REDEFINES INTFIL-RECORD.
+ðððð87\ OUTPUT FORMAT:EVKREQ
FROM FILE INTFIL
OF LIBRARY INTLIB
+ðððð88\
89 +ðððð89
ð5 EVKREQ-O
REDEFINES INTFIL-RECORD.
9ð +ðððð9ð
ð6 PGMID
PIC X(1ð).
91 +ðððð91
ð6 LIB
PIC X(1ð).
+ðððð92\ INPUT FORMAT:ITMREQ
FROM FILE INTFIL
OF LIBRARY INTLIB
+ðððð93\
92 +ðððð94
ð5 ITMREQ-I
REDEFINES INTFIL-RECORD.
93 +ðððð95
ð6 ITEMNO
PIC S9(6).
+ðððð96\ OUTPUT FORMAT:ITMREQ
FROM FILE INTFIL
OF LIBRARY INTLIB
+ðððð97\
94 +ðððð98
ð5 ITMREQ-O
REDEFINES INTFIL-RECORD.
95 +ðððð99
ð6 ITEMNO
PIC S9(6).
+ððð1ðð\ INPUT FORMAT:DTLREQ
FROM FILE INTFIL
OF LIBRARY INTLIB
+ððð1ð1\
96 +ððð1ð2
ð5 DTLREQ-I
REDEFINES INTFIL-RECORD.
97 +ððð1ð3
ð6 CUSTNO
PIC S9(6).
+ððð1ð4\ OUTPUT FORMAT:DTLREQ
FROM FILE INTFIL
OF LIBRARY INTLIB
+ððð1ð5\
98 +ððð1ð6
ð5 DTLREQ-O
REDEFINES INTFIL-RECORD.
99 +ððð1ð7
ð6 CUSTNO
PIC S9(6).
+ððð1ð8\ INPUT FORMAT:TIMER
FROM FILE INTFIL
OF LIBRARY INTLIB
+ððð1ð9\
+ððð11ð\
ð5 TIMER-I
REDEFINES INTFIL-RECORD.
+ððð111\ OUTPUT FORMAT:TIMER
FROM FILE INTFIL
OF LIBRARY INTLIB
+ððð112\
+ððð113\
ð5 TIMER-O
REDEFINES INTFIL-RECORD.
1ðð ðð48ðð FD DSPFIL
1ð1 ðð49ðð
LABEL RECORDS ARE STANDARD.
1ð2 ðð5ððð ð1 DSPREC.
1ð3 ðð51ðð
COPY DDS-ALL-FORMATS-I-O OF DSPFIL.
1ð4 +ððððð1
ð5 DSPFIL-RECORD PIC X(79).
5738CB1 V2R1Mð 91ð524
AS/4ðð COBOL/4ðð Source
INTLIB/CSDINT
STMT SEQNBR -A 1 B..+....2....+....3....+....4....+....5....+....6....+....7..IDENTFCN
+ððððð2\ INPUT FORMAT:CIMENU
FROM FILE DSPFIL
OF LIBRARY INTLIB
+ððððð3\
MENU FOR INQUIRY
1ð5 +ððððð4
ð5 CIMENU-I
REDEFINES DSPFIL-RECORD.
1ð6 +ððððð5
ð6 CIMENU-I-INDIC.
1ð7 +ððððð6
ð7 IN99
PIC 1 INDIC 99.
1ð8 +ððððð7
ð7 IN98
PIC 1 INDIC 98.
1ð9 +ððððð8
ð7 IN97
PIC 1 INDIC 97.
11ð +ððððð9
ð6 OPTION
PIC X(1).
Figure D-10 (Part 3 of 13). Source Program Example — CSDINT
D-22
Intrasystem Communications Programming V4R1
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
<-ALL-FMTS
RCH38321 1ð/ð8/9ð 11:ð9:19
S COPYNAME
CHG DATE
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
Page
5
+ðððð1ð\ OUTPUT FORMAT:CIMENU
FROM FILE DSPFIL
OF LIBRARY INTLIB
+ðððð11\
MENU FOR INQUIRY
+ðððð12\
ð5 CIMENU-O
REDEFINES DSPFIL-RECORD.
+ðððð13\ INPUT FORMAT:DTLMNU
FROM FILE DSPFIL
OF LIBRARY INTLIB
+ðððð14\
BUYER INQUIRY SCREEN 1
111 +ðððð15
ð5 DTLMNU-I
REDEFINES DSPFIL-RECORD.
112 +ðððð16
ð6 DTLMNU-I-INDIC.
113 +ðððð17
ð7 IN99
PIC 1 INDIC 99.
114 +ðððð18
ð7 IN98
PIC 1 INDIC 98.
115 +ðððð19
ð7 IN97
PIC 1 INDIC 97.
116 +ðððð2ð
ð6 CUSTNO
PIC S9(6).
+ðððð21\ OUTPUT FORMAT:DTLMNU
FROM FILE DSPFIL
OF LIBRARY INTLIB
+ðððð22\
BUYER INQUIRY SCREEN 1
+ðððð23\
ð5 DTLMNU-O
REDEFINES DSPFIL-RECORD.
+ðððð24\ INPUT FORMAT:DTLSCR
FROM FILE DSPFIL
OF LIBRARY INTLIB
+ðððð25\
BUYER INQUIRY SCR. #2
117 +ðððð26
ð5 DTLSCR-I
REDEFINES DSPFIL-RECORD.
118 +ðððð27
ð6 DTLSCR-I-INDIC.
119 +ðððð28
ð7 IN99
PIC 1 INDIC 99.
12ð +ðððð29
ð7 IN98
PIC 1 INDIC 98.
121 +ðððð3ð
ð7 IN97
PIC 1 INDIC 97.
+ðððð31\ OUTPUT FORMAT:DTLSCR
FROM FILE DSPFIL
OF LIBRARY INTLIB
+ðððð32\
BUYER INQUIRY SCR. #2
122 +ðððð33
ð5 DTLSCR-O
REDEFINES DSPFIL-RECORD.
123 +ðððð34
ð6 CUSTN
PIC X(6).
124 +ðððð35
ð6 DEPT
PIC S9(3).
125 +ðððð36
ð6 DLSTR
PIC S9(6).
126 +ðððð37
ð6 DSLSM
PIC S9(9).
127 +ðððð38
ð6 DSPM1
PIC S9(9).
128 +ðððð39
ð6 DSPM2
PIC S9(9).
129 +ðððð4ð
ð6 DSPM3
PIC S9(9).
13ð +ðððð41
ð6 DSTYD
PIC S9(11).
131 +ðððð42
ð6 CNAME
PIC X(5).
+ðððð43\ INPUT FORMAT:ITMMNU
FROM FILE DSPFIL
OF LIBRARY INTLIB
+ðððð44\
ITEM INQUIRY SCREEN ONE
132 +ðððð45
ð5 ITMMNU-I
REDEFINES DSPFIL-RECORD.
133 +ðððð46
ð6 ITMMNU-I-INDIC.
134 +ðððð47
ð7 IN99
PIC 1 INDIC 99.
135 +ðððð48
ð7 IN98
PIC 1 INDIC 98.
136 +ðððð49
ð7 IN97
PIC 1 INDIC 97.
137 +ðððð5ð
ð6 ITEMNO
PIC S9(6).
+ðððð51\ OUTPUT FORMAT:ITMMNU
FROM FILE DSPFIL
OF LIBRARY INTLIB
+ðððð52\
ITEM INQUIRY SCREEN ONE
+ðððð53\
ð5 ITMMNU-O
REDEFINES DSPFIL-RECORD.
+ðððð54\ INPUT FORMAT:ITMSC2
FROM FILE DSPFIL
OF LIBRARY INTLIB
+ðððð55\
ITEM INQUIRY SCREEN TWO
138 +ðððð56
ð5 ITMSC2-I
REDEFINES DSPFIL-RECORD.
5738CB1 V2R1Mð 91ð524
AS/4ðð COBOL/4ðð Source
INTLIB/CSDINT
STMT SEQNBR -A 1 B..+....2....+....3....+....4....+....5....+....6....+....7..IDENTFCN
139 +ðððð57
ð6 ITMSC2-I-INDIC.
14ð +ðððð58
ð7 IN99
PIC 1 INDIC 99.
141 +ðððð59
ð7 IN98
PIC 1 INDIC 98.
142 +ðððð6ð
ð7 IN97
PIC 1 INDIC 97.
+ðððð61\ OUTPUT FORMAT:ITMSC2
FROM FILE DSPFIL
OF LIBRARY INTLIB
+ðððð62\
ITEM INQUIRY SCREEN TWO
143 +ðððð63
ð5 ITMSC2-O
REDEFINES DSPFIL-RECORD.
144 +ðððð64
ð6 DSC
PIC X(3ð).
145 +ðððð65
ð6 QAVAIL
PIC S9(7).
146 +ðððð66
ð6 QTYH
PIC S9(7).
147 +ðððð67
ð6 QTYO
PIC S9(7).
148 +ðððð68
ð6 QTYB
PIC S9(7).
149 +ðððð69
ð6 UNT
PIC X(2).
15ð +ðððð7ð
ð6 PR1
PIC S9(5)V9(2).
151 +ðððð71
ð6 PR5
PIC S9(7).
152 +ðððð72
ð6 UFR
PIC S9(3)V9(2).
+ðððð73\ INPUT FORMAT:ITMSC3
FROM FILE DSPFIL
OF LIBRARY INTLIB
+ðððð74\
ITEM INQUIRY SCREEN 3
153 +ðððð75
ð5 ITMSC3-I
REDEFINES DSPFIL-RECORD.
154 +ðððð76
ð6 ITMSC3-I-INDIC.
155 +ðððð77
ð7 IN99
PIC 1 INDIC 99.
156 +ðððð78
ð7 IN98
PIC 1 INDIC 98.
157 +ðððð79
ð7 IN97
PIC 1 INDIC 97.
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
RCH38321 1ð/ð8/9ð 11:ð9:19
S COPYNAME
CHG DATE
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
Page
6
Figure D-10 (Part 4 of 13). Source Program Example — CSDINT
Appendix D. Program Examples
D-23
+ðððð8ð\ OUTPUT FORMAT:ITMSC3
FROM FILE DSPFIL
OF LIBRARY INTLIB
+ðððð81\
ITEM INQUIRY SCREEN 3
158 +ðððð82
ð5 ITMSC3-O
REDEFINES DSPFIL-RECORD.
159 +ðððð83
ð6 SLSM
PIC S9(7)V9(2).
16ð +ðððð84
ð6 SLSY
PIC S9(9)V9(2).
161 +ðððð85
ð6 CSTM
PIC S9(7)V9(2).
162 +ðððð86
ð6 CSTY
PIC S9(9)V9(2).
163 +ðððð87
ð6 PROFIT
PIC S9(3)V9(2).
164 +ðððð88
ð6 LOSTS
PIC S9(7)V9(2).
+ðððð89\ INPUT FORMAT:TIMOUT
FROM FILE DSPFIL
OF LIBRARY INTLIB
+ðððð9ð\
TIME OUT SCREEN
165 +ðððð91
ð5 TIMOUT-I
REDEFINES DSPFIL-RECORD.
166 +ðððð92
ð6 TIMOUT-I-INDIC.
167 +ðððð93
ð7 IN99
PIC 1 INDIC 99.
168 +ðððð94
ð7 IN98
PIC 1 INDIC 98.
169 +ðððð95
ð7 IN97
PIC 1 INDIC 97.
17ð +ðððð96
ð6 TIMRSP
PIC X(1).
+ðððð97\ OUTPUT FORMAT:TIMOUT
FROM FILE DSPFIL
OF LIBRARY INTLIB
+ðððð98\
TIME OUT SCREEN
+ðððð99\
ð5 TIMOUT-O
REDEFINES DSPFIL-RECORD.
171 ðð52ðð FD QPRINT
172 ðð53ðð
LABEL RECORDS ARE OMITTED.
173 ðð54ðð ð1 PRINTREC.
174 ðð55ðð
ð5 RC
PIC 9999.
175 ðð56ðð
ð5 ERRMSG
PIC X(128).
176 ðð57ðð WORKING-STORAGE SECTION.
177 ðð58ðð 77 STATUS-IND
PIC X(2).
178 ðð59ðð 77 STATUS-DSP
PIC X(2).
179 ðð6ððð 77 MAJ-MIN-SAV
PIC X(4).
18ð ðð61ðð 77 EOF-PFILE-SW
PIC X VALUE "ð".
181 ðð62ðð 77 ERR-SW
PIC X VALUE "ð".
182 ðð63ðð 77 INDON
PIC 1 VALUE B"1".
5738CB1 V2R1Mð 91ð524
AS/4ðð COBOL/4ðð Source
INTLIB/CSDINT
STMT SEQNBR -A 1 B..+....2....+....3....+....4....+....5....+....6....+....7..IDENTFCN
183 ðð64ðð 77 INDOFF
PIC 1 VALUE B"ð".
184 ðð65ðð 77 OPEN-COUNT
PIC 9(1) VALUE ð.
185 ðð66ðð 77 LEN
PIC 9(1ð)V9(5) COMP.
186 ðð67ðð 77 PROFM
PIC 9(7)V9(2) COMP-4.
187 ðð68ðð 77 CMD2
PIC X(31)
188 ðð69ðð
VALUE "CPYF HEXDUMP \LIST PRTFMT(\HEX)".
189 ðð7ððð ð1 SUBKEY-VALUE.
19ð ðð71ðð
ð5 SUBKEY
PIC 9(3) VALUE ð.
191 ðð72ðð ð1 TR-CTL-AREA.
192 ðð73ðð
ð5 FILLER
PIC X(2).
193 ðð74ðð
ð5 PGM-DEV-NME
PIC X(1ð).
194 ðð75ðð
ð5 RCD-FMT-NME
PIC X(1ð).
195 ðð76ðð ð1 INTF-INDIC-AREA.
196 ðð77ðð
ð5 IN25
PIC 1 INDIC 25.
197 ðð78ðð
88 IN25-ON
VALUE B"1".
198 ðð79ðð
88 IN25-OFF
VALUE B"ð".
199 ðð8ððð
ð5 IN9ð
PIC 1 INDIC 9ð.
2ðð ðð81ðð
88 IN9ð-ON
VALUE B"1".
2ð1 ðð82ðð
88 IN9ð-OFF
VALUE B"ð".
2ð2 ðð83ðð ð1 DSPF-INDIC-AREA.
2ð3 ðð84ðð
ð5 IN23
PIC 1 INDIC 23.
2ð4 ðð85ðð
88 IN23-ON
VALUE B"1".
2ð5 ðð86ðð
88 IN23-OFF
VALUE B"ð".
2ð6 ðð87ðð
ð5 IN97
PIC 1 INDIC 97.
2ð7 ðð88ðð
88 IN97-ON
VALUE B"1".
2ð8 ðð89ðð
88 IN97-OFF
VALUE B"ð".
2ð9 ðð9ððð
ð5 IN98
PIC 1 INDIC 98.
21ð ðð91ðð
88 IN98-ON
VALUE B"1".
211 ðð92ðð
88 IN98-OFF
VALUE B"ð".
212 ðð93ðð
ð5 IN99
PIC 1 INDIC 99.
213 ðð94ðð
88 IN99-ON
VALUE B"1".
214 ðð95ðð
88 IN99-OFF
VALUE B"ð".
215 ðð96ðð ð1 MAJ-MIN.
216 ðð97ðð
ð5 MAJ
PIC X(2).
217 ðð98ðð
ð5 MIN
PIC X(2).
218 ðð99ðð ð1 DISPLAY-FEEDBACK.
219 ð1ðððð
ð5 CMD-KEY
PIC X(2).
22ð ð1ð1ðð
ð5 FILLER
PIC X(1ð).
221 ð1ð2ðð
ð5 RCD-FMT
PIC X(1ð).
ð1ð3ðð\
222 ð1ð4ðð PROCEDURE DIVISION.
Figure D-10 (Part 5 of 13). Source Program Example — CSDINT
D-24
Intrasystem Communications Programming V4R1
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
<-ALL-FMTS
ð9/3ð/87
ð9/3ð/87
ð1/14/88
ð1/15/88
ð1/14/88
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
RCH38321 1ð/ð8/9ð 11:ð9:19
S COPYNAME
CHG DATE
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
11/21/88
11/16/88
11/16/88
11/16/88
11/16/88
11/16/88
11/16/88
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
11/18/88
ð9/3ð/87
Page
7
ð1ð5ðð DECLARATIVES.
ð1ð6ðð\.2/
ð1ð7ðð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
ð1ð8ðð\
\
ð1ð9ðð\ AN ERROR ON THE DISPLAY FILE - DSPFIL - MAKES IT INACTIVE AND
\
ð11ððð\ THE JOB IS ENDED.
\
ð111ðð\
\
ð112ðð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
ð113ðð DSP-ERROR SECTION.
ð114ðð
USE AFTER STANDARD ERROR PROCEDURE ON DSPFIL.
ð115ðð\
ð116ðð DSPFIL-EXCEPTION.
223 ð117ðð
MOVE "DISPLAY ERROR. JOB TERMINATED" TO ERRMSG.
224 ð118ðð
WRITE PRINTREC.
5738CB1 V2R1Mð 91ð524
AS/4ðð COBOL/4ðð Source
INTLIB/CSDINT
STMT SEQNBR -A 1 B..+....2....+....3....+....4....+....5....+....6....+....7..IDENTFCN
225 ð119ðð
CLOSE INTFIL DSPFIL QPRINT.
226 ð12ððð
STOP RUN.
ð121ðð\
ð122ðð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
ð123ðð\
\
ð124ðð\ THIS SECTION HANDLES ERRORS ON THE INTFIL. A PERMANENT SESSION
\
ð125ðð\ ERROR WILL END THE JOB.
\
ð126ðð\
\
ð127ðð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
ð128ðð INT-ERROR SECTION.
ð129ðð
USE AFTER STANDARD ERROR PROCEDURE ON INTFIL.
ð13ððð INTFIL-EXCEPTION.
ð131ðð\
ð132ðð\ RECOVERABLE SESSION ERROR. CLOSE ICF FILE.
227 ð133ðð
IF MAJ = "83"
228 ð134ðð
MOVE MAJ-MIN TO RC
229 ð135ðð
MOVE "PROGRAM STARTED AGAIN DUE TO SESSION ERROR"
ð136ðð
TO ERRMSG
23ð ð137ðð
WRITE PRINTREC
231 ð138ðð
MOVE "1" TO ERR-SW
232 ð139ðð
GO TO EXIT-DECLARATIVES.
ð14ððð\
ð141ðð\ RECOVERABLE SESSION ERROR. CLOSE ICF FILE.
233 ð142ðð
IF MAJ = "ð3"
234 ð143ðð
MOVE MAJ-MIN TO RC
235 ð144ðð
MOVE "ERROR IGNORED AND PROGRAM RESTARTED"
ð145ðð
TO ERRMSG
236 ð146ðð
WRITE PRINTREC
237 ð147ðð
MOVE "1" TO ERR-SW
238 ð148ðð
GO TO EXIT-DECLARATIVES.
ð149ðð\
ð15ððð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
ð151ðð\
\
ð152ðð\ WHEN THERE IS A PERMANENT SESSION ERROR DETECTED,
\
ð153ðð\ THE MAJOR-MINOR CODE IS PLACED INTO A DATABASE
\
ð154ðð\ FILE AND THE FILE CAN BE PRINTED IN HEX USING COPYFILE.
\
ð155ðð\
\
ð156ðð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
ð157ðð\
ð158ðð GETFBA.
239 ð159ðð
MOVE MAJ-MIN TO RC.
24ð ð16ððð
MOVE "PROGRAM TERMINATED DUE TO ERROR IN INTFIL FILE"
ð161ðð
TO ERRMSG.
241 ð162ðð
WRITE PRINTREC.
242 ð163ðð
CLOSE INTFIL DSPFIL QPRINT.
243 ð164ðð
STOP RUN.
ð165ðð\
ð166ðð EXIT-DECLARATIVES.
ð167ðð
EXIT.
ð168ðð\
244 ð169ðð END DECLARATIVES.
ð17ððð\
ð171ðð START-PROGRAM SECTION.
ð172ðð\
ð173ðð START-PROGRAM-PARAGRAPH.
ð9/3ð/87
1ð/14/87
ð3/16/89
ð3/16/89
ð3/16/89
ð3/16/89
ð3/16/89
ð3/16/89
1ð/ð5/87
1ð/ð5/87
1ð/ð5/87
1ð/ð5/87
11/16/88
11/16/88
RCH38321 1ð/ð8/9ð 11:ð9:19
S COPYNAME
CHG DATE
11/21/88
11/16/88
1ð/13/87
ð3/16/89
ð3/16/89
ð3/16/89
ð3/16/89
ð3/16/89
ð3/16/89
11/21/88
11/21/88
11/21/88
1ð/ð5/9ð
1ð/ð5/9ð
ð9/3ð/87
ð1/14/88
ð9/3ð/87
ð1/14/88
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
1ð/ð5/9ð
11/3ð/88
11/3ð/88
11/3ð/88
11/3ð/88
11/3ð/88
11/3ð/88
11/3ð/88
11/3ð/88
ð3/16/89
ð3/16/89
ð3/16/89
1ð/ð5/9ð
ð3/16/89
ð3/16/89
ð3/16/89
ð9/3ð/87
ð9/3ð/87
ð1/14/88
11/21/88
ð1/14/88
ð9/3ð/87
11/21/88
ð9/3ð/87
1ð/ð2/87
ð9/3ð/87
ð3/15/89
ð9/3ð/87
ð9/3ð/87
11/18/88
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
Page
8
Figure D-10 (Part 6 of 13). Source Program Example — CSDINT
Appendix D. Program Examples
D-25
5738CB1 V2R1Mð 91ð524
AS/4ðð COBOL/4ðð Source
INTLIB/CSDINT
STMT SEQNBR -A 1 B..+....2....+....3....+....4....+....5....+....6....+....7..IDENTFCN
ð174ðð\.3/
245 ð175ðð
OPEN I-O
INTFIL DSPFIL
ð176ðð
OUTPUT QPRINT.
246 ð177ðð
MOVE ZEROS TO INTF-INDIC-AREA.
ð178ðð\
ð179ðð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
ð18ððð\
\
ð181ðð\ THE FOLLOWING TEST IS TO ATTEMPT RECOVERY IF AN ERROR
\
ð182ðð\ OCCURS WHEN OPENING THE ICF FILE.
\
ð183ðð\
\
ð184ðð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
ð185ðð\.4/
247 ð186ðð
IF ERR-SW = "1"
248 ð187ðð
THEN IF OPEN-COUNT IS = 9
249 ð188ðð
THEN PERFORM DETACH-ROUTINE THRU DETACH-EXIT
25ð ð189ðð
GO TO END-JOB
ð19ððð
ELSE
251 ð191ðð
ADD 1 TO OPEN-COUNT
252 ð192ðð
PERFORM ERROR-RECOVERY
253 ð193ðð
GO TO START-PROGRAM-PARAGRAPH
ð194ðð
ELSE
254 ð195ðð
MOVE ð TO OPEN-COUNT.
ð196ðð\
ð197ðð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
ð198ðð\
\
ð199ðð\
THE DISPLAY DEVICE IS IMPLICITLY ACQUIRED WHEN THE
\
ð2ðððð\
FILE IS OPENED.
\
ð2ð1ðð\
\
ð2ð2ðð\
ALL OF THE ICF PROGRAM DEVICES ARE EXPLICITLY ACQUIRED.
\
ð2ð3ðð\
\
ð2ð4ðð\
THE TARGET PROGRAM IS EVOKED TWICE, ONCE FOR EACH SESSION
\
ð2ð5ðð\
ACQUIRED, TO START TWO TRANSACTIONS.
\
ð2ð6ðð\
\
ð2ð7ðð\
THE MAIN INQUIRY MENU (CIMENU) IS WRITTEN TO THE USER'S
\
ð2ð8ðð\
DISPLAY.
\
ð2ð9ðð\
\
ð21ððð\
EVOKE TARGET PROGRAM "CTDINTCL" IN LIBRARY INTLIB.
\
ð211ðð\
\
ð212ðð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
ð213ðð\.5/
255 ð214ðð
ACQUIRE "ICFðð
" FOR INTFIL.
256 ð215ðð
ACQUIRE "ICFð1
" FOR INTFIL.
257 ð216ðð
PERFORM EVOKE-ROUTINE THRU EVOKE-EXIT.
ð217ðð\
258 ð218ðð
WRITE DSPREC FORMAT IS "CIMENU"
ð219ðð
INDICATORS ARE DSPF-INDIC-AREA.
ð22ððð\
ð221ðð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
ð222ðð\
\
ð223ðð\
DETERMINE USER'S REQUEST
\
ð224ðð\
\
ð225ðð\
A READ TO THE DISPLAY DEVICE IS ISSUED TO RECEIVE
\
ð226ðð\
THE USER'S REQUEST. THE TYPE OF REQUEST MADE IS BASED ON THE
\
ð227ðð\
DISPLAY FORMAT CURRENTLY ON THE SCREEN. THE RECORD FORMAT
\
ð228ðð\
NAME IS EXTRACTED FROM THE I/O FEEDBACK AREA FOR THE DISPLAY
\
5738CB1 V2R1Mð 91ð524
AS/4ðð COBOL/4ðð Source
INTLIB/CSDINT
STMT SEQNBR -A 1 B..+....2....+....3....+....4....+....5....+....6....+....7..IDENTFCN
ð229ðð\
FILE AND USED TO DETERMINE WHAT ACTION SHOULD BE TAKEN NEXT.
\
ð23ððð\
\
ð231ðð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
Figure D-10 (Part 7 of 13). Source Program Example — CSDINT
D-26
Intrasystem Communications Programming V4R1
RCH38321 1ð/ð8/9ð 11:ð9:19
S COPYNAME
CHG DATE
ð9/3ð/87
11/21/88
ð9/3ð/87
11/21/88
ð9/3ð/87
ð9/3ð/87
ð3/16/89
ð9/3ð/87
1ð/ð5/9ð
ð3/16/89
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
1ð/15/87
ð9/3ð/87
ð9/3ð/87
1ð/ð5/9ð
ð9/3ð/87
1ð/ð5/9ð
1ð/ð5/9ð
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
1ð/ð5/9ð
ð3/16/89
ð9/3ð/87
ð9/3ð/87
11/21/88
11/21/88
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
1ð/14/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
1ð/15/87
1ð/13/87
1ð/13/87
1ð/13/87
RCH38321 1ð/ð8/9ð 11:ð9:19
S COPYNAME
CHG DATE
1ð/13/87
ð9/3ð/87
ð9/3ð/87
Page
9
Page
1ð
ð232ðð\.6/
ð233ðð READRQ.
259 ð234ðð
READ DSPFIL INDICATORS ARE DSPF-INDIC-AREA.
26ð ð235ðð
IF RCD-FMT = "CIMENU"
261 ð236ðð
PERFORM MENU-ROUTINE THRU MENU-EXIT
262 ð237ðð
GO TO READRQ.
263 ð238ðð
IF RCD-FMT = "ITMMNU"
264 ð239ðð
PERFORM ITMIN-ROUTINE THRU ITMIN-EXIT
265 ð24ððð
GO TO READRQ.
266 ð241ðð
IF RCD-FMT = "ITMSC2"
267 ð242ðð
PERFORM ITMRTN-ROUTINE THRU ITMRTN-EXIT
268 ð243ðð
GO TO READRQ.
269 ð244ðð
IF RCD-FMT = "ITMSC3"
27ð ð245ðð
PERFORM ITMRTN-ROUTINE THRU ITMRTN-EXIT
271 ð246ðð
GO TO READRQ.
272 ð247ðð
IF RCD-FMT = "DTLMNU"
273 ð248ðð
PERFORM DTLIN-ROUTINE THRU DTLIN-EXIT
274 ð249ðð
GO TO READRQ.
275 ð25ððð
IF RCD-FMT = "DTLSCR"
276 ð251ðð
PERFORM DTLRTN-ROUTINE THRU DTLRTN-EXIT
277 ð252ðð
GO TO READRQ.
278 ð253ðð
WRITE DSPREC FORMAT IS "CIMENU".
ð254ðð\
279 ð255ðð
GO TO READRQ.
ð256ðð\
ð257ðð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
ð258ðð\
\
ð259ðð\
MAIN MENU
\
ð26ððð\
\
ð261ðð\
THE MAIN MENU IS READ TO DETERMINE THE REQUEST ENTERED
\
ð262ðð\
BY THE USER. IF CMD 1 (\IN99) IS PRESSED, THE PROGRAM
\
ð263ðð\
IS ENDED. IF OPTION = 1, AN ITEM INQUIRY MENU IS WRITTEN TO \
ð264ðð\
TO SCREEN. IF OPTION = 2, A CUSTOMER INQUIRY MENU IS
\
ð265ðð\
WRITTEN TO THE SCREEN.
\
ð266ðð\
\
ð267ðð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
ð268ðð\.7/
ð269ðð MENU-ROUTINE.
28ð ð27ððð
IF CMD-KEY = "ð1"
281 ð271ðð
PERFORM DETACH-ROUTINE THRU DETACH-EXIT
282 ð272ðð
GO TO END-JOB.
283 ð273ðð
IF OPTION = "1"
284 ð274ðð
WRITE DSPREC FORMAT IS "ITMMNU"
ð275ðð
ELSE
285 ð276ðð
WRITE DSPREC FORMAT IS "DTLMNU".
ð277ðð MENU-EXIT.
ð278ðð
EXIT.
ð279ðð\
ð28ððð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
ð281ðð\
\
ð282ðð\
ITEM INQUIRY
\
ð283ðð\
\
5738CB1 V2R1Mð 91ð524
AS/4ðð COBOL/4ðð Source
INTLIB/CSDINT
STMT SEQNBR -A 1 B..+....2....+....3....+....4....+....5....+....6....+....7..IDENTFCN
ð284ðð\
THE ITEM NUMBER REQUESTED BY THE USER ON THE ITEM INQUIRY
\
ð285ðð\
SCREEN IS CHECKED. THIS IS DETERMINED BY THE
\
ð286ðð\
DISPLAY RECORD FORMAT BEING PROCESSED - IN THIS CASE ITMMNU. \
ð287ðð\
\
ð288ðð\
IF CMD KEY 1 IS PRESSED, THE PROGRAM IS ENDED. IF CMD KEY 2 \
ð289ðð\
IS PRESSED, THE ITEM INQUIRY REQUEST IS CANCELED, AND THE
\
ð29ððð\
MAIN MENU (CIMENU) IS WRITTEN TO THE SCREEN.
\
ð291ðð\
\
ð292ðð\
IF AN ITEM NUMBER IS ENTERED, A ITEM INQUIRY REQUEST IS
\
ð293ðð\
SENT TO THE APPROPRIATE TARGET PROGRAM.
\
ð294ðð\
\
ð295ðð\
A CHECK IS MADE FOR THREE CONDITIONS FOLLOWING THE READ.
\
ð296ðð\
1) THE TARGET PROGRAM TIMED OUT, 2) NO DATA RECEIVED, AND
\
ð297ðð\
3) DATA RETURNED IN AN UNEXPECTED RECORD FORMAT.
\
ð298ðð\
\
ð299ðð\
IF THE TIMER RUNS OUT (MAJ-MIN = ð31ð) A MESSAGE
\
ð3ðððð\
IS WRITTEN TO THE SCREEN, ASKING TO TRY AGAIN OR END THE
\
ð3ð1ðð\
PROGRAM.
\
ð3ð2ðð\
\
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
1ð/12/87
1ð/12/87
1ð/12/87
ð9/3ð/87
11/18/88
ð9/3ð/87
11/18/88
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
1ð/12/87
1ð/12/87
1ð/12/87
1ð/12/87
1ð/12/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
11/18/88
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
RCH38321 1ð/ð8/9ð 11:ð9:19
S COPYNAME
CHG DATE
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð3/16/89
1ð/13/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
1ð/ð5/9ð
ð9/3ð/87
1ð/14/87
1ð/ð5/9ð
1ð/14/87
1ð/14/87
11/21/88
1ð/14/87
1ð/14/87
11/21/88
Page
11
Figure D-10 (Part 8 of 13). Source Program Example — CSDINT
Appendix D. Program Examples
D-27
ð3ð3ðð\
IF A RECEIVE FAIL INDICATION IS RECEIVED (IN-25 FLAG ON),
\
ð3ð4ðð\
AFTER THE READ OPERATION TO THE PROGRAM DEVICE,
\
ð3ð5ðð\
A FRESH ITEM MENU (ITMMNU) IS WRITTEN
\
ð3ð6ðð\
TO THE DISPLAY DEVICE.
\
ð3ð7ðð\
\
ð3ð8ðð\
IF NO DATA IS RECEIVED OR IF RECEIVE FAIL INDICATION
\
ð3ð9ðð\
IS RECEIVED ( IN-25 FLAG IS ON), AFTER THE READ OPERATION
\
ð31ððð\
TO THE PROGRAM DEVICE, THE REQUEST IS SENT AGAIN
\
ð311ðð\
AND THE READ OPERATION IS ISSUED TO THE PROGRAM DEVICE.
\
ð312ðð\
\
ð313ðð\
IF THE RECORD RETURNS WITH THE WRONG RECORD FORMAT, THE
\
ð314ðð\
PROGRAM WILL GO TO EXIT-FORMAT-ERR ROUTINE.
\
ð315ðð\
\
ð316ðð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
ð317ðð\.8/
286 ð318ðð ITMIN-ROUTINE.
287 ð319ðð
IF CMD-KEY = "ð1"
288 ð32ððð
PERFORM DETACH-ROUTINE THRU DETACH-EXIT
289 ð321ðð
GO TO END-JOB.
29ð ð322ðð
IF CMD-KEY = "ð2"
291 ð323ðð
WRITE DSPREC FORMAT IS "CIMENU"
292 ð324ðð
GO TO ITMIN-EXIT.
ð325ðð XITMIN.
293 ð326ðð
MOVE CORR ITMMNU-I TO ITMREQ-O.
\
\\ CORRESPONDING items for statement 293:
\
\\
ITEMNO
\
\\ End of CORRESPONDING items for statement 293
294 ð327ðð
MOVE "ICFð1
" TO PGM-DEV-NME.
295 ð328ðð
MOVE ZEROS TO INTF-INDIC-AREA.
296 ð329ðð
WRITE INTREC FORMAT IS "ITMREQ"
ð33ððð
TERMINAL IS PGM-DEV-NME.
ð331ðð TRY-AGAIN.
297 ð332ðð
MOVE "ICFð1
" TO PGM-DEV-NME.
298 ð333ðð
MOVE ZEROS TO INTF-INDIC-AREA.
299 ð334ðð
WRITE INTREC FORMAT IS "TIMER"
ð335ðð
TERMINAL IS PGM-DEV-NME.
5738CB1 V2R1Mð 91ð524
AS/4ðð COBOL/4ðð Source
INTLIB/CSDINT
STMT SEQNBR -A 1 B..+....2....+....3....+....4....+....5....+....6....+....7..IDENTFCN
3ðð ð336ðð
READ INTFIL
ð337ðð
INDICATORS ARE INTF-INDIC-AREA.
3ð1 ð338ðð
IF MAJ-MIN = "ð31ð"
3ð2 ð339ðð
WRITE DSPREC FORMAT IS "TIMOUT"
3ð3 ð34ððð
READ DSPFIL INDICATORS ARE DSPF-INDIC-AREA
3ð4 ð341ðð
IF TIMRSP = "1" GO TO TRY-AGAIN END-IF
3ð6 ð342ðð
IF TIMRSP = "2" GO TO END-JOB END-IF.
3ð8 ð343ðð
IF IN25-ON
3ð9 ð344ðð
WRITE DSPREC FORMAT IS "ITMMNU"
31ð ð345ðð
GO TO ITMIN-EXIT.
311 ð346ðð
IF RCD-FMT-NME IS NOT EQUAL "ITMRSP" GO TO EXIT-FORMAT-ERR.
313 ð347ðð
PERFORM ITMOUT-ROUTINE THRU ITMOUT-EXIT.
ð348ðð ITMIN-EXIT.
ð349ðð
EXIT.
ð35ððð\
ð351ðð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
ð352ðð\
\
ð353ðð\
PROCESS ITEM INFORMATION
\
ð354ðð\
\
ð355ðð\
THE ITEM RECORD RECEIVED FROM THE TARGET PROGRAM AND THE
\
ð356ðð\
INFORMATION ABOUT THE ITEM IS PROCESSED AND DISPLAYED.
\
ð357ðð\
IF ITEMNO IS ð OR LESS, IT IS AN INVALID REQUEST AND A FRESH \
ð358ðð\
ITEM MENU IS WRITTEN TO THE SCREEN. IF THE REQUEST IS
\
ð359ðð\
VALID, VALUES ARE CALCULATED BASED ON THE INFORMATION
\
ð36ððð\
RECEIVED.
\
ð361ðð\
\
ð362ðð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
Figure D-10 (Part 9 of 13). Source Program Example — CSDINT
D-28
Intrasystem Communications Programming V4R1
11/21/88
11/21/88
11/21/88
11/21/88
1ð/14/87
ð3/16/89
11/21/88
1ð/ð5/9ð
1ð/ð5/9ð
1ð/14/87
1ð/14/87
1ð/14/87
1ð/14/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
1ð/12/87
1ð/12/87
1ð/12/87
1ð/12/87
1ð/12/87
11/18/88
11/18/88
ð9/3ð/87
11/21/88
11/21/88
ð9/3ð/87
1ð/ð1/87
1ð/ð8/9ð
11/28/88
11/28/88
11/28/88
RCH38321 1ð/ð8/9ð 11:ð9:19
S COPYNAME
CHG DATE
1ð/ð5/9ð
1ð/ð5/9ð
1ð/ð1/87
ð9/3ð/87
ð9/3ð/87
ð1/21/88
ð1/21/88
11/16/88
11/16/88
11/16/88
11/28/88
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
11/18/88
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
Page
12
ð363ðð\.9/
ð364ðð ITMOUT-ROUTINE.
ð365ðð
MOVE DESC OF ITMRSP-I TO DSC OF ITMSC2-O.
ð366ðð
MOVE QTYLST OF ITMRSP-I TO QAVAIL OF ITMSC2-O.
ð367ðð
MOVE QTYOO OF ITMRSP-I TO QTYO OF ITMSC2-O.
ð368ðð
MOVE QTYOH OF ITMRSP-I TO QTYH OF ITMSC2-O.
ð369ðð
MOVE QTYBO OF ITMRSP-I TO QTYB OF ITMSC2-O.
ð37ððð
MOVE UNITQ OF ITMRSP-I TO UNT OF ITMSC2-O.
ð371ðð
MOVE PRð1 OF ITMRSP-I TO PR1 OF ITMSC2-O.
ð372ðð
MOVE PRð5 OF ITMRSP-I TO PR5 OF ITMSC2-O.
ð373ðð
MOVE UFRT OF ITMRSP-I TO UFR OF ITMSC2-O.
ð374ðð
WRITE DSPREC FORMAT IS "ITMSC2"
ð375ðð
INDICATORS ARE DSPF-INDIC-AREA.
ð376ðð ITMOUT-EXIT.
ð377ðð
EXIT.
ð378ðð\
ð379ðð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
ð38ððð\
\
ð381ðð\
ADDITIONAL ITEM INFORMATION
\
ð382ðð\
\
ð383ðð\
ADDITIONAL ITEM INFORMATION IS PROCESSED AND THE RESULT
\
ð384ðð\
DISPLAYED ON THE SCREEN WHEN A RESPONSE IS READ FROM THE
\
ð385ðð\
DISPLAY STATION WITH AN ITEM SCREEN RECORD FORMAT.
\
ð386ðð\
\
ð387ðð\
IF CMD KEY 1 IS PRESSED, THE PROGRAM IS ENDED. IF CMD KEY 2 \
ð388ðð\
IS PRESSED, THE ITEM INQUIRY IS ENDED, AND THE MAIN MENU
\
ð389ðð\
(CIMENU) IS WRITTEN TO THE SCREEN. IF CMD KEY 3 IS PRESSED, \
ð39ððð\
THE ITEM INQUIRY MENU IS WRITTEN TO THE SCREEN. BY PRESSING \
5738CB1 V2R1Mð 91ð524
AS/4ðð COBOL/4ðð Source
INTLIB/CSDINT
STMT SEQNBR -A 1 B..+....2....+....3....+....4....+....5....+....6....+....7..IDENTFCN
ð391ðð\
ENTER WHEN SCREEN 2 IS DISPLAYED, MORE INFORMATION (PROFIT- \
ð392ðð\
LOSS) IS WRITTEN TO THE SCREEN. IF SCREEN 3 IS DISPLAYED,
\
ð393ðð\
PRESSING ENTER WILL CAUSE THE ITEM INQUIRY MENU TO BE
\
ð394ðð\
WRITTEN TO THE SCREEN.
\
ð395ðð\
\
ð396ðð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
ð397ðð\.1ð/
325 ð398ðð ITMRTN-ROUTINE.
326 ð399ðð
IF CMD-KEY = "ð1"
327 ð4ðððð
PERFORM DETACH-ROUTINE THRU DETACH-EXIT
328 ð4ð1ðð
GO TO END-JOB.
329 ð4ð2ðð
IF CMD-KEY = "ð2"
33ð ð4ð3ðð
WRITE DSPREC FORMAT IS "CIMENU"
331 ð4ð4ðð
GO TO ITMRTN-EXIT.
332 ð4ð5ðð
IF CMD-KEY = "ð3"
333 ð4ð6ðð
WRITE DSPREC FORMAT IS "ITMMNU"
334 ð4ð7ðð
GO TO ITMRTN-EXIT.
335 ð4ð8ðð
IF RCD-FMT = "ITMSC2"
336 ð4ð9ðð
PERFORM PROFIT-LOSS THRU PROFIT-LOSS-EXIT
337 ð41ððð
WRITE DSPREC FORMAT IS "ITMSC3"
338 ð411ðð
GO TO ITMRTN-EXIT.
339 ð412ðð
WRITE DSPREC FORMAT IS "ITMMNU".
ð413ðð ITMRTN-EXIT.
ð414ðð
EXIT.
ð415ðð\
ð416ðð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
ð417ðð\
\
ð418ðð\
PROFIT AND LOSS FIGURES ARE CALCULATED FOR THE ITEM NUMBER
\
ð419ðð\
REQUESTED. THESE ARE USED IN SCREEN TWO OF THE ITEM.
\
ð42ððð\
\
ð421ðð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
ð422ðð\.11/
34ð ð423ðð PROFIT-LOSS.
ð424ðð\
341 ð425ðð
SUBTRACT SLSTM OF ITMRSP-I FROM
ð426ðð
CSTTM OF ITMRSP-I GIVING PROFM.
342 ð427ðð
MULTIPLY PROFM BY 1ðð GIVING PROFM.
343 ð428ðð
IF SLSTM OF ITMRSP-I GREATER THAN ð
344 ð429ðð
DIVIDE PROFM BY SLSTM OF ITMRSP-I GIVING PROFM.
345 ð43ððð
MULTIPLY QTYLST OF ITMRSP-I BY
ð431ðð
PRð1 OF ITMRSP-I GIVING LOSTS.
346 ð432ðð
MOVE SLSTM OF ITMRSP-I TO SLSM OF ITMSC3-O.
347 ð433ðð
MOVE SLSTY OF ITMRSP-I TO SLSY OF ITMSC3-O.
348 ð434ðð
MOVE CSTTM OF ITMRSP-I TO CSTM OF ITMSC3-O.
349 ð435ðð
MOVE PROFM TO PROFIT OF ITMSC3-O.
35ð ð436ðð
MOVE CSTTY OF ITMRSP-I TO CSTY OF ITMSC3-O.
ð437ðð PROFIT-LOSS-EXIT.
ð438ðð
EXIT.
ð439ðð\
314
315
316
317
318
319
32ð
321
322
323
324
ð9/3ð/87
ð9/3ð/87
11/18/88
11/18/88
11/18/88
11/18/88
11/18/88
11/18/88
11/18/88
11/18/88
11/18/88
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
1ð/14/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
1ð/13/87
1ð/14/87
ð3/16/89
1ð/14/87
1ð/14/87
1ð/14/87
1ð/14/87
RCH38321 1ð/ð8/9ð 11:ð9:19
S COPYNAME
CHG DATE
1ð/14/87
1ð/14/87
1ð/14/87
ð3/16/89
ð3/16/89
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
1ð/12/87
1ð/12/87
ð9/3ð/87
1ð/12/87
1ð/12/87
ð9/3ð/87
1ð/12/87
1ð/12/87
1ð/12/87
1ð/12/87
1ð/12/87
1ð/12/87
1ð/12/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
1ð/13/87
1ð/13/87
ð9/3ð/87
ð9/3ð/87
ð3/17/89
ð9/3ð/87
ð3/17/89
11/18/88
11/18/88
ð9/3ð/87
11/18/88
11/18/88
11/18/88
11/18/88
11/18/88
11/18/88
11/18/88
11/18/88
11/18/88
ð9/3ð/87
ð9/3ð/87
11/18/88
Page
13
Figure D-10 (Part 10 of 13). Source Program Example — CSDINT
Appendix D. Program Examples
D-29
ð44ððð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
ð441ðð\
\
ð442ðð\
CUSTOMER INQUIRY
\
ð443ðð\
\
ð444ðð\
THE REQUEST FROM THE CUSTOMER INQUIRY MENU IS PROCESSED.
\
ð445ðð\
IF CMD KEY 1 IS PRESSED, THE PROGRAM IS ENDED. IF CMD KEY 2 \
5738CB1 V2R1Mð 91ð524
AS/4ðð COBOL/4ðð Source
INTLIB/CSDINT
STMT SEQNBR -A 1 B..+....2....+....3....+....4....+....5....+....6....+....7..IDENTFCN
ð446ðð\
IS PRESSED, THE MAIN MENU (CIMENU) IS WRITTEN TO THE SCREEN. \
ð447ðð\
\
ð448ðð\
IF A CUSTOMER NUMBER IS ENTERED, THE CUSTOMER INQUIRY
\
ð449ðð\
REQUEST IS SENT, THEN DTOUT-ROUTINE THRU DTOUT-EXIT EXECUTE. \
ð45ððð\
\
ð451ðð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
ð452ðð\.12/
351 ð453ðð DTLIN-ROUTINE.
352 ð454ðð
IF CMD-KEY = "ð1"
353 ð455ðð
PERFORM DETACH-ROUTINE THRU DETACH-EXIT
354 ð456ðð
GO TO END-JOB.
355 ð457ðð
IF CMD-KEY = "ð2"
356 ð458ðð
WRITE DSPREC FORMAT IS "CIMENU"
357 ð459ðð
GO TO DTLIN-EXIT.
ð46ððð EVDTL.
358 ð461ðð
MOVE "ICFðð
" TO PGM-DEV-NME.
359 ð462ðð
MOVE CORR DTLMNU-I TO DTLREQ-O.
\
\\ CORRESPONDING items for statement 359:
\
\\
CUSTNO
\
\\ End of CORRESPONDING items for statement 359
36ð ð464ðð
WRITE INTREC FORMAT IS "DTLREQ"
ð465ðð
TERMINAL IS PGM-DEV-NME.
361 ð466ðð
PERFORM CUSTOMER-DETAIL THRU CUSTOMER-DETAIL-EXIT.
ð467ðð DTLIN-EXIT.
ð468ðð
EXIT.
ð49ððð\
ð491ðð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
ð492ðð\
\
ð493ðð\
THIS ROUTINE HANDLES THE USER'S REQUEST FOLLOWING THE
\
ð494ðð\
THE DISPLAY OF THE CUSTOMER INFORMATION. CMD KEY 1 WILL
\
ð495ðð\
EXIT THE JOB, CMD KEY 2 WILL DISPLAY THE MAIN MENU, AND
\
ð496ðð\
"ENTER" WILL BRING UP THE CUSTOMER INQUIRY MENU.
\
ð497ðð\
\
ð498ðð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
ð499ðð\.13/
362 ð5ðððð DTLRTN-ROUTINE.
363 ð5ð1ðð
IF CMD-KEY = "ð1"
364 ð5ð2ðð
PERFORM DETACH-ROUTINE THRU DETACH-EXIT
365 ð5ð3ðð
GO TO END-JOB.
366 ð5ð4ðð
IF CMD-KEY = "ð2"
367 ð5ð5ðð
WRITE DSPREC FORMAT IS "CIMENU"
368 ð5ð6ðð
GO TO DTLRTN-EXIT.
369 ð5ð7ðð
WRITE DSPREC FORMAT IS "DTLMNU".
ð5ð8ðð DTLRTN-EXIT.
ð5ð9ðð
EXIT.
ð51ððð\
ð511ðð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
ð512ðð\
\
ð513ðð\
THE READ OPERATION TO THE PROGRAM DEVICE IS ISSUED.
\
ð514ðð\
A CHECK IS MADE FOR THREE CONDITIONS FOLLOWING THE READ.
\
ð515ðð\
1) THE TARGET PROGRAM TIMED OUT, 2) NO DATA RECEIVED, AND
\
ð516ðð\
3) DATA RETURNED IN AN UNEXPECTED RECORD FORMAT.
\
ð517ðð\
\
ð518ðð\
IF THE TARGET PROGRAM TIMES OUT (MAJ-MIN = ð31ð), A MESSAGE
\
ð519ðð\
IS WRITTEN TO THE SCREEN, ASKING TO TRY AGAIN OR END THE
\
5738CB1 V2R1Mð 91ð524
AS/4ðð COBOL/4ðð Source
INTLIB/CSDINT
STMT SEQNBR -A 1 B..+....2....+....3....+....4....+....5....+....6....+....7..IDENTFCN
ð52ððð\
PROGRAM.
\
ð521ðð\
\
ð522ðð\
IF A RECEIVE FAIL INDICATION IS RECEIVED (IN-25 FLAG ON),
\
ð523ðð\
AFTER THE READ OPERATION TO THE PROGRAM DEVICE,
\
ð524ðð\
A FRESH CUSTOMER MENU (CIMENU) IS WRITTEN
\
ð525ðð\
TO THE DISPLAY DEVICE.
\
ð526ðð\
\
ð527ðð\
IF NO DATA IS RECEIVED AFTER THE READ OPERATION TO THE
\
ð528ðð\
PROGRAM DEVICE (MAJ-MIN = ð3__) THE REQUEST IS SENT AGAIN
\
ð529ðð\
TO THE TARGET PROGRAM AND THE READ OPERATION IS ISSUED TO
\
ð53ððð\
THE ICF PROGRAM DEVICE.
\
ð531ðð\
\
ð532ðð\
IF THE RECORD RETURNS WITH THE WRONG RECORD FORMAT, THE
\
ð533ðð\
PROGRAM WILL GO TO EXIT-FORMAT-ERR ROUTINE.
\
ð534ðð\
\
ð535ðð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
Figure D-10 (Part 11 of 13). Source Program Example — CSDINT
D-30
Intrasystem Communications Programming V4R1
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
1ð/13/87
RCH38321 1ð/ð8/9ð 11:ð9:19
S COPYNAME
CHG DATE
1ð/14/87
ð9/3ð/87
ð9/3ð/87
ð3/16/89
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
1ð/12/87
1ð/12/87
1ð/12/87
1ð/12/87
1ð/12/87
ð9/3ð/87
ð9/3ð/87
11/18/88
11/21/88
ð9/3ð/87
1ð/ð8/9ð
ð9/3ð/87
ð9/3ð/87
1ð/14/87
1ð/12/87
ð3/16/89
ð3/16/89
ð3/16/89
ð3/16/89
ð3/16/89
ð3/16/89
1ð/12/87
1ð/ð8/9ð
1ð/12/87
1ð/12/87
1ð/12/87
1ð/12/87
1ð/12/87
1ð/12/87
1ð/12/87
1ð/12/87
1ð/12/87
1ð/12/87
1ð/12/87
ð3/16/89
ð3/16/89
ð3/16/89
ð3/16/89
1ð/ð5/9ð
ð3/16/89
ð3/16/89
ð3/16/89
ð3/16/89
RCH38321 1ð/ð8/9ð 11:ð9:19
S COPYNAME
CHG DATE
ð3/16/89
ð3/16/89
ð3/16/89
ð3/16/89
ð3/16/89
ð3/16/89
ð3/16/89
ð3/16/89
1ð/ð5/9ð
ð3/16/89
1ð/ð5/9ð
ð3/16/89
ð3/16/89
ð3/16/89
ð3/16/89
ð3/16/89
Page
14
Page
15
ð536ðð\
ð537ðð\.14/
37ð ð538ðð CUSTOMER-DETAIL.
371 ð539ðð
MOVE ZEROS TO INTF-INDIC-AREA.
372 ð54ððð
MOVE "ICFðð
" TO PGM-DEV-NME.
373 ð541ðð
WRITE INTREC FORMAT IS "TIMER"
ð542ðð
TERMINAL IS PGM-DEV-NME.
374 ð543ðð
READ INTFIL
ð544ðð
INDICATORS ARE INTF-INDIC-AREA.
375 ð545ðð
IF MAJ-MIN = "ð31ð"
376 ð546ðð
WRITE DSPREC FORMAT IS "TIMOUT"
377 ð547ðð
READ DSPFIL INDICATORS ARE DSPF-INDIC-AREA
378 ð548ðð
IF TIMRSP = "1" GO TO CUSTOMER-DETAIL END-IF
38ð ð549ðð
IF TIMRSP = "2" GO TO END-JOB END-IF.
382 ð55ððð
IF IN25-ON
383 ð551ðð
WRITE DSPREC FORMAT IS "CIMENU"
384 ð552ðð
GO TO CUSTOMER-DETAIL-EXIT.
385 ð553ðð
IF MAJ = "ð3"
386 ð554ðð
MOVE ZEROS TO INTF-INDIC-AREA
387 ð555ðð
WRITE INTREC FORMAT IS "DTLREQ"
ð556ðð
TERMINAL IS PGM-DEV-NME
388 ð557ðð
GO TO CUSTOMER-DETAIL.
389 ð558ðð
MOVE CUSTNO OF DTLRSP-I TO CUSTN OF DTLSCR-O.
39ð ð559ðð
MOVE DNAME OF DTLRSP-I TO CNAME OF DTLSCR-O.
391 ð56ððð
MOVE DLSTOR OF DTLRSP-I TO DLSTR OF DTLSCR-O.
392 ð561ðð
MOVE DSLSTM OF DTLRSP-I TO DSLSM OF DTLSCR-O.
393 ð562ðð
MOVE DSPMð1 OF DTLRSP-I TO DSPM1 OF DTLSCR-O.
394 ð563ðð
MOVE DSPMð2 OF DTLRSP-I TO DSPM2 OF DTLSCR-O.
395 ð564ðð
MOVE DSTTYD OF DTLRSP-I TO DSTYD OF DTLSCR-O.
396 ð565ðð
MOVE IDEPT OF DTLRSP-I TO DEPT OF DTLSCR-O.
397 ð566ðð
WRITE DSPREC FORMAT IS "DTLSCR".
ð567ðð CUSTOMER-DETAIL-EXIT.
ð568ðð
EXIT.
5738CB1 V2R1Mð 91ð524
AS/4ðð COBOL/4ðð Source
INTLIB/CSDINT
STMT SEQNBR -A 1 B..+....2....+....3....+....4....+....5....+....6....+....7..IDENTFCN
ð569ðð/
ð57ððð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
ð571ðð\
\
ð572ðð\
THE EVOKE-ROUTINE IS CALLED TO EVOKE THE TARGET PROGRAM.
\
ð573ðð\
THE SAME TARGET PROGRAM (INTLIB/CTDINTCL) IS EVOKED TWICE,
\
ð574ðð\
CREATING TWO DIFFERENT JOBS. THE PROGRAM DEVICE IS USED TO
\
ð575ðð\
IDENTIFY THEM.
\
ð576ðð\
\
ð577ðð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
ð578ðð\
ð579ðð\.15/
398 ð58ððð EVOKE-ROUTINE.
399 ð581ðð
MOVE "CTDINTCL" TO PGMID OF EVKREQ-O.
4ðð ð582ðð
MOVE "INTLIB" TO LIB OF EVKREQ-O.
4ð1 ð583ðð
MOVE "ICFðð
" TO PGM-DEV-NME
4ð2 ð584ðð
WRITE INTREC FORMAT IS "EVKREQ"
ð585ðð
TERMINAL IS PGM-DEV-NME.
4ð3 ð586ðð
MOVE "ICFð1
" TO PGM-DEV-NME
4ð4 ð587ðð
WRITE INTREC FORMAT IS "EVKREQ"
ð588ðð
TERMINAL IS PGM-DEV-NME.
ð589ðð EVOKE-EXIT.
ð59ððð
EXIT.
ð591ðð\
ð592ðð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
ð593ðð\
\
ð594ðð\
THE TRANSACTION AND SESSION ARE ENDED WITH EACH OF THE
\
ð595ðð\
TARGET PROGRAMS.
\
ð596ðð\
\
ð597ðð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
ð598ðð\.16/
4ð5 ð599ðð ERROR-RECOVERY.
4ð6 ð6ðððð
PERFORM DETACH-ROUTINE THRU DETACH-EXIT.
4ð7 ð6ð1ðð
CLOSE INTFIL DSPFIL
ð6ð2ðð
QPRINT.
4ð8 ð6ð3ðð
MOVE "ð" TO ERR-SW.
ð6ð4ðð ERROR-RECOVERY-EXIT.
ð6ð5ðð
EXIT.
ð6ð6ðð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
ð6ð7ðð\
\
ð6ð8ðð\ EXIT-FORMAT-ERR IS PERFORMED WHEN A READ TO INTFIL RETURNS WITH \
ð6ð9ðð\ AN UNEXPECTED RCD-FMT-NME IN THE I-O-FEEDBACK AREA FOR INTFIL.
\
ð61ððð\ AN ERROR MESSAGE IS PRINTED AND THE PROGRAM ENDS.
\
ð611ðð\
\
ð612ðð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
ð3/17/89
1ð/ð8/9ð
ð9/3ð/87
11/21/88
1ð/ð8/9ð
11/28/88
11/28/88
1ð/ð5/9ð
1ð/ð5/9ð
1ð/ð1/87
ð9/3ð/87
ð9/3ð/87
ð1/21/88
ð1/21/88
11/16/88
11/16/88
11/16/88
ð9/3ð/87
11/21/88
11/21/88
ð9/3ð/87
ð9/3ð/87
11/18/88
ð3/15/89
11/18/88
11/18/88
11/18/88
11/18/88
11/18/88
11/18/88
1ð/12/87
ð9/3ð/87
ð9/3ð/87
RCH38321 1ð/ð8/9ð 11:ð9:19
S COPYNAME
CHG DATE
ð9/3ð/87
ð3/16/89
ð3/16/89
ð3/16/89
ð3/16/89
ð3/16/89
ð3/16/89
ð3/16/89
ð3/16/89
ð3/17/89
1ð/ð8/9ð
ð9/3ð/87
11/18/88
ð3/16/89
ð9/3ð/87
11/21/88
ð9/3ð/87
ð9/3ð/87
11/21/88
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð3/16/89
ð3/16/89
ð3/16/89
ð3/16/89
ð3/16/89
ð3/16/89
1ð/ð8/9ð
ð9/3ð/87
ð9/3ð/87
11/21/88
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð9/3ð/87
ð3/16/89
ð3/16/89
ð3/16/89
ð3/16/89
ð3/16/89
ð3/16/89
ð3/16/89
Page
16
Figure D-10 (Part 12 of 13). Source Program Example — CSDINT
Appendix D. Program Examples
D-31
ð613ðð\.17/
1ð/ð8/9ð
ð614ðð EXIT-FORMAT-ERR.
1ð/ð1/87
ð615ðð
MOVE MAJ-MIN TO RC.
ð1/14/88
ð616ðð
MOVE "RECORD FORMAT IS INCORRECT ON READ
"
1ð/ð1/87
ð617ðð
TO ERRMSG.
ð1/14/88
412 ð618ðð
WRITE PRINTREC.
1ð/ð1/87
413 ð619ðð
CLOSE INTFIL DSPFIL QPRINT.
11/21/88
414 ð62ððð
STOP RUN.
1ð/ð1/87
ð621ðð\
ð9/3ð/87
ð622ðð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
ð3/16/89
ð623ðð\
\
ð3/16/89
5738CB1 V2R1Mð 91ð524
AS/4ðð COBOL/4ðð Source
INTLIB/CSDINT
RCH38321 1ð/ð8/9ð 11:ð9:19
STMT SEQNBR -A 1 B..+....2....+....3....+....4....+....5....+....6....+....7..IDENTFCN S COPYNAME
CHG DATE
ð624ðð\
THIS ROUTINE IS CALLED TO END THE TRANSACTIONS WITH THE
\
ð3/16/89
ð625ðð\
TARGET PROGRAMS.
\
ð3/16/89
ð626ðð\
\
ð3/16/89
ð627ðð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
ð3/16/89
ð628ðð\.18/
1ð/ð8/9ð
ð629ðð DETACH-ROUTINE.
ð9/3ð/87
415 ð63ððð
MOVE "ICFðð
" TO PGM-DEV-NME
ð9/3ð/87
416 ð631ðð
WRITE INTREC FORMAT IS "DETACH"
11/21/88
ð632ðð
TERMINAL IS PGM-DEV-NME.
ð9/3ð/87
417 ð633ðð
MOVE "ICFð1
" TO PGM-DEV-NME
ð9/3ð/87
418 ð634ðð
WRITE INTREC FORMAT IS "DETACH"
11/21/88
ð635ðð
TERMINAL IS PGM-DEV-NME.
ð9/3ð/87
ð636ðð DETACH-EXIT.
ð9/3ð/87
ð637ðð
EXIT.
ð9/3ð/87
ð638ðð\
ð9/3ð/87
ð639ðð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
ð3/16/89
ð64ððð\
\
ð3/16/89
ð641ðð\
THIS ROUTINE IS CALLED TO RELEASE THE PROGRAM DEVICES, END
\
ð3/16/89
ð642ðð\
THE SESSIONS, AND END THE PROGRAM.
\
ð3/16/89
ð643ðð\
\
ð3/16/89
ð644ðð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
ð3/16/89
ð645ðð\.19/
1ð/ð8/9ð
ð646ðð\
ð9/3ð/87
419 ð647ðð END-JOB.
ð9/3ð/87
42ð ð648ðð
DROP "ICFðð
" FROM INTFIL.
11/21/88
421 ð649ðð
DROP "ICFð1
" FROM INTFIL.
11/21/88
422 ð65ððð
CLOSE INTFIL DSPFIL QPRINT.
11/21/88
423 ð651ðð
STOP RUN.
ð9/3ð/87
\ \ \ \ \
E N D
O F
S O U R C E
\ \ \ \ \
5738CB1 V2R1Mð 91ð524
AS/4ðð COBOL/4ðð Messages
INTLIB/CSDINT
RCH38321 1ð/ð8/9ð 11:ð9:19
STMT
\
25 MSGID: LBLð6ðð SEVERITY: 1ð SEQNBR: ðð47ðð
Message . . . . :
No INPUT fields found for format DETACH.
\
25 MSGID: LBLð6ðð SEVERITY: 1ð SEQNBR: ðð47ðð
Message . . . . :
No OUTPUT fields found for format DETACH.
\
25 MSGID: LBLð6ðð SEVERITY: 1ð SEQNBR: ðð47ðð
Message . . . . :
No INPUT fields found for format EOS.
\
25 MSGID: LBLð6ðð SEVERITY: 1ð SEQNBR: ðð47ðð
Message . . . . :
No OUTPUT fields found for format EOS.
\
25 MSGID: LBLð6ðð SEVERITY: 1ð SEQNBR: ðð47ðð
Message . . . . :
No INPUT fields found for format EVKREQ.
\
25 MSGID: LBLð6ðð SEVERITY: 1ð SEQNBR: ðð47ðð
Message . . . . :
No INPUT fields found for format TIMER.
\
25 MSGID: LBLð6ðð SEVERITY: 1ð SEQNBR: ðð47ðð
Message . . . . :
No OUTPUT fields found for format TIMER.
\ 1ð3 MSGID: LBLð6ðð SEVERITY: 1ð SEQNBR: ðð51ðð
Message . . . . :
No OUTPUT fields found for format CIMENU.
\ 1ð3 MSGID: LBLð6ðð SEVERITY: 1ð SEQNBR: ðð51ðð
Message . . . . :
No OUTPUT fields found for format DTLMNU.
\ 1ð3 MSGID: LBLð6ðð SEVERITY: 1ð SEQNBR: ðð51ðð
Message . . . . :
No OUTPUT fields found for format ITMMNU.
\ 1ð3 MSGID: LBLð6ðð SEVERITY: 1ð SEQNBR: ðð51ðð
Message . . . . :
No OUTPUT fields found for format TIMOUT.
\ \ \ \ \
E N D
O F
M E S S A G E S
\ \ \ \ \
Message Summary
Total
Info(ð-4)
Warning(5-19)
Error(2ð-29)
Severe(3ð-39)
Terminal(4ð-99)
11
ð
11
ð
ð
ð
Source records read . . . . . . . . :
629
Copy records read . . . . . . . . . :
212
Copy members processed . . . . . . :
2
Sequence errors . . . . . . . . . . :
ð
Highest severity message issued . . :
1ð
LBLð9ð1 ðð Program CSDINT created in library INTLIB.
\ \ \ \ \
E N D
O F
C O M P I L A T I O N
\ \ \ \ \
4ð9
41ð
411
Figure D-10 (Part 13 of 13). Source Program Example — CSDINT
D-32
Intrasystem Communications Programming V4R1
Page
17
Page
18
COBOL/400 Target Program for a
Two-Session Inquiry
operations, and receive response indicators on input
operations.
.2/
The following describes the COBOL/400 target program for a
two-session inquiry.
Program Files: The COBOL/400 two-session target
program uses the following files:
CFILE
An ICF file used to send records to and
receive records from the source program. It is
done with the file-level INDARA DDS keyword,
indicating a separate indicator area.
PFILE
A database file used to retrieve the record for
the item requested from the source program.
QPRINT
An AS/400 printer file used to print records,
both sent and received, as well as major and
minor ICF return codes.
If any other error has occurred, the program prints a
message saying that the program ended abnormally
and then ends.
.3/
.4/
The RECEIVE-DATA routine reads data from the
program device (CFILE) through a perform statement
until a turnaround indication is received. The
program then goes to section 5 to read the database
file. When a turnaround indication is received, indicator 40 is set on, as defined by the RCVTRNRND
DDS keyword in the DDS source file for the ICF file.
.5/
The program uses the requested number received
from the source program to access the record from
the database. The information retrieved from the
database file (PFILE) is moved to the work area for
the ICF file. A write operation is issued to the
program device using record format SNDPART. The
write operation sends the requested information back
to the source program.
ICF File Creation and Program Device Entry Definition:
The command needed to create the ICF file is:
CRTICFF FILE(INTLIB/CFILE)
SRCFILE(INTLIB/QINTSRC) SRCMBR(CFILE)
ACQPGMDEV(RQSDEV)
TEXT("TARGET ICF FILE FOR TWO SESSION
PROGRAM")
If the requested number is not found, a fail indication
is sent to the requesting program using a write operation with a fail operation.
The command needed to define the program device entry is:
OVRICFDEVE PGMDEV(RQSDEV)
RMTLOCNAME(\REQUESTER)
Program Explanation: The following explains the structure
of the program example illustrated in Figure D-13 on
page D-35. The ICF file used in the example is defined by
the user, and uses externally described data formats (DDS).
The reference letters in the example below correspond to
those in the following program example.
.1/
If an error occurs on the write operation, control
passes to section 2.
If no error occurs on the write, control goes back to
section 4.
.6/
A read operation is issued to the program device.
If a detach indication is received, the program goes to
section 8 to end the program. When a detach is
received, indicator 44 is set on, as defined by the
RCVDETACH keyword in the DDS for the ICF file.
This section defines the ICF file (CFILE) and the
database file (PFILE) used in the program.
CFILE is the ICF file used to send records to and
receive records from the remote program.
This routine opens all the files.
Because the ICF file was created using the
ACQPGMDEV parameter, the session associated
with the target program is automatically acquired
when the file is opened.
DDS Source: The DDS for the ICF file (CFILE) is illustrated
in Figure D-11 on page D-34.
The DDS source for the database file (PFILE) is illustrated in
Figure D-12 on page D-34.
This section defines the error handling for the
program. The CFILE routine first checks the
major/minor return code to determine if the error is
recoverable.
.7/
This routine is called to end the program.
The following message is written to the printer file:
MAJ-MIN is the variable name used to check for the
ICF file return codes.
CTDINT HAS COMPLETED NORMALLY
CMNF-INDIC-AREA is the indicator area used with
the ICF file to choose options on DDS keywords and
The files are closed. The program device is automatically released as a result of the close operation and
the program ends.
Appendix D. Program Examples
D-33
5714PW1 Rð1Mðð 88ð3ð1
SEU SOURCE LISTING
1ð/14/87 17:2ð:35
SOURCE FILE . . . . . . . QINTSRC/INTLIB
MEMBER . . . . . . . . . PFILE
SEQNBR\...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8 ...+... 9 ...+... ð
A\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
A\
\
A\
ICF FILE
\
A\
USED IN TARGET TWO SESSION PROGRAM
\
A\
\
A\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
A
INDARA
A ð5
RQSWRT
A 1ð
ALWWRT
A
INDTXT(1ð '1ð END TRANS.')
A 15
EOS
A 2ð
FAIL
A
INDTXT(2ð '2ð F ABORT ST')
A
RCVFAIL(25 'RECEIVED FAIL')
A 3ð
DETACH
A
INDTXT(3ð '3ð>DETACH TGT')
A
RCVDETACH(44 'RECV DETACH')
A
RCVTRNRND(4ð 'END OF TRN')
A
R SNDPART
A
INVITE
A
RECTYP
1
A
ITEMNO
6
A
EDATA
13ð
A
FILL1
13
A
R RCVPART
A
RECID2
6
A
PARTDS
8ð
A
FILL4
64
PAGE 1
Figure D-11. DDS Source for a Two-Session Target Program Using CFILE
5714PW1 Rð1Mðð 88ð3ð1
SEU SOURCE LISTING
1ð/16/87 ð7:43:14
SOURCE FILE . . . . . . . QINTSRC/INTLIB
MEMBER . . . . . . . . . PFILE
SEQNBR\...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8 ...+... 9 ...+... ð
1ðð
A
LIFO
2ðð
A
R DBREC
3ðð
A
RECCUS
1
4ðð
A
DBSEQ
6
5ðð
A
DBDATA
13ð
6ðð
A
DBFILL
13
7ðð
A
K DBSEQ
\ \ \ \ E N D O F S O U R C E \ \ \ \
Figure D-12. DDS Source for a Two-Session Target Program Using PFILE
D-34
Intrasystem Communications Programming V4R1
PAGE 1
ð7/ð2/87
ð5/ð6/87
1ð/ð1/87
ð8/18/87
ð7/ð2/87
1ð/ð1/87
ð7/ð4/87
5738CB1 V2R1Mð 91ð524
IBM AS/4ðð COBOL/4ðð
INTLIB/CTDINT
RCH38321 1ð/ð5/9ð 16:14:43
Program . . . . . . . . . . . . . . :
CTDINT
Library . . . . . . . . . . . . . :
INTLIB
Source file . . . . . . . . . . . . :
QINTSRC
Library . . . . . . . . . . . . . :
INTLIB
Source member . . . . . . . . . . . :
CTDINT
1ð/ð5/9ð 15:28:14
Generation severity level . . . . . :
29
Text 'description' . . . . . . . . . :
COBOL Target Intra Example Program
Source listing options . . . . . . . :
\SOURCE
Generation options . . . . . . . . . :
\NONE
Message limit:
Number of messages . . . . . . . . :
\NOMAX
Message limit severity . . . . . . :
29
Print file . . . . . . . . . . . . . :
QSYSPRT
Library . . . . . . . . . . . . . :
\LIBL
FIPS flagging . . . . . . . . . . . :
\NOFIPS \NOSEG \NODEB \NOOBSOLETE
SAA flagging . . . . . . . . . . . . :
\NOFLAG
Flagging severity . . . . . . . . . :
ð
Replace program . . . . . . . . . . :
\YES
Target release . . . . . . . . . . . :
\CURRENT
User profile . . . . . . . . . . . . :
\USER
Authority . . . . . . . . . . . . . :
\LIBCRTAUT
Compiler . . . . . . . . . . . . . . :
IBM AS/4ðð COBOL/4ðð
5738CB1 V2R1Mð 91ð524
AS/4ðð COBOL Source
INTLIB/CTDINT
RCH38321 1ð/ð5/9ð 16:14:43
STMT SEQNBR -A 1 B..+....2....+....3....+....4....+....5....+....6....+....7..IDENTFCN S COPYNAME
CHG DATE
1 ððð1ðð IDENTIFICATION DIVISION.
1ð/ð1/87
2 ððð2ðð PROGRAM-ID.
CTDINT.
11/15/88
ððð3ðð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
1ð/ð1/87
ððð4ðð\ THIS PROGRAM WILL HANDLE THE REQUEST FOR EITHER A BUYER
\
11/16/88
ððð5ðð\ NUMBER OR AN ITEM NUMBER. THIS IS ACCOMPLISHED BY MAKING
\
1ð/ð1/87
ððð6ðð\ THE DATABASE FILE STRUCTURE (KEY LENGTH, KEY POSITION, RECORD
\
1ð/ð5/9ð
ððð7ðð\ LENGTH, RECORD SIZE, ETC.) THE SAME FOR BOTH FILES WITH ONLY
\
1ð/ð1/87
ððð8ðð\ THE RECORD CONTENTS DIFFERENT.
\
1ð/ð1/87
ððð9ðð\
\
1ð/ð1/87
ðð1ððð\ THIS PROGRAM ENDS WHEN A DETACH REQUEST IS RECEIVED FROM
\
1ð/ð1/87
ðð11ðð\ THE SOURCE PROGRAM.
\
1ð/ð1/87
ðð12ðð\
\
1ð/ð1/87
ðð13ðð\ INDICATORS ASSOCIATED WITH THE ICF FILE I/O OPERATION
\
1ð/ð5/9ð
ðð14ðð\ ARE DECLARED IN THE WORKING-STORAGE SECTION AND ARE REFERENCED \
1ð/15/87
ðð15ðð\ FOR EVERY I/O OPERATION ISSUED.
\
1ð/15/87
ðð16ðð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
1ð/ð1/87
3 ðð17ðð ENVIRONMENT DIVISION.
1ð/ð1/87
4 ðð18ðð CONFIGURATION SECTION.
1ð/ð1/87
5 ðð19ðð SOURCE-COMPUTER.
IBM-AS4ðð.
ð1/15/88
6 ðð2ððð OBJECT-COMPUTER.
IBM-AS4ðð.
ð1/15/88
7 ðð21ðð SPECIAL-NAMES.
I-O-FEEDBACK IS IO-FBA
1ð/ð1/87
8 ðð22ðð
OPEN-FEEDBACK IS OPEN-FBA.
1ð/ð1/87
9 ðð23ðð INPUT-OUTPUT SECTION.
1ð/ð1/87
ðð24ðð\.1/
ð3/17/89
1ð ðð25ðð FILE-CONTROL.
1ð/ð1/87
11 ðð26ðð
SELECT PFILE ASSIGN TO DATABASE-PFILE
1ð/ð1/87
12 ðð27ðð
ORGANIZATION IS INDEXED
1ð/ð1/87
13 ðð28ðð
ACCESS IS RANDOM
1ð/ð1/87
14 ðð29ðð
RECORD KEY IS EXTERNALLY-DESCRIBED-KEY
1ð/ð1/87
15 ðð3ððð
WITH DUPLICATES.
1ð/ð1/87
16 ðð31ðð
SELECT CFILE ASSIGN TO WORKSTATION-CFILE-SI
1ð/ð1/87
17 ðð32ðð
ORGANIZATION IS TRANSACTION
1ð/ð1/87
18 ðð33ðð
FILE STATUS IS STATUS-IND MAJ-MIN.
1ð/ð1/87
19 ðð34ðð
SELECT QPRINT ASSIGN TO PRINTER-QSYSPRT.
1ð/ð1/87
2ð ðð35ðð DATA DIVISION.
1ð/ð1/87
21 ðð36ðð FILE SECTION.
1ð/ð1/87
22 ðð37ðð FD PFILE
1ð/ð1/87
23 ðð38ðð
LABEL RECORDS ARE STANDARD.
1ð/ð1/87
24 ðð39ðð ð1 PREC.
1ð/ð1/87
25 ðð4ððð
COPY DDS-ALL-FORMATS OF PFILE.
1ð/ð1/87
26 +ððððð1
ð5 PFILE-RECORD PIC X(15ð).
<-ALL-FMTS
+ððððð2\
I-O FORMAT:DBREC
FROM FILE PFILE
OF LIBRARY INTLIB
<-ALL-FMTS
+ððððð3\
<-ALL-FMTS
Page
Page
1
2
Figure D-13 (Part 1 of 4). Target Program Example — CTDINT (User-Defined Formats)
Appendix D. Program Examples
D-35
+ððððð4\THE KEY DEFINITIONS FOR RECORD FORMAT DBREC
<-ALL-FMTS
+ððððð5\ NUMBER
NAME
RETRIEVAL
TYPE
ALTSEQ
<-ALL-FMTS
+ððððð6\
ððð1
DBSEQ
ASCENDING
AN
NO
<-ALL-FMTS
27 +ððððð7
ð5 DBREC
REDEFINES PFILE-RECORD.
<-ALL-FMTS
28 +ððððð8
ð6 RECCUS
PIC X(1).
<-ALL-FMTS
29 +ððððð9
ð6 DBSEQ
PIC X(6).
<-ALL-FMTS
3ð +ðððð1ð
ð6 DBDATA
PIC X(13ð).
<-ALL-FMTS
31 +ðððð11
ð6 DBFILL
PIC X(13).
<-ALL-FMTS
32 ðð41ðð FD CFILE
1ð/ð1/87
33 ðð42ðð
LABEL RECORDS ARE STANDARD.
1ð/ð1/87
34 ðð43ðð ð1 ICFREC.
1ð/ð1/87
35 ðð44ðð
COPY DDS-ALL-FORMATS-I-O OF CFILE.
1ð/ð1/87
5738CB1 V2R1Mð 91ð524
IBM AS/4ðð COBOL Source
INTLIB/CTDINT
RCH38321 1ð/ð5/9ð 16:14:43
STMT SEQNBR -A 1 B..+....2....+....3....+....4....+....5....+....6....+....7..IDENTFCN S COPYNAME
CHG DATE
36 +ððððð1
ð5 CFILE-RECORD PIC X(15ð).
<-ALL-FMTS
+ððððð2\ INPUT FORMAT:SNDPART
FROM FILE CFILE
OF LIBRARY INTLIB
<-ALL-FMTS
+ððððð3\
<-ALL-FMTS
37 +ððððð4
ð5 SNDPART-I
REDEFINES CFILE-RECORD.
<-ALL-FMTS
38 +ððððð5
ð6 RECTYP
PIC X(1).
<-ALL-FMTS
39 +ððððð6
ð6 ITEMNO
PIC X(6).
<-ALL-FMTS
4ð +ððððð7
ð6 EDATA
PIC X(13ð).
<-ALL-FMTS
41 +ððððð8
ð6 FILL1
PIC X(13).
<-ALL-FMTS
+ððððð9\ OUTPUT FORMAT:SNDPART
FROM FILE CFILE
OF LIBRARY INTLIB
<-ALL-FMTS
+ðððð1ð\
<-ALL-FMTS
42 +ðððð11
ð5 SNDPART-O
REDEFINES CFILE-RECORD.
<-ALL-FMTS
43 +ðððð12
ð6 RECTYP
PIC X(1).
<-ALL-FMTS
44 +ðððð13
ð6 ITEMNO
PIC X(6).
<-ALL-FMTS
45 +ðððð14
ð6 EDATA
PIC X(13ð).
<-ALL-FMTS
46 +ðððð15
ð6 FILL1
PIC X(13).
<-ALL-FMTS
+ðððð16\ INPUT FORMAT:RCVPART
FROM FILE CFILE
OF LIBRARY INTLIB
<-ALL-FMTS
+ðððð17\
<-ALL-FMTS
47 +ðððð18
ð5 RCVPART-I
REDEFINES CFILE-RECORD.
<-ALL-FMTS
48 +ðððð19
ð6 RECID2
PIC X(6).
<-ALL-FMTS
49 +ðððð2ð
ð6 PARTDS
PIC X(8ð).
<-ALL-FMTS
5ð +ðððð21
ð6 FILL4
PIC X(64).
<-ALL-FMTS
+ðððð22\ OUTPUT FORMAT:RCVPART
FROM FILE CFILE
OF LIBRARY INTLIB
<-ALL-FMTS
+ðððð23\
<-ALL-FMTS
51 +ðððð24
ð5 RCVPART-O
REDEFINES CFILE-RECORD.
<-ALL-FMTS
52 +ðððð25
ð6 RECID2
PIC X(6).
<-ALL-FMTS
53 +ðððð26
ð6 PARTDS
PIC X(8ð).
<-ALL-FMTS
54 +ðððð27
ð6 FILL4
PIC X(64).
<-ALL-FMTS
55 ðð45ðð FD QPRINT
1ð/ð1/87
56 ðð46ðð
LABEL RECORDS ARE OMITTED.
1ð/ð1/87
57 ðð47ðð ð1 PRINTREC.
ð1/14/88
58 ðð48ðð
ð5 RC
PIC 9999.
ð1/15/88
59 ðð49ðð
ð5 ERRMSG
PIC X(128).
ð1/14/88
6ð ðð5ððð WORKING-STORAGE SECTION.
1ð/ð1/87
61 ðð51ðð 77 MAJ-MIN-SAV
PIC X(4).
1ð/ð1/87
62 ðð52ðð 77 STATUS-IND
PIC X(2).
1ð/ð1/87
63 ðð53ðð 77 INDON
PIC 1 VALUE B"1".
1ð/ð1/87
64 ðð54ðð 77 INDOFF
PIC 1 VALUE B"ð".
1ð/ð1/87
65 ðð55ðð 77 LEN
PIC 9(1ð)V9(5) COMP
1ð/ð1/87
66 ðð56ðð
VALUE ð.
1ð/ð1/87
67 ðð57ðð 77 CMD2
PIC X(31)
1ð/ð1/87
68 ðð58ðð
VALUE "CPYF HEXDUMP \LIST PRTFMT(\HEX)".
1ð/ð1/87
69 ðð59ðð ð1 CMNF-INDIC-AREA.
1ð/ð1/87
ðð6ððð\ ALLOW WRITE (ALWWRT) INDICATOR
1ð/ð1/87
7ð ðð61ðð
ð5 IN1ð
PIC 1 INDIC 1ð.
1ð/ð1/87
71 ðð62ðð
88 IN1ð-ON
VALUE B"1".
1ð/ð1/87
72 ðð63ðð
88 IN1ð-OFF
VALUE B"ð".
1ð/ð1/87
ðð64ðð\ FAIL (FAIL) INDICATOR
11/16/88
73 ðð65ðð
ð5 IN2ð
PIC 1 INDIC 2ð.
11/21/88
74 ðð66ðð
88 IN2ð-ON
VALUE B"1".
11/16/88
75 ðð67ðð
88 IN2ð-OFF
VALUE B"ð".
11/16/88
ðð68ðð\ RECEIVE FAIL (RCVFAL) INDICATOR
11/16/88
76 ðð69ðð
ð5 IN25
PIC 1 INDIC 25.
11/21/88
77 ðð7ððð
88 IN25-ON
VALUE B"1".
11/16/88
78 ðð71ðð
88 IN25-OFF
VALUE B"ð".
11/16/88
ðð72ðð\ RECEIVE TURNAROUND (RCVTRNRND) INDICATOR
11/16/88
Figure D-13 (Part 2 of 4). Target Program Example — CTDINT (User-Defined Formats)
D-36
Intrasystem Communications Programming V4R1
Page
3
5738CB1 V2R1Mð 91ð524
AS/4ðð COBOL Source
INTLIB/CTDINT
RCH38321 1ð/ð5/9ð 16:14:43
STMT SEQNBR -A 1 B..+....2....+....3....+....4....+....5....+....6....+....7..IDENTFCN S COPYNAME
CHG DATE
79 ðð73ðð
ð5 IN4ð
PIC 1 INDIC 4ð.
11/16/88
8ð ðð74ðð
88 IN4ð-ON
VALUE B"1".
11/16/88
81 ðð75ðð
88 IN4ð-OFF
VALUE B"ð".
11/16/88
ðð76ðð\ RECEIVE DETACH (RCVDETACH) INDICATOR
1ð/ð1/87
82 ðð77ðð
ð5 IN44
PIC 1 INDIC 44.
1ð/ð1/87
83 ðð78ðð
88 IN44-ON
VALUE B"1".
1ð/ð1/87
84 ðð79ðð
88 IN44-OFF
VALUE B"ð".
1ð/ð1/87
85 ðð8ððð ð1 MAJ-MIN.
1ð/ð1/87
86 ðð81ðð
ð5 MAJ
PIC X(2).
1ð/ð1/87
87 ðð82ðð
ð5 MIN
PIC X(2).
1ð/ð1/87
5738CB1 V2R1Mð 91ð524
AS/4ðð COBOL Source
INTLIB/CTDINT
RCH38321 1ð/ð5/9ð 16:14:43
STMT SEQNBR -A 1 B..+....2....+....3....+....4....+....5....+....6....+....7..IDENTFCN S COPYNAME
CHG DATE
ðð83ðð/
1ð/ð1/87
88 ðð84ðð PROCEDURE DIVISION.
1ð/ð1/87
ðð85ðð DECLARATIVES.
1ð/ð1/87
ðð86ðð ERR-SECTION SECTION.
1ð/ð1/87
ðð87ðð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
1ð/ð1/87
ðð88ðð\.2/
ð3/17/89
ðð89ðð\
1ð/ð1/87
ðð9ððð
USE AFTER STANDARD ERROR PROCEDURE ON CFILE.
1ð/ð1/87
ðð91ðð CFILE-EXCEPTION.
1ð/ð1/87
ðð92ðð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
1ð/ð1/87
ðð93ðð\
\
ð3/16/89
ðð94ðð\ PRINT A MESSAGE SAYING CTDINT PROGRAM ENDED ABNORMALLY.
\
ð3/16/89
ðð95ðð\ CLOSE ALL THE FILES AND END THE PROGRAM. THIS ROUTINE IS CALLED \
ð3/16/89
ðð96ðð\ WHEN A NON-RECOVERABLE ERROR OCCURS IN ICF FILE.
\
1ð/ð5/9ð
ðð97ðð\
\
ð3/16/89
ðð98ðð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
1ð/ð1/87
ðð99ðð GETFBA.
1ð/ð1/87
89 ð1ðððð
MOVE MAJ-MIN TO RC.
ð1/14/88
9ð ð1ð1ðð
MOVE "CTDINT HAS COMPLETED ABNORMALLY" TO ERRMSG.
11/15/88
91 ð1ð2ðð
WRITE PRINTREC.
1ð/ð1/87
92 ð1ð3ðð
CLOSE PFILE
1ð/ð1/87
ð1ð4ðð
CFILE
1ð/ð1/87
ð1ð5ðð
QPRINT.
1ð/ð1/87
93 ð1ð6ðð
STOP RUN.
1ð/ð1/87
ð1ð7ðð\
1ð/ð1/87
ð1ð8ðð EXIT-DECLARATIVES.
1ð/ð1/87
ð1ð9ðð
EXIT.
1ð/ð1/87
ð11ððð\
1ð/ð1/87
94 ð111ðð END DECLARATIVES.
1ð/ð1/87
ð112ðð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
1ð/ð1/87
5738CB1 V2R1Mð 91ð524
AS/4ðð COBOL Source
INTLIB/CTDINT
RCH38321 1ð/ð5/9ð 16:14:43
STMT SEQNBR -A 1 B..+....2....+....3....+....4....+....5....+....6....+....7..IDENTFCN S COPYNAME
CHG DATE
ð113ðð/
1ð/ð1/87
ð114ðð START-PROGRAM SECTION.
1ð/ð1/87
ð115ðð START-PROGRAM-PARAGRAPH.
1ð/ð1/87
ð116ðð\.3/
ð3/17/89
95 ð117ðð
OPEN OUTPUT QPRINT
1ð/ð1/87
ð118ðð
I-O
CFILE
1ð/ð1/87
ð119ðð
INPUT PFILE.
1ð/ð1/87
ð12ððð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
1ð/ð1/87
ð121ðð\
\
1ð/ð1/87
ð122ðð\ READ THE REQUEST FROM THE SOURCE PROGRAM. INDICATOR 4ð
\
1ð/ð1/87
ð123ðð\ INDICATES RCVTRNRND OCCURRED. INDICATOR 44 INDICATES THAT
\
1ð/ð5/9ð
ð124ðð\ DETACH INDICATOR HAS BEEN RECEIVED FROM THE OTHER PROGRAM.
\
ð3/16/89
ð125ðð\
\
1ð/ð1/87
ð126ðð\ THIS PROGRAM CHECKS FOR ERRORS ON EVERY ICF FILE
\
1ð/ð5/9ð
ð127ðð\ OPERATION. A MAJOR CODE GREATER THAN ð3 INDICATES AN ERROR.
\
ð3/16/89
ð128ðð\
\
1ð/ð1/87
ð129ðð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
1ð/ð1/87
ð13ððð\.4/
ð3/17/89
ð131ðð RECEIVE-DATA.
1ð/ð1/87
96 ð132ðð
PERFORM READ-CFILE THRU READ-CFILE-EXIT.
1ð/ð1/87
97 ð133ðð
GO TO SEND-DATA.
1ð/ð5/9ð
98 ð134ðð
GO TO RECEIVE-DATA.
ð3/17/89
Page
4
Page
5
Page
6
Figure D-13 (Part 3 of 4). Target Program Example — CTDINT (User-Defined Formats)
Appendix D. Program Examples
D-37
ð135ðð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
1ð/ð1/87
ð136ðð\
\
1ð/ð1/87
ð137ðð\ A REQUEST FROM THE SOURCE PROGRAM RESULTS IN READING A SINGLE
\
1ð/ð1/87
ð138ðð\ RECORD CONTAINING THE REQUESTED BUYER OR ORDER NUMBER. THE
\
ð3/16/89
ð139ðð\ RESPONSE WILL BE RETURNED IN A SINGLE RECORD CONTAINING EITHER \
1ð/ð1/87
ð14ððð\ THE ITEM OR BUYER INFORMATION, DEPENDING ON THE DATA BASE
\
ð3/16/89
ð141ðð\ CONTENT.
\
1ð/ð1/87
ð142ðð\
\
1ð/ð1/87
ð143ðð\ THE RESPONSE IS SENT TO THE SOURCE PROGRAM BY WRITING TO THE
\
1ð/ð1/87
ð144ðð\ PROGRAM DEVICE FILE USING FORMAT SNDPART.
\
1ð/15/87
ð145ðð\
\
11/21/88
ð146ðð\ WHEN THE REQUESTED BUYER OR ITEM NUMBER IS NOT FOUND,
\
ð3/16/89
ð147ðð\ OR WHEN A DISK ERROR OCCURRED WHILE READING THE DATABASE,
\
ð3/16/89
ð148ðð\ A FAIL INDICATION IS SENT TO THE SOURCE PROGRAM.
\
ð3/16/89
ð149ðð\
\
11/21/88
ð15ððð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
1ð/ð1/87
ð151ðð\
1ð/ð1/87
ð152ðð\.5/
ð3/17/89
ð153ðð SEND-DATA.
1ð/ð1/87
99 ð154ðð
MOVE RECID2 OF RCVPART-I TO DBSEQ.
1ð/ð1/87
1ðð ð155ðð
READ PFILE INVALID KEY
11/16/88
1ð1 ð156ðð
SET IN2ð-ON TO TRUE.
11/16/88
1ð2 ð157ðð
MOVE RECCUS TO RECTYP OF SNDPART-O.
1ð/ð1/87
1ð3 ð158ðð
MOVE DBSEQ TO ITEMNO OF SNDPART-O.
1ð/ð1/87
1ð4 ð159ðð
MOVE DBDATA TO EDATA OF SNDPART-O
1ð/ð1/87
1ð5 ð16ððð
WRITE ICFREC FROM PREC FORMAT IS "SNDPART"
1ð/ð1/87
ð161ðð
INDICATORS ARE CMNF-INDIC-AREA.
1ð/ð1/87
1ð6 ð162ðð
GO TO RECEIVE-DATA.
1ð/ð1/87
ð163ðð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
1ð/ð1/87
ð164ðð\
\
1ð/ð1/87
ð165ðð\ THIS ROUTINE ISSUES READ OPERATIONS TO THE PROGRAM DEVICE.
\
ð3/16/89
ð166ðð\ DETACH INDICATION IS CHECKED AND IF IT IS SET, THE PROGRAM
\
ð3/16/89
ð167ðð\ IS ENDED (IN44-ON).
\
ð3/16/89
5738CB1 V2R1Mð 91ð524
AS/4ðð COBOL Source
INTLIB/CTDINT
RCH38321 1ð/ð5/9ð 16:14:43
STMT SEQNBR -A 1 B..+....2....+....3....+....4....+....5....+....6....+....7..IDENTFCN S COPYNAME
CHG DATE
ð168ðð\
\
1ð/ð1/87
ð169ðð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
1ð/ð1/87
ð17ððð\.6/
ð3/17/89
ð171ðð READ-CFILE.
1ð/ð1/87
1ð7 ð172ðð
MOVE ZEROS TO CMNF-INDIC-AREA.
1ð/ð1/87
1ð8 ð173ðð
READ CFILE FORMAT IS "RCVPART"
1ð/ð1/87
ð174ðð
INDICATORS ARE CMNF-INDIC-AREA.
1ð/ð1/87
1ð9 ð175ðð
IF IN44-ON
1ð/ð1/87
11ð ð176ðð
GO TO END-PROGRAM.
1ð/ð1/87
ð177ðð READ-CFILE-EXIT.
1ð/ð1/87
ð178ðð
EXIT.
ð3/15/89
ð179ðð\
1ð/ð1/87
ð18ððð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
1ð/ð1/87
ð181ðð\
\
ð3/16/89
ð182ðð\ ROUTINE TO END THE JOB AND CLOSE THE FILES.
\
ð3/16/89
ð183ðð\
\
ð3/16/89
ð184ðð\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
1ð/ð1/87
ð185ðð\
1ð/ð1/87
ð186ðð\.7/
ð3/17/89
111 ð187ðð END-PROGRAM.
1ð/ð1/87
112 ð188ðð
MOVE MAJ-MIN TO RC.
ð1/14/88
113 ð189ðð
MOVE "CTDINT HAS COMPLETED NORMALLY" TO ERRMSG.
11/15/88
114 ð19ððð
WRITE PRINTREC.
1ð/ð1/87
115 ð191ðð
CLOSE PFILE
1ð/ð1/87
ð192ðð
CFILE
1ð/ð1/87
ð193ðð
QPRINT.
1ð/ð1/87
116 ð194ðð
STOP RUN.
1ð/ð1/87
\ \ \ \ \
E N D
O F
S O U R C E
\ \ \ \ \
5738CB1 V2R1Mð 91ð524
AS/4ðð COBOL Messages
INTLIB/CTDINT
RCH38321 1ð/ð5/9ð 16:14:43
STMT
\
89 MSGID: LBLð335 SEVERITY: ðð SEQNBR: ðð99ðð
Message . . . . :
Empty paragraph or section precedes 'GETFBA'
paragraph or section.
\ \ \ \ \
E N D
O F
M E S S A G E S
\ \ \ \ \
Message Summary
Total
Info(ð-4)
Warning(5-19)
Error(2ð-29)
Severe(3ð-39)
Terminal(4ð-99)
1
1
ð
ð
ð
ð
Source records read . . . . . . . . :
194
Copy records read . . . . . . . . . :
38
Copy members processed . . . . . . :
2
Sequence errors . . . . . . . . . . :
ð
Highest severity message issued . . :
ð
LBLð9ð1 ðð Program CTDINT created in library INTLIB.
\ \ \ \ \
E N D
O F
C O M P I L A T I O N
\ \ \ \ \
Figure D-13 (Part 4 of 4). Target Program Example — CTDINT (User-Defined Formats)
D-38
Intrasystem Communications Programming V4R1
Page
7
Page
8
RPG/400 Source Program for a
Two-Session Inquiry
The following describes an RPG/400 source program for a
two-session inquiry.
INTFIL
An ICF file used to send records to and receive
records from the target program.
DSPFIL
A display file used to enter requests to be sent to
the target program.
QPRINT
An AS/400 printer file used to print records, both
sent and received, as well as major and minor
ICF return codes.
Program Files: The RPG/400 two-session source program
uses the following files:
DDS Source: The DDS for the ICF file (INTFIL) is illustrated in Figure D-14.
5714PW1 Rð1Mðð 88ð3ð1
SEU SOURCE LISTING
1ð/14/87 17:2ð:41
SOURCE FILE . . . . . . . QINTSRC/INTLIB
MEMBER . . . . . . . . . INTFIL
SEQNBR\...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8 ...+... 9 ...+... ð
A\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
A\
\
A\
ICF FILE
\
A\
USED IN SOURCE TWO SESSION PROGRAM
\
A\
\
A\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
A
INDARA
A
RCVFAIL(25 'RECEIVED FAIL')
A
RCVTRNRND(9ð)
A
R ITMRSP
A
RECID(1 'I')
A
RECITM
1
A
ITEMNO
6 ð
A
DESC
3ð
A
QTYLST
7 ð
A
QTYOH
7 ð
A
QTYOO
7 ð
A
QTYBO
7 ð
A
UNITQ
2
A
PRð1
7 2
A
PRð5
7 ð
A
UFRT
5 2
A
SLSTM
9 2
A
SLSTY
11 2
A
CSTTM
9 2
A
CSTTY
11 2
A
PRO
5 2
A
LOS
9 2
A
FILL1
56
A
R DTLRSP
A
RECID(1 'C')
A
RECCUS
1
A
CUSTNO
6 ð
A
DNAME
3ð
A
DLSTOR
6 ð
A
DSLSTM
9 ð
A
DSPMð1
9 ð
A
DSPMð2
9 ð
A
DSPMð3
9 ð
A
DSTTYD
11 ð
A
IDEPT
3 ð
A
FILL2
57
A
R DETACH
A
DETACH
A
R EOS
A
EOS
A
R EVKREQ
A
EVOKE(&LIB/&PGMID)
A
PGMID
1ðA P
A
LIB
1ðA P
A
R ITMREQ
A
INVITE
A
ITEMNO
6 ð
A
R DTLREQ
A
INVITE
A
CUSTNO
6 ð
A
R TIMER
A
TIMER(ðððð3ð)
PAGE 1
Figure D-14. DDS Source for a Two-Session Source Program Using INTFIL
Appendix D. Program Examples
D-39
The DDS source file for the display file (DSPFIL) is shown in Figure D-15.
5714PW1 Rð1Mðð 88ð3ð1
SEU SOURCE LISTING
1ð/14/87 16:59:5ð
SOURCE FILE . . . . . . . QINTSRC/INTLIB
MEMBER . . . . . . . . . DSPFIL
SEQNBR\...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8 ...+... 9 ...+... ð
A\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
A\
\
A\
DISPLAY FILE
\
A\
USED IN SOURCE TWO SESSION PROGRAM
\
A\
\
A\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
A\ BEGINNING MENU
A\\\\\\\\\\\\\\\\\\\\
A
DSPSIZ(\DS3)
A
CFð1(99) CFð2(98) CFð3(97)
A
R CIMENU
TEXT('MENU FOR INQUIRY')
A
1 34'INQUIRY MENU'
A
3 1'Select one of the following:'
A
4 3'1. Order inquiry'
A
5 3'2. Buyer inquiry'
A
11 1'Option:'
A
OPTION
1N I 11 9VALUES('1' '2')
A
19 5DFT('CMD KEY 1 - END ')
A
R DTLMNU
TEXT('
BUYER INQUIRY SCREEN 1')
A
2 2DFT('ENTER BUYER')
A
CUSTNO
6N ðI 2 2ð
A
19 5DFT('CMD KEY 1 - END ')
A
19 23DFT(' 2 - MAIN MENU ')
A\
A\\\\\\\\\\\\\\\\\\\\\\\\\\\\
A\ CUSTOMER INQUIRY SCREEN
A\\\\\\\\\\\\\\\\\\\\\\\\\\\\
A
R DTLSCR
TEXT('
BUYER INQUIRY SCR. #2')
A
1 3DFT('BUYER DPT LAST ORD
& THIS
+
A
$MTH1
&MTH2
$MTH3
THIS+
A
YTD CNAME')
A
CUSTN
6N
2 2
A
DEPT
3N ð
2 9
A
DLSTR
6N ð
2 13
A
DSLSM
9N ð
2 22
A
DSPM1
9N ð
2 32
A
DSPM2
9N ð
2 42
A
DSPM3
9N ð
2 52
A
DSTYD
11N ð
2 62
A
CNAME
5
2 74
A
19 5DFT('CMD KEY 1 - END ')
A
19 23DFT(' 2 - MAIN MENU ')
A\
A\\\\\\\\\\\\\\\\\\\\\\\\
A\ ITEM INQUIRY SCREEN
A\\\\\\\\\\\\\\\\\\\\\\\\
A
R ITMMNU
TEXT('ITEM INQUIRY SCREEN ONE')
A
2 2DFT('ENTER ITEM NUMBER')
A
ITEMNO
6N ðI 2 2ð
A
19 5DFT('CMD KEY 1 - END ')
A
19 23DFT(' 2 - MAIN MENU ')
A\\\\\\\\\\\\\\\\\\\\\\\\
A\ ITEM DISPLAY
A\\\\\\\\\\\\\\\\\\\\\\\\
A
R ITMSC2
TEXT('ITEM INQUIRY SCREEN TWO') OVE+
A
RLAY
A
4 2DFT('DESC-')
A
DSC
3ð
4 8
A
5 2DFT('QUANTITY AVAILABLE')
A
QAVAIL
7N ð
5 25
A
6 11DFT('ON HAND')
A
QTYH
7N ð
6 25
A
7 11DFT('ON ORDER')
A
QTYO
7N ð
7 25
Figure D-15 (Part 1 of 2). DDS Source for Source Program Two-Session Inquiry Using DSPFIL
D-40
Intrasystem Communications Programming V4R1
PAGE 1
A
A
QTYB
7N
A
A
UNT
2
A
A
PR1
7Y
A
A
PR5
7Y
A
A
UFR
5Y
A
A
A
A
A\\\\\\\\\\\\\\\\\\\\\\\\\\\\
A\ ITEM ADDITIONAL DISPLAY
A\\\\\\\\\\\\\\\\\\\\\\\\\\\\
A
R ITMSC3
A
A
A
SLSM
9Y
A
A
SLSY
11Y
A
A
CSTM
9Y
A
A
CSTY
11Y
A
A
PROFIT
5Y
A
A
LOSTS
9Y
A
A
A\\\\\\\\\\\\\\\\\\\\\\\\
A\
TIMOUT SCREEN.
A\\\\\\\\\\\\\\\\\\\\\\\\
A
R TIMOUT
A
A
A
A
TIMRSP
1
ð
2
ð
2
2
2
2
2
2
2
8
8
9
9
1ð
1ð
11
11
12
12
13
19
19
19
11DFT('BACK ORDER')
25
2DFT('UNIT OF MEASURE')
3ð
2DFT('PRICE PER UNIT')
24EDTCDE(3)
8DFT('QUANTITY')
25EDTCDE(3)
8DFT('FREIGHT')
26EDTCDE(3)
32DFT('MORE... ')
5DFT('CMD KEY 1 - END ')
23DFT(' 2 - MAIN MENU ')
4ðDFT(' 3 - BUYER MENU')
5
5
6
6
7
7
8
8
9
9
1ð
1ð
19
19
TEXT('ITEM INQUIRY SCREEN 3
RLAY
2DFT('SALES MONTH')
16EDTCDE(1)
8DFT('Y-T-D')
14EDTCDE(1)
2DFT('COSTS MONTH')
16EDTCDE(1)
8DFT('Y-T-D')
14EDTCDE(1)
2DFT('PROFIT PCT')
22EDTCDE(1)
2DFT('LOST SALES')
16EDTCDE(1)
5DFT('CMD KEY 1 - END ')
23DFT(' 2 - MAIN MENU ')
') OVE+
TEXT('TIME OUT SCREEN')
OVE+
RLAY
2ð 2DFT('TARGET PROGRAM TIMED OUT. ENTER 1 TO TRY AGAIN OR 2 TO END.')
I 2ð 61
Figure D-15 (Part 2 of 2). DDS Source for Source Program Two-Session Inquiry Using DSPFIL
Configuration: The following command is needed to create
the intrasystem communications device associated with the
ICF file:
CRTDEVINTR DEVD(INTRADEV)
RMTLOCNAME(INTRARMT) ONLINE(\NO)
TEXT("THIS IS AN INTRASYSTEM DEVICE
DESCRIPTION")
ICF File Creation and Program Device Entry Definition:
The command needed to create the ICF file is:
CRTICFF FILE(INTLIB/INTFIL)
SRCFILE(INTLIB/QINTSRC)
SRCMBR(INTFIL) ACQPGMDEV(\NONE)
MAXPGMDEV(2) WAITRCD(3ð)
TEXT("SOURCE ICF FILE FOR TWO SESSION
PROGRAM")
It is not necessary to add a communications entry to the subsystem since the system automatically defines an entry for
the device created above at run time. However, if you
decided to have one, the following is an example:
ADDCMNE SBSD(QCMN) DEV(INTRADEV)
The commands needed to define the two program device
entries are:
OVRICFDEVE PGMDEV(ICFðð)
RMTLOCNAME(INTRARMT)
FMTSLT(\RECID)
OVRICFDEVE PGMDEV(ICFð1)
RMTLOCNAME(INTRARMT)
FMTSLT(\RECID)
The following is an example of a CL program that might be
used to run the source program shown in the example
above:
RSDINTCL: PGM PARM(&RMT1 &RMT2)
DCL
VAR(&RMT1)
TYPE(\CHAR)
LEN(8)
DCL
VAR(&RMT2)
TYPE(\CHAR)
LEN(8)
CHGJOB
OUTQ(INTLIB/INTOUTQ)
LOG(4 ðð \SECLVL)
LOGCLPGM(\YES)
OVRICFDEVE PGMDEV(ICFðð)
RMTLOCNAME(&RMT1)
FMTSLT(\RECID)
OVRICFDEVE PGMDEV(ICFð1)
RMTLOCNAME(&RMT2)
FMTSLT(\RECID)
CALL INTLIB/RSDINT
ENDRSDINTCL: ENDPGM
Appendix D. Program Examples
D-41
The following is an example of a CL program that might be
used as the target program that your source program evokes
(which calls the program RTDINT shown in the example):
RTDINTCL: PGM
CHGJOB OUTQ(INTLIB/INTOUTQ)
LOG(4 ðð \SECLVL)
LOGCLPGM(\YES)
ADDLIBLE INTLIB
OVRICFDEVE PGMDEV(RQSDEV)
RMTLOCNAME(\REQUESTER)
CALL INTLIB/RTDINT
RMVLIBLE INTLIB
ENDRTDINTCL: ENDPGM
Program Explanation: The following explains the structure
of the program example illustrated in Figure D-16 on
page D-44. The ICF file used in the example is defined by
the user, and uses externally described data formats (DDS).
The reference numbers in the explanation below correspond
to the numbers in the following program example.
.3/
The work station is implicitly acquired when the
DSPFIL file opens.
Also, the evoke requests are issued to the remote
systems by the subroutine EVKSR in section 13.
When control returns from the EVKSR subroutine, the
main menu (record format CIMENU) is written to the
work station.
.4/
A read operation is issued to the display program
device and the program waits for an input request
from the user. When a record is returned, the last
record format used (as specified in the RECID field in
the I/O feedback area) is checked. The program
branches to the appropriate routine according to the
value in RECID.
.5/
The request entered by the user from the main menu
(CIMENU) is checked. If indicator 99 is set to 1, indicating that the operator pressed function key 1, the
two transactions and sessions end and the program
ends. If the operator entered option 1, the program
writes the item inquiry menu (ITMMNU) to the work
station and returns to the read to the display program
device section (4).
The ICF file used in the example is externally described.
All output operations to the ICF file in the example are done
using the WRITE statement.
.1/
The file specifications define the ICF file (INTFIL) and
the display file (DSPFIL) used in the program.
If the option is not 1, the Buyer Inquiry menu
(DTLMNU) is written to the work station and control is
passed to section 4.
INTFIL is the ICF file used to send records to and
receive records from each of the two target programs.
DSPFIL is the display file used to receive user’s
requests and to report the information received based
on the request.
The files used in the program are opened at the
beginning of the RPG/400 cycle.
Note: The continuation lines on the file specification
define the following:
Ÿ The data structure names, IOFB and IODS, used
for the feedback area (INFDS) for INTFIL and
DSPFIL respectively.
Ÿ The number of program devices that can be
attached to the files (two for INTFIL).
Ÿ The program device name in the CMID field to
which it issues the I/O operation.
.2/
The file information data structure (IOFB) is provided
to receive the I/O feedback area following an ICF file
I/O operation.
For the display file, the file information data structure
(IODS) is used by the program to determine the
record format used for the last display file I/O operation. The field name referred to in the program is
RECID, found in positions 261 through 268 of the
feedback area.
D-42
Intrasystem Communications Programming V4R1
The two ICF program devices used by the program
are explicitly acquired.
.6/
The item number requested by the user from the
Order Inquiry Display (record format ITMMNU) is processed here. If function key 1 is pressed (indicator
99), control passes to the I/O operation error section
(section 12), the two transactions and sessions are
ended, and the program ends. If function key 2 is
pressed, the inquiry request is canceled, the main
menu (CIMENU) is written to the work station, and
the program returns to section 4.
The item number is read from the work station and
then the request is sent to the target program on
program device ICF01.
The request is sent to the appropriate target program
by writing data to the program device using format
ITMREQ. The INVITE keyword is specified as part of
the ITMREQ format to give the target program permission to send.
A timer is issued for 30 seconds before the read
operation. This is provided to allow the local program
to have a time-out when no response is received from
the target program.
A read-from-invited-program-devices operation is
issued to the invited program device to receive the
response to the inquiry. The operation is interpreted
as a read-from-invited-program-devices because the
program device name field (CMID) is blank. Indicator
89 is set on after I/O operation, if the operation does
.7/
not complete. The subroutine ERRCHK in section 14
gets control, and further checks are made.
main menu (record format CIMENU) is written to the
work station. The program then returns to section 4.
The return codes are checked after an I/O request. If
there are any errors, control is passed to section 12.
If not, the program returns to section 4.
The return codes (or indicators) are checked after an
I/O request. If there are any errors, control is passed
to section 12.
The information received from the target program is
processed. If the information received is a fail indication, it means the requested item number was not
found and the request is not valid. A new Item
Inquiry menu (ITMMNU) is written to the work station,
and control goes to section 4.
.1ð/
The program then performs the calculations to set the
quantity fields and writes the result to the requesting
work station using record format ITMSC2.
.11/
Control is passed here if the buyer detail record
format (DLTSCR) is displayed. If function key 1 (indicator 99) is pressed, control goes to section 12. If
function key 2 (indicator 98) is pressed, the main
menu (CIMENU) is written to the work station and
control is returned to section 4.
.12/
If the record format name is not found on a read
operation, an error message prints. If an error occurs
on any ICF operation, control is passed here and an
error message is printed containing the program
device and error that occurred.
The detail information is written to the work station
using record format DTLSCR.
The program then returns to section 4.
The program then returns to section 4.
.8/
This section processes the user requests for additional information (record format ITMSC2). If function
key 2 (indicator 98) is pressed, the main menu
(record format CIMENU) writes to the work station
and control goes to section 4.
If the Enter key is pressed, the profit and loss figures
are calculated. Those values are then written to the
work station using format ITMSC3 (item inquiry work
station 3). The program then returns to section 4. If
function key 1 (indicator 99) was pressed, control
goes to section 12.
If function key 3 (indicator 97) is pressed, the Order
Inquiry menu (ITMMNU) is written to the work station
and the program returns to section 4.
.9/
For each of the two sessions, the transaction is
ended by issuing a detach request to the appropriate
program device using format DETACH, and the
session is ended by the release operation. The last
record indicator is turned on to end the program. The
ICF file is implicitly closed at the end of the RPG/400
cycle.
.13/
This section processes inquiry read requests from the
Buyer menu (DTLMNU). If function key 2 (indicator
98) is pressed, the main menu (CIMENU) is written to
the work station and the program returns to section 4.
If function key 1 (indicator 99) is pressed, control
goes to section 12.
The buyer inquiry request is sent to the target
program by writing data to the program device
(ICF00) using format DTLREQ. The INVITE keyword
is specified as part of the DLTREQ format to give the
target program permission to send.
If the information received is a fail indication (indicator
25) from the target program, it means the requested
item was not found and the request is not valid. The
The EVKSR subroutine in this section builds the
evoke requests to send to the remote programs.
Because the DDS keyword for the record format only
specifies the field identifiers with the record, this code
moves the literal value RTDINTCL to the field
PGMID, and INTLIB to the field LIB.
When the program start request is received at the
remote program, INTLIB is searched for RTDINTCL
and that program is then started. RTDINTCL is a CL
program that contains CL statements as illustrated on
D-41.
.14/
The subroutine ERRCHK is called when the read
operation to the program device does not complete.
The indication that the timer has ended is checked
(RC=0310) and if it is set, a message is displayed to
the user. The message asks whether you want to try
the read operation again or end the job. In this
example, the time interval is specified in section 9.
.15/
The subroutine *PSSR is called if there are I/O operation errors that are not handled by the subroutine
ERRCHK in section 14. It checks to see whether the
program device is already acquired when an acquire
operation is requested and if it is, the second acquire
is ignored. Otherwise, the program ends.
A read operation is issued to the invited program
device to receive the response to the inquiry. This is
accomplished by blanking out CMID. Indicator 88 is
set on if the I/O operation did not complete.
Note: A timer operation is issued before the above
read is issued to ensure that the operation will finish
even if the target program is unable to respond.
The information supplied by the target program in
response to a request for a buyer detail is processed.
Appendix D. Program Examples
D-43
5738RG1 V2R1Mð 91ð524
IBM AS/4ðð RPG/4ðð
INTLIB/RSDINT
Compiler . . . . . . . . . . . . . :
IBM AS/4ðð RPG/4ðð
Command Options:
Program . . . . . . . . . . . . :
INTLIB/RSDINT
Source file . . . . . . . . . . :
INTLIB/QINTSRC
Source member . . . . . . . . . :
\PGM
Text not available for message RXTðð73 file QRPGMSG.
Generation options . . . . . . . :
\NOLIST
\NOXREF
\NOATR
\NODUMP
Source listing indentation . . . :
\NONE
SAA flagging . . . . . . . . . . :
\NOFLAG
Generation severity level . . . :
9
Print file . . . . . . . . . . . :
\LIBL/QSYSPRT
Replace program . . . . . . . . :
\YES
Target release . . . . . . . . . :
\CURRENT
User profile . . . . . . . . . . :
\USER
Authority . . . . . . . . . . . :
\LIBCRTAUT
Text . . . . . . . . . . . . . . :
\SRCMBRTXT
Phase trace . . . . . . . . . . :
\NO
Intermediate text dump . . . . . :
\NONE
Snap dump . . . . . . . . . . . :
\NONE
Codelist . . . . . . . . . . . . :
\NONE
Ignore decimal data error . . . :
\NO
Actual Program Source:
Member . . . . . . . . . . . . . :
RSDINT
File . . . . . . . . . . . . . . :
QINTSRC
Library . . . . . . . . . . . . :
INTLIB
Last Change . . . . . . . . . . :
1ð/ð5/9ð 15:22:18
Description . . . . . . . . . . :
RPG Source Intra Program Example
5738RG1 V2R1Mð 91ð524
IBM AS/4ðð RPG/4ðð
INTLIB/RSDINT
SEQUENCE
IND
NUMBER
\...1....+....2....+....3....+....4....+....5....+....6....+....7...\ USE
S o u r c e
L i s t i n g
1ðð H
1
2ðð H\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
3ðð H\ THIS PROGRAM ASSIGNS TWO SESSIONS AS FOLLOWS:
\
4ðð H\
'ICFðð' TO INQUIRE ABOUT A BUYER'S CREDIT STANDING
\
5ðð H\
BEFORE AN ORDER IS PROCESSED.
\
6ðð H\
'ICFð1' TO INQUIRE ABOUT THE AVAILABILITY OF AN ITEM
\
7ðð H\
BEING ORDERED (ITEM ððððð1 THRU 999999).
\
8ðð H\ A DISPLAY DEVICE IS USED TO ENTER THE REQUEST ( USING A
\
9ðð H\ BUYER AND AN ITEM MENU ) THAT IS SENT TO THE TARGET
\
1ððð H\ PROGRAM.
\
11ðð H\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
12ðð F\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
13ðð F\
\
14ðð F\
F I L E
S P E C I F I C A T I O N S
\
15ðð F\
\
16ðð F\
INTFIL :
ICF FILE USED TO SEND A REQUEST TO ONE
\
17ðð F\
OF TWO DIFFERENT TARGET PROGRAMS. TWO
\
18ðð F\
SESSIONS ARE ACTIVE AT THE SAME TIME.
\
19ðð F\
\
2ððð F\
DSPFIL :
DISPLAY FILE USED TO ENTER A REQUEST TO BE
\
21ðð F\
SENT TO A TARGET PROGRAM.
\
22ðð F\
\
23ðð F\
THE FOLLOWING INFORMATION IS SPECIFIED AS PART OF THE
\
24ðð F\
FILE SPECIFICATION:
\
25ðð F\
INFDS : I/O FEEDBACK AREA
\
26ðð F\
NUM
: SPECIFIES THE MAXIMUM NUMBER OF
\
27ðð F\
PROGRAM DEVICES THAT CAN BE ATTACHED \
28ðð F\
TO THIS FILE. A VALUE OF 2 IS
\
29ðð F\
SPECIFIED FOR THE ICF FILE.
\
3ððð F\
THIS DEFINES THE FILE AS A
\
31ðð F\
MULTIPLE DEVICE FILE.
\
32ðð F\
ID
: 1ð CHARACTER PROGRAM DEVICE NAME
\
33ðð F\
FIELD WHICH SPECIFIES WHICH PROGRAM
\
34ðð F\
DEVICE TO DIRECT THE OPERATION.
\
35ðð F\
\
36ðð F\
\
37ðð F\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
38ðð
\.1/
39ðð FINTFIL CF E
WORKSTN
4ððð F
KINFDS IOFB
41ðð F
KINFSR \PSSR
42ðð F
KNUM
2
43ðð F
KID
CMID
RECORD FORMAT(S): LIBRARY INTLIB FILE INTFIL.
EXTERNAL FORMAT ITMRSP RPG NAME ITMRSP
EXTERNAL FORMAT DTLRSP RPG NAME DTLRSP
EXTERNAL FORMAT DETACH RPG NAME DETACH
EXTERNAL FORMAT EOS RPG NAME EOS
EXTERNAL FORMAT EVKREQ RPG NAME EVKREQ
Figure D-16 (Part 1 of 13). Source Program Example — RSDINT
D-44
Intrasystem Communications Programming V4R1
1ð/ð5/9ð
16:12:28
Page
1
16:12:28
Page
PAGE
PROGRAM
LINE
ID
2
\NOOPTIMIZE
DO
NUM
1ð/ð5/9ð
LAST
UPDATE
1ð/13/87
1ð/13/87
11/15/88
11/15/88
11/15/88
11/15/88
11/15/88
1ð/13/87
1ð/ð5/9ð
1ð/ð5/9ð
1ð/13/87
1ð/13/87
ð3/17/89
ð3/17/89
ð3/17/89
1ð/ð5/9ð
1ð/ð5/9ð
1ð/ð5/9ð
ð3/17/89
ð3/17/89
1ð/ð5/9ð
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
1ð/ð5/9ð
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
1ð/13/87
1ð/13/87
11/21/88
1ð/13/87
1ð/14/87
11/15/88
1ð/13/87
5738RG1 V2R1Mð 91ð524
IBM AS/4ðð RPG/4ðð
INTLIB/RSDINT
SEQUENCE
IND
NUMBER
\...1....+....2....+....3....+....4....+....5....+....6....+....7...\ USE
EXTERNAL FORMAT ITMREQ RPG NAME ITMREQ
EXTERNAL FORMAT DTLREQ RPG NAME DTLREQ
EXTERNAL FORMAT TIMER RPG NAME TIMER
44ðð FDSPFIL CF E
WORKSTN
45ðð F
KINFDS IODS
RECORD FORMAT(S): LIBRARY INTLIB FILE DSPFIL.
EXTERNAL FORMAT CIMENU RPG NAME CIMENU
EXTERNAL FORMAT DTLMNU RPG NAME DTLMNU
EXTERNAL FORMAT DTLSCR RPG NAME DTLSCR
EXTERNAL FORMAT ITMMNU RPG NAME ITMMNU
EXTERNAL FORMAT ITMSC2 RPG NAME ITMSC2
EXTERNAL FORMAT ITMSC3 RPG NAME ITMSC3
EXTERNAL FORMAT TIMOUT RPG NAME TIMOUT
46ðð FQPRINT O
F
132
PRINTER
47ðð I\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
48ðð I\
\
49ðð I\
I N P U T
S P E C I F I C A T I O N S
\
5ððð I\
\
51ðð I\ IODS
: REDEFINES THE I/O FEEDBACK AREA OF THE DISPLAY
\
52ðð I\
FILE. THIS AREA CONTAINS THE NAME OF THE LAST
\
53ðð I\
RECORD PROCESSED. THIS FIELD IS CALLED RECID.
\
54ðð I\ IOFB
: REDEFINES THE I/O FEEDBACK AREA FOR THE ICF FILE. \
55ðð I\
\
56ðð I\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
57ðð I\.2/
Aðððððð
INPUT FIELDS FOR RECORD ITMRSP FILE INTFIL FORMAT ITMRSP.
Aððððð1
1
1 RECITM
Aððððð2
2
7ðITEMNO
Aððððð3
8 37 DESC
Aððððð4
38 44ðQTYLST
Aððððð5
45 51ðQTYOH
Aððððð6
52 58ðQTYOO
Aððððð7
59 65ðQTYBO
Aððððð8
66 67 UNITQ
Aððððð9
68 742PRð1
Aðððð1ð
75 81ðPRð5
Aðððð11
82 862UFRT
Aðððð12
87 952SLSTM
Aðððð13
96 1ð62SLSTY
Aðððð14
1ð7 1152CSTTM
Aðððð15
116 1262CSTTY
Aðððð16
127 1312PRO
Aðððð17
132 14ð2LOS
Aðððð18
141 196 FILL1
Bðððððð
INPUT FIELDS FOR RECORD DTLRSP FILE INTFIL FORMAT DTLRSP.
Bððððð1
1
1 RECCUS
Bððððð2
2
7ðCUSTNO
Bððððð3
8 37 DNAME
Bððððð4
38 43ðDLSTOR
Bððððð5
44 52ðDSLSTM
5738RG1 V2R1Mð 91ð524
IBM AS/4ðð RPG/4ðð
INTLIB/RSDINT
SEQUENCE
IND
NUMBER
\...1....+....2....+....3....+....4....+....5....+....6....+....7...\ USE
Bððððð6
53 61ðDSPMð1
Bððððð7
62 7ððDSPMð2
Bððððð8
71 79ðDSPMð3
Bððððð9
8ð 9ððDSTTYD
Bðððð1ð
91 93ðIDEPT
Bðððð11
94 15ð FILL2
Cðððððð
INPUT FIELDS FOR RECORD DETACH FILE INTFIL FORMAT DETACH.
Dðððððð
INPUT FIELDS FOR RECORD EOS FILE INTFIL FORMAT EOS.
Eðððððð
INPUT FIELDS FOR RECORD EVKREQ FILE INTFIL FORMAT EVKREQ.
Fðððððð
INPUT FIELDS FOR RECORD ITMREQ FILE INTFIL FORMAT ITMREQ.
Fððððð1
1
6ðITEMNO
Gðððððð
INPUT FIELDS FOR RECORD DTLREQ FILE INTFIL FORMAT DTLREQ.
Gððððð1
1
6ðCUSTNO
Hðððððð
INPUT FIELDS FOR RECORD TIMER FILE INTFIL FORMAT TIMER.
Iðððððð
INPUT FIELDS FOR RECORD CIMENU FILE DSPFIL FORMAT CIMENU.
Iðððððð
MENU FOR INQUIRY
Iððððð1
3
3 \IN97
Iððððð2
2
2 \IN98
Iððððð3
1
1 \IN99
Iððððð4
4
4 OPTION
DO
NUM
1ð/ð5/9ð
LAST
UPDATE
16:12:28
Page
PAGE
PROGRAM
LINE
ID
3
16:12:28
Page
PAGE
PROGRAM
LINE
ID
4
1ð/13/87
1ð/13/87
ð2/13/89
1ð/13/87
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
1ð/ð5/9ð
ð3/17/89
1ð/13/87
1ð/13/87
DO
NUM
1ð/ð5/9ð
LAST
UPDATE
Figure D-16 (Part 2 of 13). Source Program Example — RSDINT
Appendix D. Program Examples
D-45
Jðððððð
INPUT FIELDS FOR RECORD DTLMNU FILE DSPFIL FORMAT DTLMNU.
Jðððððð
BUYER INQUIRY SCREEN 1
Jððððð1
3
3 \IN97
Jððððð2
2
2 \IN98
Jððððð3
1
1 \IN99
Jððððð4
4
9ðCUSTNO
Kðððððð
INPUT FIELDS FOR RECORD DTLSCR FILE DSPFIL FORMAT DTLSCR.
Kðððððð
BUYER INQUIRY SCR. #2
Kððððð1
3
3 \IN97
Kððððð2
2
2 \IN98
Kððððð3
1
1 \IN99
Lðððððð
INPUT FIELDS FOR RECORD ITMMNU FILE DSPFIL FORMAT ITMMNU.
Lðððððð
ITEM INQUIRY SCREEN ONE
Lððððð1
3
3 \IN97
Lððððð2
2
2 \IN98
Lððððð3
1
1 \IN99
Lððððð4
4
9ðITEMNO
Mðððððð
INPUT FIELDS FOR RECORD ITMSC2 FILE DSPFIL FORMAT ITMSC2.
Mðððððð
ITEM INQUIRY SCREEN TWO
Mððððð1
3
3 \IN97
Mððððð2
2
2 \IN98
Mððððð3
1
1 \IN99
Nðððððð
INPUT FIELDS FOR RECORD ITMSC3 FILE DSPFIL FORMAT ITMSC3.
Nðððððð
ITEM INQUIRY SCREEN 3
Nððððð1
3
3 \IN97
Nððððð2
2
2 \IN98
Nððððð3
1
1 \IN99
Oðððððð
INPUT FIELDS FOR RECORD TIMOUT FILE DSPFIL FORMAT TIMOUT.
Oðððððð
TIME OUT SCREEN
Oððððð1
3
3 \IN97
Oððððð2
2
2 \IN98
Oððððð3
1
1 \IN99
Oððððð4
4
4 TIMRSP
58ðð IIODS
DS
5738RG1 V2R1Mð 91ð524
IBM AS/4ðð RPG/4ðð
INTLIB/RSDINT
SEQUENCE
IND
NUMBER
\...1....+....2....+....3....+....4....+....5....+....6....+....7...\ USE
59ðð I
1 24ð FILLð1
6ððð I
261 268 RECID
61ðð I
271 415 FILLð2
62ðð IIOFB
DS
63ðð I
\ROUTINE LOC
64ðð I
\STATUS ERR
65ðð I
1 24ð FILLð3
66ðð I
38 47 FMTNM
67ðð I
273 282 CMID
68ðð I
4ð1 4ð4 MAJMIN
69ðð I
4ð1 4ð2 MAJCOD
7ððð I
4ð3 4ð4 MINCOD
71ðð I
261 268 RECID2
72ðð I
271 415 FILLð4
73ðð C\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
74ðð C\
\
75ðð C\
C A L C U L A T I O N
S P E C I F I C A T I O N S
\
76ðð C\
\
77ðð C\
THE DISPLAY PROGRAM DEVICE IS IMPLICITLY ACQUIRED WHEN THE \
78ðð C\
FILE IS OPENED.
\
79ðð C\
\
8ððð C\
ALL OF THE ICF PROGRAM DEVICES ARE EXPLICITLY ACQUIRED.
\
81ðð C\
\
82ðð C\
THE TARGET PROGRAM IS EVOKED TWICE TO ESTABLISH TWO
\
83ðð C\
DIFFERENT TRANSACTIONS.
\
84ðð C\
\
85ðð C\
THE MAIN INQUIRY MENU (CIMENU) IS WRITTEN TO THE USER'S
\
86ðð C\
DISPLAY.
\
87ðð C\
\
88ðð C\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
89ðð
\.3/
9ððð C
ENTRY
TAG
91ðð C
'ICFðð
'ACQ INTFIL
1ST SESSION
92ðð C
'ICFð1
'ACQ INTFIL
2ND SESSION
93ðð C
MOVEL'ICFðð
'CMID
1ST PROGRAM
94ðð C
EXSR EVKSR
CALL EVOKE
95ðð C
MOVEL'ICFð1
'CMID
2ND PROGRAM
96ðð C
EXSR EVKSR
CALL EVOKE
97ðð C
MAIN
TAG
98ðð C
WRITECIMENU
Figure D-16 (Part 3 of 13). Source Program Example — RSDINT
D-46
Intrasystem Communications Programming V4R1
DO
NUM
1ð/13/87
1ð/ð5/9ð 16:12:28
Page
LAST
PAGE
PROGRAM
UPDATE
LINE
ID
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/14/87
1ð/14/87
1ð/13/87
1ð/ð5/9ð
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
1ð/ð5/9ð
ð3/17/89
1ð/ð5/9ð
1ð/ð5/9ð
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
1ð/13/87
1ð/13/87
1ð/13/87
11/21/88
11/21/88
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
5
99ðð C\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
1ðððð C\
\
1ð1ðð C\
DETERMINE USER'S REQUEST
\
1ð2ðð C\
\
1ð3ðð C\
A READ TO THE DISPLAY DEVICE IS ISSUED TO RECEIVE THE
\
1ð4ðð C\
USER'S REQUEST. THE TYPE OF REQUEST MADE IS BASED ON THE
\
1ð5ðð C\
DISPLAY FORMAT CURRENTLY ON THE SCREEN. THE RECORD FORMAT \
1ð6ðð C\
NAME IS EXTRACTED FROM THE I/O FEEDBACK AREA AND USED TO
\
1ð7ðð C\
DETERMINE WHAT ACTION SHOULD BE TAKEN NEXT.
\
1ð8ðð C\
\
1ð9ðð C\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
11ððð
\.4/
5738RG1 V2R1Mð 91ð524
IBM AS/4ðð RPG/4ðð
INTLIB/RSDINT
SEQUENCE
IND
NUMBER
\...1....+....2....+....3....+....4....+....5....+....6....+....7...\ USE
111ðð C
READRQ
TAG
112ðð C
SETOF
8889 TIMEOUT IND
1 2
113ðð C
READ DSPFIL
87
3
114ðð C
RECID
CABEQ'CIMENU 'MENU
MAIN MENU ?
115ðð C
RECID
CABEQ'ITMMNU 'ITMIN
ITEM MENU ?
116ðð C
RECID
CABEQ'ITMSC2 'ITMRTN
ITM SCR?
117ðð C
RECID
CABEQ'ITMSC3 'ITMRTN
ITM SCR?
118ðð C
RECID
CABEQ'DTLMNU 'DTLIN
DETAIL SCR?
119ðð C
RECID
CABEQ'DTLSCR 'DTLRTN
CUST SCR?
12ððð C
WRITECIMENU
MAIN MENU IF
121ðð C
GOTO READRQ
THERE IS ERR
122ðð C\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
123ðð C\
\
124ðð C\
MAIN MENU
\
125ðð C\
\
126ðð C\
THE MAIN MENU IS READ TO DETERMINE THE REQUEST ENTERED
\
127ðð C\
BY THE USER. IF CMD 1 (\IN99) IS PRESSED, THE PROGRAM
\
128ðð C\
IS ENDED. IF OPTION = 1, AN ITEM INQUIRY MENU IS WRITTEN \
129ðð C\
TO SCREEN. IF OPTION = 2, A BUYER'S INQUIRY MENU IS
\
13ððð C\
WRITTEN TO THE SCREEN.
\
131ðð C\
\
132ðð C\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
133ðð
\.5/
134ðð C
MENU
TAG
135ðð C
\IN99
CABEQ'1'
END
JOB ENDS
136ðð C
OPTION
IFEQ '1'
137ðð C
WRITEITMMNU
ITEM MENU
138ðð C
ELSE
139ðð C
WRITEDTLMNU
CUST MENU
14ððð C
END
141ðð C
GOTO READRQ
142ðð C\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
143ðð C\
\
144ðð C\
ITEM INQUIRY
\
145ðð C\
\
146ðð C\
THE ITEM NUMBER REQUESTED BY THE USER ON THE ITEM INQUIRY \
147ðð C\
SCREEN IS CHECKED. THIS IS DETERMINED BY THE
\
148ðð C\
DISPLAY RECORD FORMAT BEING PROCESSED - IN THIS CASE
\
149ðð C\
ITMMNU.
\
15ððð C\
\
151ðð C\
IF CMD 1 (\IN99) IS PRESSED, THE PROGRAM IS ENDED. IF
\
152ðð C\
CMD 2 IS PRESSED, THE ITEM INQUIRY REQUEST IS CANCELED,
\
153ðð C\
AND THE MAIN MENU (CIMENU) IS WRITTEN TO THE SCREEN.
\
154ðð C\
\
155ðð C\
IF AN ITEM NUMBER IS ENTERED, AN ITEM INQUIRY REQUEST IS \
156ðð C\
SENT TO THE APPROPRIATE TARGET PROGRAM.
\
157ðð C\
\
158ðð C\
IF A FAIL INDICATION IS RECEIVED, A FRESH ITEM MENU IS
\
159ðð C\
WRITTEN TO THE DISPLAY DEVICE.
\
16ððð C\
\
161ðð C\
IF AN ERROR OCCURS, THE ERROR IS PRINTED AND THE JOB
\
162ðð C\
IS ENDED.
\
163ðð C\
\
164ðð C\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
DO
NUM
Bðð1
ðð1
Xðð1
ðð1
Eðð1
1ð/13/87
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
1ð/13/87
1ð/13/87
1ð/ð5/9ð 16:12:28
Page
LAST
PAGE
PROGRAM
UPDATE
LINE
ID
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
1ð/13/87
6
Figure D-16 (Part 4 of 13). Source Program Example — RSDINT
Appendix D. Program Examples
D-47
5738RG1 V2R1Mð 91ð524
IBM AS/4ðð RPG/4ðð
INTLIB/RSDINT
SEQUENCE
IND
NUMBER
\...1....+....2....+....3....+....4....+....5....+....6....+....7...\ USE
165ðð
\.6/
166ðð C
ITMIN
TAG
167ðð C
\IN99
CABEQ'1'
END
EXIT ON CMD3
168ðð C
\IN98
IFEQ '1'
169ðð C
WRITECIMENU
MAIN MENU
17ððð C
GOTO READRQ
171ðð C
END
172ðð C
MOVEL'ICFð1
'CMID
173ðð C
XITMIN
TAG
174ðð C
WRITEITMREQ
INQ W/INVITE
175ðð C
MAJCOD
CABGE'ð4'
ERROR
ERROR RTN
176ðð C
TRY89
TAG
177ðð C
SETOF
89
3
178ðð C
WRITETIMER
START TIMER
179ðð C
MOVEL'
'CMID
18ððð C
READ INTFIL
891ðRECV ITM INFO
2 3
181ðð C
89
EXSR ERRCHK
CHCK ERR INFO
182ðð C
\IN25
IFEQ '1'
RECEIVE FAIL
183ðð C
WRITEITMMNU
ITEM MENU
184ðð C
GOTO READRQ
185ðð C
END
186ðð C
MAJMIN
CABGE'ð3ðð'
ITMIN
NODATATRYAGN
187ðð C
MAJCOD
CABGE'ð4'
ERROR
ERROR RTN
188ðð C
RECID2
CABNE'ITMRSP' RECERR
PRINT MSG
189ðð C\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
19ððð C\
\
191ðð C\
PROCESS ITEM INFORMATION
\
192ðð C\
\
193ðð C\
THE ITEM RECORD RECEIVED FROM THE TARGET PROGRAM AND THE \
194ðð C\
INFORMATION ABOUT THE ITEM IS PROCESSED AND DISPLAYED.
\
195ðð C\
IF A FAIL INDICATION IS RECEIVED FROM THE TARGET PROGRAM, \
196ðð C\
ITEM REQUESTED WAS NOT FOUND, AND A FRESH ITEM MENU
\
197ðð C\
IS DISPLAYED IF ITEMNO IS ð OR LESS, IT IS AN INVALID
\
198ðð C\
REQUEST AND A FRESH ITEM MENU IS WRITTEN TO THE SCREEN.
\
199ðð C\
IF THE REQUEST IS VALID, VALUES ARE CALCULATED BASED ON
\
2ðððð C\
THE INFORMATION RECEIVED.
\
2ð1ðð C\
\
2ð2ðð C\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
2ð3ðð
\.7/
2ð4ðð C
ITMOUT
TAG
2ð5ðð C
ITEMNO
IFLE ðððððð
2ð6ðð C
WRITEITMMNU
ITEM MENU
2ð7ðð C
GOTO READRQ
READ DISPLY
2ð8ðð C
ELSE
2ð9ðð C
Z-ADDð
QAVAIL 7ð
QTY AVAIL.
21ððð C
ADD QTYOH
QAVAIL
211ðð C
SUB QTYOO
QAVAIL
212ðð C
ADD QTYBO
QAVAIL
213ðð C
MOVELDESC
DSC
214ðð C
MOVE QTYOO
QTYO
215ðð C
MOVE QTYOH
QTYH
216ðð C
MOVE QTYBO
QTYB
217ðð C
MOVE UNITQ
UNT
218ðð C
MOVE PRð1
PR1
5738RG1 V2R1Mð 91ð524
IBM AS/4ðð RPG/4ðð
INTLIB/RSDINT
SEQUENCE
IND
NUMBER
\...1....+....2....+....3....+....4....+....5....+....6....+....7...\ USE
219ðð C
MOVE PRð5
PR5
22ððð C
MOVE UFRT
UFR
221ðð C
WRITEITMSC2
DSP DETAIL
222ðð C
GOTO READRQ
223ðð C\
END
Figure D-16 (Part 5 of 13). Source Program Example — RSDINT
D-48
Intrasystem Communications Programming V4R1
DO
NUM
Bðð1
ðð1
ðð1
Eðð1
Bðð1
ðð1
ðð1
Eðð1
Bðð1
ðð1
ðð1
Xðð1
ðð1
ðð1
ðð1
ðð1
ðð1
ðð1
ðð1
ðð1
ðð1
ðð1
DO
NUM
ðð1
ðð1
ðð1
ðð1
1ð/ð5/9ð 16:12:28
Page
LAST
PAGE
PROGRAM
UPDATE
LINE
ID
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
11/28/88
1ð/13/87
1ð/13/87
1ð/13/87
OQ
11/28/88
12/ð1/88
11/3ð/88
1ð/13/87
11/16/88
11/16/88
11/16/88
11/16/88
1ð/13/87
1ð/13/87
1ð/13/87
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
1ð/ð5/9ð
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/ð5/9ð 16:12:28
Page
LAST
PAGE
PROGRAM
UPDATE
LINE
ID
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
7
8
224ðð C\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
225ðð C\
\
226ðð C\
ADDITIONAL ITEM INFORMATION
\
227ðð C\
\
228ðð C\
ADDITIONAL ITEM INFORMATION IS PROCESSED AND THE RESULT
\
229ðð C\
DISPLAYED ON THE SCREEN WHEN A RESPONSE IS READ
\
23ððð C\
FROM THE DISPLAY STATION WITH AN ITEM SCREEN RECORD
\
231ðð C\
FORMAT.
\
232ðð C\
\
233ðð C\
IF CMD 1 (\IN99) IS PRESSED, THE PROGRAM IS ENDED.
\
234ðð C\
\
235ðð C\
IF CMD 2 (\IN98) IS PRESSED, THE ITEM INQUIRY IS
\
236ðð C\
ENDED, AND THE MAIN MENU (CIMENU) IS WRITTEN TO THE
\
237ðð C\
SCREEN.
\
238ðð C\
\
239ðð C\
IF CMD 3 (\IN97) IS PRESSED, THE ITEM INQUIRY MENU IS
\
24ððð C\
WRITTEN ON THE SCREEN.
\
241ðð C\
\
242ðð C\
IF 'ENTER' IS PRESSED WHILE SCREEN 2 FOR ITEM REQUESTED IS\
243ðð C\
CURRENTLY DISPLAYED, MORE INFORMATION IS CALCULATED AND
\
244ðð C\
DISPLAYED.
\
245ðð C\
\
246ðð C\
IF 'ENTER' IS PRESSED WHILE SCREEN 3 FOR ITEM REQUESTED IS\
247ðð C\
CURRENTLY DISPLAYED, THEN THE ITEM INQUIRY MENU
\
248ðð C\
IS WRITTEN TO THE SCREEN.
\
249ðð C\
\
25ððð C\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
251ðð
\.8/
252ðð C
ITMRTN
TAG
253ðð C
\IN99
CABEQ'1'
END
JOB ENDS
254ðð C
\IN98
IFEQ '1'
255ðð C
WRITECIMENU
MAIN MENU
256ðð C
GOTO READRQ
257ðð C
END
258ðð C
\IN97
IFEQ '1'
CMD 3 ?
259ðð C
RECID
IFEQ 'ITMSC2 '
ITM SCR 2 ?
26ððð C
WRITEITMMNU
YES,THEN ITS
261ðð C
GOTO READRQ
ITEM MENU
262ðð C
END
263ðð C
END
264ðð C
RECID
IFEQ 'ITMSC3 '
ITM SCR 3 ?
265ðð C
WRITEITMMNU
YES,THEN ITS
266ðð C
GOTO READRQ
ITEM MENU
267ðð C
END
268ðð C
SLSTM
SUB CSTTM
PROFM
92
PROF MONTH
269ðð C
MULT 1ðð
PROFM
27ððð C
SLSTM
COMP ð
46
3
271ðð C
N46
PROFM
DIV SLSTM
PROFM
PROF PCT
272ðð C
QTYLST
MULT PRð1
LOSTS
LOST SALES
5738RG1 V2R1Mð 91ð524
IBM AS/4ðð RPG/4ðð
INTLIB/RSDINT
SEQUENCE
IND
NUMBER
\...1....+....2....+....3....+....4....+....5....+....6....+....7...\ USE
273ðð C
MOVE SLSTM
SLSM
274ðð C
MOVE SLSTY
SLSY
275ðð C
MOVE CSTTM
CSTM
276ðð C
MOVE PROFM
PROFIT
277ðð C
MOVE CSTTY
CSTY
278ðð C
WRITEITMSC3
DET ITM INF
279ðð C
GOTO READRQ
28ððð C\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
281ðð C\
\
282ðð C\
BUYER INQUIRY
\
283ðð C\
\
284ðð C\
THE REQUEST FROM THE BUYER INQUIRY MENU IS PROCESSED.
\
285ðð C\
\
286ðð C\
IF CMD 1 (\IN99) IS PRESSED, THE PROGRAM IS ENDED.
\
287ðð C\
\
288ðð C\
IF CMD 2 (\IN98) IS PRESSED, THE BUYER INQUIRY IS ENDED, \
289ðð C\
AND THE MAIN MENU (CIMENU) IS WRITTEN TO THE SCREEN.
\
29ððð C\
\
291ðð C\
IF A BUYER NUMBER IS ENTERED, THE BUYER INQUIRY
\
292ðð C\
REQUEST IS SENT TO THE TARGET PROGRAM.
\
293ðð C\
\
294ðð C\
A READ TO THE ICF PROGRAM DEVICE IS ISSUED TO RECEIVE
\
295ðð C\
THE INFORMATION FROM THE TARGET PROGRAM.
\
296ðð C\
\
297ðð C\
IF A FAIL INDICATION IS RECEIVED, A FRESH MAIN MENU IS
\
298ðð C\
WRITTEN TO THE DISPLAY DEVICE.
\
299ðð C\
\
ðð1
ðð1
Bðð2
ðð2
ðð2
Eðð2
Bðð2
Bðð3
ðð3
ðð3
Eðð3
Eðð2
Bðð2
ðð2
ðð2
Eðð2
ðð1
ðð1
ðð1
ðð1
ðð1
DO
NUM
ðð1
ðð1
ðð1
ðð1
ðð1
ðð1
ðð1
1ð/13/87
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/ð5/9ð 16:12:28
Page
LAST
PAGE
PROGRAM
UPDATE
LINE
ID
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
1ð/ð5/9ð
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
9
Figure D-16 (Part 6 of 13). Source Program Example — RSDINT
Appendix D. Program Examples
D-49
3ðððð C\
IF AN ERROR OCCURS, THE ERROR IS PRINTED AND THE JOB IS
\
3ð1ðð C\
ENDED.
\
3ð2ðð C\
\
3ð3ðð C\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
3ð4ðð
\.9/
3ð5ðð C
DTLIN
TAG
3ð6ðð C
\IN99
CABEQ'1'
END
JOB ENDS
3ð7ðð C
\IN98
IFEQ '1'
3ð8ðð C
WRITECIMENU
MAIN MENU
3ð9ðð C
GOTO READRQ
31ððð C
END
311ðð C
EVDTL
TAG
312ðð C
MOVEL'ICFðð
'CMID
313ðð C
WRITEDTLREQ
CUST INQ
314ðð C
MAJCOD
CABGE'ð4'
ERROR
ERROR RTN
315ðð C
TRY88
TAG
316ðð C
SETOF
88
3
317ðð C
WRITETIMER
START TIMER
318ðð C
MOVEL'
'CMID
319ðð C
READ INTFIL
881ðRCV CUS INF
2 3
32ððð C
88
EXSR ERRCHK
CHECK ERR
321ðð C
\IN25
IFEQ '1'
RECEIVE FAIL
322ðð C
SETOF
66
3
323ðð C
WRITECIMENU
MAIN MENU
324ðð C
GOTO READRQ
325ðð C
END
326ðð C
MAJMIN
CABGE'ð3ðð'
EVDTL
NODATATRYAGN
5738RG1 V2R1Mð 91ð524
IBM AS/4ðð RPG/4ðð
INTLIB/RSDINT
SEQUENCE
IND
NUMBER
\...1....+....2....+....3....+....4....+....5....+....6....+....7...\ USE
327ðð C
MAJCOD
CABGE'ð4'
ERROR
ERROR RTN
328ðð C
RECID2
CABNE'DTLRSP' RECERR
PRINT MSG
329ðð C\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
33ððð C\
\
331ðð C\
PROCESS BUYER INFORMATION
\
332ðð C\
\
333ðð C\
THE BUYER DATA RECEIVED FROM THE TARGET PROGRAM
\
334ðð C\
IS PROCESSED AND THE INFORMATION IS WRITTEN TO THE
\
335ðð C\
SCREEN.
\
336ðð C\
\
337ðð C\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
338ðð
\.1ð/
339ðð C
DTOUT
TAG
34ððð C
MOVE CUSTNO
CUSTN
341ðð C
MOVELDNAME
CNAME
342ðð C
MOVE DLSTOR
DLSTR
343ðð C
MOVE DSLSTM
DSLSM
344ðð C
MOVE DSPMð1
DSPM1
345ðð C
MOVE DSPMð2
DSPM2
346ðð C
MOVE DSTTYD
DSTYD
347ðð C
MOVE IDEPT
DEPT
348ðð C
WRITEDTLSCR
BLD CUS SCR
349ðð C
GOTO READRQ
35ððð C\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
351ðð C\
\
352ðð C\
THIS ROUTINE HANDLES THE USER'S REQUEST FOLLOWING THE
\
353ðð C\
DISPLAY OF THE BUYER INFORMATION. CMD KEY 1 WILL
\
354ðð C\
EXIT THE JOB, CMD KEY 2 WILL DISPLAY THE MAIN MENU, AND
\
355ðð C\
"ENTER" WILL BRING UP THE BUYER INQUIRY MENU.
\
356ðð C\
\
357ðð C\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
358ðð
\.11/
359ðð C
DTLRTN
TAG
36ððð C
\IN99
CABEQ'1'
END
JOB ENDS
361ðð C
\IN98
IFEQ '1'
362ðð C
WRITECIMENU
MAIN MENU
363ðð C
GOTO READRQ
364ðð C
END
365ðð C
WRITEDTLMNU
BUYER INQ
366ðð C
GOTO READRQ
367ðð C\
368ðð C\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
369ðð C\
\
37ððð C\
WHEN AN I/O OPERATION ERROR IS DETECTED, A MESSAGE IS
\
371ðð C\
PRINTED AND THE TRANSACTION AND SESSION ARE ENDED
\
372ðð C\
WITH EACH OF THE TARGET PROGRAMS.
\
373ðð C\
\
Figure D-16 (Part 7 of 13). Source Program Example — RSDINT
D-50
Intrasystem Communications Programming V4R1
ðð1
ðð1
Bðð2
ðð2
ðð2
Eðð2
ðð1
ðð1
ðð1
ðð1
ðð1
ðð1
ðð1
ðð1
ðð1
ðð1
Bðð2
ðð2
ðð2
ðð2
Eðð2
ðð1
DO
NUM
ðð1
ðð1
ðð1
ðð1
ðð1
ðð1
ðð1
ðð1
ðð1
ðð1
ðð1
ðð1
ðð1
ðð1
ðð1
Bðð2
ðð2
ðð2
Eðð2
ðð1
ðð1
ð3/17/89
ð3/17/89
ð3/17/89
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
11/28/88
12/ð1/88
12/ð1/88
1ð/13/87
11/16/88
ð3/17/89
11/16/88
11/16/88
11/16/88
1ð/13/87
1ð/ð5/9ð 16:12:28
Page
LAST
PAGE
PROGRAM
UPDATE
LINE
ID
1ð/13/87
1ð/13/87
1ð/13/87
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
ð3/17/89
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
11/21/88
1ð/13/87
1ð/13/87
1ð/13/87
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
1ð
374ðð C\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
375ðð
\.12/
376ðð C
RECERR
TAG
377ðð C
EXCPTRECER
WRONG RECID
378ðð C
GOTO END
END PROGRAM
379ðð C
ERROR
TAG
38ððð C
EXCPTMMERR
5738RG1 V2R1Mð 91ð524
IBM AS/4ðð RPG/4ðð
INTLIB/RSDINT
SEQUENCE
IND
NUMBER
\...1....+....2....+....3....+....4....+....5....+....6....+....7...\ USE
381ðð C
END
TAG
382ðð C
MOVEL'ICFðð
'CMID
383ðð C
WRITEDETACH
DET 1ST SES
384ðð C
MOVEL'ICFð1
'CMID
385ðð C
WRITEDETACH
DET 2ND SES
386ðð C
ABORT
TAG
387ðð C
'ICFðð
'REL INTFIL
86 REL 1ST SES
2
388ðð C
'ICFð1
'REL INTFIL
86 REL 2ND SES
2
389ðð C
FORCE
TAG
39ððð C
SETON
LR
1
391ðð C
RETRN
392ðð C
END
393ðð C\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
394ðð C\
\
395ðð C\
THIS SUBROUTINE IS CALLED TO EVOKE THE TARGET PROGRAM.
\
396ðð C\
THE SAME TARGET PROGRAM (ICFLIB/RTDMULCL) IS EVOKED
\
397ðð C\
TWO DIFFERENT TIMES CREATING TWO JOBS. THE PROGRAM DEVICE \
398ðð C\
IDENTIFIES WHICH SESSION SHOULD BE EVOKED. THE PROGRAM
\
399ðð C\
DEVICE WAS SPECIFIED IN CMID PRIOR TO CALLING THIS
\
4ðððð C\
ROUTINE.
\
4ð1ðð C\
\
4ð2ðð C\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
4ð3ðð
\.13/
4ð4ðð C
EVKSR
BEGSR
4ð5ðð C
MOVE \BLANK
PGMID
BLANK OUT
4ð6ðð C
MOVE \BLANK
LIB
BLANK OUT
4ð7ðð C
MOVEL'RTDINTCL'PGMID
PROGR NAME
4ð8ðð C
MOVEL'INTLIB 'LIB
LIBRARY
4ð9ðð C
WRITEEVKREQ
41ððð C
MAJCOD
CABGE'ð4'
END
TO END PGM
411ðð C
ENDSR
412ðð C\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
413ðð C\
\
414ðð C\
THIS SUBROUTINE IS CALLED TO PERFORM FURTHER CHECKS ON
\
415ðð C\
FILE ERRORS RESULTING FROM THE READ OPERATION ISSUED TO
\
416ðð C\
THE PROGRAM DEVICE. THIS ROUTINE CHECKS FOR THE TIME
\
417ðð C\
OUT INDICATION. IF IT IS, A MESSAGE IS SENT TO THE USER
\
418ðð C\
DISPLAY SCREEN REQUESTING ACTION, OTHERWISE PROGRAM ENDS. \
419ðð C\
ALSO, IF A FAIL INDICATION IS RECEIVED, A FRESH MAIN MENU \
42ððð C\
IS WRITTEN TO THE DISPLAY DEVICE.
\
421ðð C\
\
422ðð C\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
423ðð
\.14/
424ðð C
ERRCHK
BEGSR
425ðð C
MAJMIN
IFEQ 'ð31ð'
TIMER EXPD?
426ðð C
CHKAGN
TAG
427ðð C
WRITETIMOUT
DISPLAY MSG
428ðð C
READ DSPFIL
86READ REPLY
3
429ðð C
88
TIMRSP
CABEQ'1'
TRY88
CUST INQUIR
43ððð C
89
TIMRSP
CABEQ'1'
TRY89
ITEM INQUIR
431ðð C
TIMRSP
IFEQ '2'
END PROGRAM
432ðð C
WRITEEOS
END SESSION
433ðð C
GOTO FORCE
END PROGRAM
434ðð C
END
5738RG1 V2R1Mð 91ð524
IBM AS/4ðð RPG/4ðð
INTLIB/RSDINT
SEQUENCE
IND
NUMBER
\...1....+....2....+....3....+....4....+....5....+....6....+....7...\ USE
435ðð C
GOTO CHKAGN
ASK AGAIN
436ðð C
END
437ðð C
\IN25
IFEQ '1'
RECEIVE FAIL
438ðð C
WRITECIMENU
MAIN MENU
439ðð C
GOTO READRQ
44ððð C
END
441ðð C
GOTO ERROR
ABEND
442ðð C
ENDSR
ðð1
ðð1
ðð1
ðð1
ðð1
DO
NUM
ðð1
ðð1
ðð1
ðð1
ðð1
ðð1
ðð1
ðð1
ðð1
ðð1
ðð1
Eðð1
Bðð1
ðð1
ðð1
ðð1
ðð1
ðð1
Bðð2
ðð2
ðð2
Eðð2
DO
NUM
ðð1
Eðð1
Bðð1
ðð1
ðð1
Eðð1
1ð/13/87
1ð/13/87
1ð/13/87
ð3/17/89
1ð/13/87
1ð/13/87
ð3/17/89
1ð/ð5/9ð 16:12:28
Page
LAST
PAGE
PROGRAM
UPDATE
LINE
ID
1ð/13/87
1ð/13/87
ð3/17/89
1ð/13/87
ð3/17/89
1ð/13/87
11/21/88
11/21/88
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
12/12/88
ð2/13/89
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/ð5/9ð 16:12:28
Page
LAST
PAGE
PROGRAM
UPDATE
LINE
ID
1ð/13/87
1ð/13/87
11/16/88
11/16/88
11/16/88
11/16/88
1ð/13/87
1ð/13/87
11
12
Figure D-16 (Part 8 of 13). Source Program Example — RSDINT
Appendix D. Program Examples
D-51
443ðð C\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
444ðð C\
\
445ðð C\
THIS IS THE PROGRAM ERROR SUBROUTINE THAT RECEIVES
\
446ðð C\
CONTROL WHEN AN ERROR OCCURS AFTER AN I/O OPERATION
\
447ðð C\
IS ISSUED TO THE PROGRAM DEVICE AND THERE IS A NON\
448ðð C\
ZERO VALUE IN THE RPG STATUS FIELD (ERR).
\
449ðð C\
THIS ROUTINE CHECKS FOR STATUS VALUES THAT RELATE TO
\
45ððð C\
ICF OPERATIONS.
\
451ðð C\
IF THE PROGRAM DEVICE IS ALREADY ACQUIRED, THE ERROR IS
\
452ðð C\
IGNORED, OTHERWISE, THE PROGRAM IS TERMINATED.
\
453ðð C\
\
454ðð C\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
455ðð
\.15/
456ðð C
\PSSR
BEGSR
457ðð C
MOVE '
' RETURN 6
DEFAULT
458ðð C
ERR
CABEQð1285
ENDPSR
ALREADY ACQ?
459ðð C
MOVE '\CANCL' RETURN
JOB ENDS
46ððð C
ENDPSR
ENDSRRETURN
BACK TO MAIN
461ðð C\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
462ðð OQPRINT E 1
MMERR
463ðð O
21 'COMMUNICATION ERROR.'
464ðð O
34 'MAJOR/MINOR:'
465ðð O
MAJCOD
37
466ðð O
38 '/'
467ðð O
MINCOD
4ð
468ðð O
49 'FORMAT:'
469ðð O
FMTNM
6ð
47ððð O
69 'PGMDEV:'
471ðð O
CMID
8ð
472ðð O
E 1
RECER
473ðð O
2ð 'UNMATCH RECD FORMAT'
474ðð O
31 '-JOB ENDS.'
475ðð O
MAJCOD
37
476ðð O
38 '/'
477ðð O
MINCOD
4ð
478ðð O
49 'FORMAT:'
479ðð O
RECID2
6ð
48ððð O
69 'PGMDEV:'
481ðð O
CMID
8ð
\ 61ð3
481ð1
OVERFLOW INDICATOR OA ASSIGNED TO FILE QPRINT.
Pðððððð
OUTPUT FIELDS FOR RECORD DETACH FILE INTFIL FORMAT DETACH.
Qðððððð
OUTPUT FIELDS FOR RECORD EOS FILE INTFIL FORMAT EOS.
Rðððððð
OUTPUT FIELDS FOR RECORD EVKREQ FILE INTFIL FORMAT EVKREQ.
Rððððð1
PGMID
1ð CHAR
1ð
5738RG1 V2R1Mð 91ð524
IBM AS/4ðð RPG/4ðð
INTLIB/RSDINT
SEQUENCE
IND
NUMBER
\...1....+....2....+....3....+....4....+....5....+....6....+....7...\ USE
Rððððð2
LIB
2ð CHAR
1ð
Sðððððð
OUTPUT FIELDS FOR RECORD ITMREQ FILE INTFIL FORMAT ITMREQ.
Sððððð1
ITEMNO
6 ZONE 6,ð
Tðððððð
OUTPUT FIELDS FOR RECORD DTLREQ FILE INTFIL FORMAT DTLREQ.
Tððððð1
CUSTNO
6 ZONE 6,ð
Uðððððð
OUTPUT FIELDS FOR RECORD TIMER FILE INTFIL FORMAT TIMER.
Vðððððð
OUTPUT FIELDS FOR RECORD CIMENU FILE DSPFIL FORMAT CIMENU.
Vðððððð
MENU FOR INQUIRY
Wðððððð
OUTPUT FIELDS FOR RECORD DTLMNU FILE DSPFIL FORMAT DTLMNU.
Wðððððð
BUYER INQUIRY SCREEN 1
Xðððððð
OUTPUT FIELDS FOR RECORD DTLSCR FILE DSPFIL FORMAT DTLSCR.
Xðððððð
BUYER INQUIRY SCR. #2
Xððððð1
CUSTN
6 CHAR
6
Xððððð2
DEPT
9 ZONE 3,ð
Xððððð3
DLSTR
15 ZONE 6,ð
Xððððð4
DSLSM
24 ZONE 9,ð
Xððððð5
DSPM1
33 ZONE 9,ð
Xððððð6
DSPM2
42 ZONE 9,ð
Xððððð7
DSPM3
51 ZONE 9,ð
Xððððð8
DSTYD
62 ZONE 11,ð
Xððððð9
CNAME
67 CHAR
5
Yðððððð
OUTPUT FIELDS FOR RECORD ITMMNU FILE DSPFIL FORMAT ITMMNU.
Yðððððð
ITEM INQUIRY SCREEN ONE
Zðððððð
OUTPUT FIELDS FOR RECORD ITMSC2 FILE DSPFIL FORMAT ITMSC2.
Zðððððð
ITEM INQUIRY SCREEN TWO
Zððððð1
DSC
3ð CHAR
3ð
Zððððð2
QAVAIL
37 ZONE 7,ð
Zððððð3
QTYH
44 ZONE 7,ð
Zððððð4
QTYO
51 ZONE 7,ð
Zððððð5
QTYB
58 ZONE 7,ð
Zððððð6
UNT
6ð CHAR
2
Zððððð7
PR1
67 ZONE 7,2
Zððððð8
PR5
74 ZONE 7,ð
Zððððð9
UFR
79 ZONE 5,2
Figure D-16 (Part 9 of 13). Source Program Example — RSDINT
D-52
Intrasystem Communications Programming V4R1
1ð/14/87
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
1ð/ð5/9ð
ð3/17/89
ð3/17/89
ð3/17/89
1ð/14/87
1ð/14/87
1ð/14/87
1ð/14/87
1ð/14/87
1ð/14/87
ð2/13/89
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
DO
NUM
1ð/ð5/9ð
LAST
UPDATE
16:12:28
Page
PAGE
PROGRAM
LINE
ID
13
1ðððððð
1ðððððð
1ððððð1
1ððððð2
1ððððð3
1ððððð4
1ððððð5
1ððððð6
2ðððððð
2ðððððð
OUTPUT FIELDS FOR RECORD ITMSC3 FILE DSPFIL FORMAT ITMSC3.
ITEM INQUIRY SCREEN 3
SLSM
9 ZONE 9,2
SLSY
2ð ZONE 11,2
CSTM
29 ZONE 9,2
CSTY
4ð ZONE 11,2
PROFIT
45 ZONE 5,2
LOSTS
54 ZONE 9,2
OUTPUT FIELDS FOR RECORD TIMOUT FILE DSPFIL FORMAT TIMOUT.
TIME OUT SCREEN
\ \ \ \ \
E N D
O F
S O U R C E
\ \ \ \ \
A d d i t i o n a l
D i a g n o s t i c
M e s s a g e s
\ 7ð89
39ðð
RPG PROVIDES SEPARATE INDICATOR AREA FOR FILE INTFIL.
5738RG1 V2R1Mð 91ð524
IBM AS/4ðð RPG/4ðð
INTLIB/RSDINT
C r o s s
R e f e r e n c e
File and Record References:
FILE/RCD
DEV/RCD
REFERENCES (D=DEFINED)
ð2 DSPFIL
WORKSTN
44ððD
113ðð
428ðð
CIMENU
44ððD Iðððððð
98ðð
12ððð
169ðð
255ðð
3ð8ðð
323ðð
362ðð
438ðð
Vðððððð
DTLMNU
44ððD Jðððððð
139ðð
365ðð Wðððððð
DTLSCR
44ððD Kðððððð
348ðð Xðððððð
ITMMNU
44ððD Lðððððð
137ðð
183ðð
2ð6ðð
26ððð
265ðð Yðððððð
ITMSC2
44ððD Mðððððð
221ðð Zðððððð
ITMSC3
44ððD Nðððððð
278ðð 1ðððððð
TIMOUT
44ððD Oðððððð
427ðð 2ðððððð
ð1 INTFIL
WORKSTN
39ððD
91ðð
92ðð
18ððð
319ðð
387ðð
388ðð
DETACH
39ððD Cðððððð
383ðð
385ðð Pðððððð
DTLREQ
39ððD Gðððððð
313ðð Tðððððð
DTLRSP
39ððD Bðððððð
EOS
39ððD Dðððððð
432ðð Qðððððð
EVKREQ
39ððD Eðððððð
4ð9ðð Rðððððð
ITMREQ
39ððD Fðððððð
174ðð Sðððððð
ITMRSP
39ððD Aðððððð
TIMER
39ððD Hðððððð
178ðð
317ðð Uðððððð
ð3 QPRINT
PRINTER
46ððD
462ðð
472ðð
481ð1
Field References:
FIELD
ATTR
REFERENCES (M=MODIFIED D=DEFINED)
\IN25
A(1)
182ðð
321ðð
437ðð
\IN97
A(1)
Iððððð1 Jððððð1 Kððððð1 Lððððð1 Mððððð1
Nððððð1 Oððððð1
258ðð
\IN98
A(1)
Iððððð2 Jððððð2 Kððððð2 Lððððð2 Mððððð2
Nððððð2 Oððððð2
168ðð
254ðð
3ð7ðð
361ðð
\IN99
A(1)
Iððððð3 Jððððð3 Kððððð3 Lððððð3 Mððððð3
Nððððð3 Oððððð3
135ðð
167ðð
253ðð
3ð6ðð
36ððð
\PSSR
BEGSR
39ðð
456ððD
\ 7ð31 ABORT
TAG
386ððD
CHKAGN
TAG
426ððD
435ðð
CMID
A(1ð)
67ððD
93ððM
95ððM
172ððM
179ððM
312ððM
318ððM
382ððM
384ððM
471ðð
481ðð
CNAME
A(5)
341ððM Xððððð9D
CSTM
P(9,2)
275ððM 1ððððð3D
CSTTM
P(9,2) Aðððð14D
268ðð
275ðð
5738RG1 V2R1Mð 91ð524
IBM AS/4ðð RPG/4ðð
INTLIB/RSDINT
CSTTY
P(11,2) Aðððð15D
277ðð
CSTY
P(11,2)
277ððM 1ððððð4D
CUSTN
A(6)
34ðððM Xððððð1D
CUSTNO
P(6,ð) Bððððð2D Gððððð1D Jððððð4D
34ððð Tððððð1D
DEPT
P(3,ð)
347ððM Xððððð2D
DESC
A(3ð)
Aððððð3D
213ðð
DLSTOR
P(6,ð) Bððððð4D
342ðð
DLSTR
P(6,ð)
342ððM Xððððð3D
DNAME
A(3ð)
Bððððð3D
341ðð
DSC
A(3ð)
213ððM Zððððð1D
DSLSM
P(9,ð)
343ððM Xððððð4D
DSLSTM
P(9,ð) Bððððð5D
343ðð
DSPMð1
P(9,ð) Bððððð6D
344ðð
DSPMð2
P(9,ð) Bððððð7D
345ðð
\ 7ð31 DSPMð3
P(9,ð) Bððððð8D
DSPM1
P(9,ð)
344ððM Xððððð5D
DSPM2
P(9,ð)
345ððM Xððððð6D
DSPM3
P(9,ð) Xððððð7D
DSTTYD
P(11,ð) Bððððð9D
346ðð
DSTYD
P(11,ð)
346ððM Xððððð8D
1ð/ð5/9ð
16:12:28
Page
14
1ð/ð5/9ð
16:12:28
Page
15
Figure D-16 (Part 10 of 13). Source Program Example — RSDINT
Appendix D. Program Examples
D-53
\ 7ð31
\ 7ð31
\
\
\
\
\
\
7ð31
7ð31
7ð31
7ð31
7ð31
7ð31
\ 7ð31
\ 7ð31
\ 7ð31
\ 7ð31
DTLIN
DTLRTN
DTOUT
END
ENDPSR
ENTRY
ERR
ERRCHK
ERROR
EVDTL
EVKSR
FILLð1
FILLð2
FILLð3
FILLð4
FILL1
FILL2
FMTNM
FORCE
IDEPT
IODS
IOFB
ITEMNO
ITMIN
ITMOUT
ITMRTN
LIB
LOC
LOS
LOSTS
MAIN
MAJCOD
MAJMIN
MENU
5738RG1 V2R1Mð
MINCOD
MMERR
OPTION
PGMID
\ 7ð31 PRO
PROFIT
PROFM
PRð1
PRð5
PR1
PR5
QAVAIL
QTYB
QTYBO
QTYH
QTYLST
QTYO
QTYOH
QTYOO
READRQ
\ 7ð31
\ 7ð31
RECCUS
RECER
RECERR
RECID
RECID2
RECITM
RETURN
SLSM
SLSTM
SLSTY
SLSY
TIMRSP
TRY88
TRY89
UFR
UFRT
UNITQ
UNT
TAG
TAG
TAG
TAG
118ðð
3ð5ððD
119ðð
359ððD
339ððD
135ðð
167ðð
253ðð
378ðð
381ððD
41ððð
ENDSR
458ðð
46ðððD
TAG
9ðððD
Z(5,ð)
64ððD
458ðð
BEGSR
181ðð
32ððð
424ððD
TAG
175ðð
187ðð
314ðð
441ðð
TAG
311ððD
326ðð
BEGSR
94ðð
96ðð
4ð4ððD
A(24ð)
59ððD
A(145)
61ððD
A(24ð)
65ððD
A(145)
72ððD
A(56)
Aðððð18D
A(57)
Bðððð11D
A(1ð)
66ððD
469ðð
TAG
389ððD
433ðð
P(3,ð) Bðððð1ðD
347ðð
DS(415)
44ðð
58ððD
DS(415)
39ðð
62ððD
P(6,ð) Aððððð2D Fððððð1D Lððððð4D
TAG
115ðð
166ððD
186ðð
TAG
2ð4ððD
TAG
116ðð
117ðð
252ððD
A(1ð)
4ð6ððM
4ð8ððM Rððððð2D
A(8)
63ððD
P(9,2) Aðððð17D
P(9,2)
272ððM 1ððððð6D
TAG
97ððD
A(2)
69ððD
175ðð
187ðð
41ððð
465ðð
475ðð
A(4)
68ððD
186ðð
326ðð
TAG
114ðð
134ððD
91ð524
IBM AS/4ðð RPG/4ðð
A(2)
7ðððD
467ðð
477ðð
EXCPT
38ððð
462ðð
A(1)
Iððððð4D
136ðð
A(1ð)
4ð5ððM
4ð7ððM Rððððð1D
P(5,2) Aðððð16D
P(5,2)
276ððM 1ððððð5D
P(9,2)
268ððD
269ððM
271ðð
P(7,2) Aððððð9D
218ðð
272ðð
P(7,ð) Aðððð1ðD
219ðð
P(7,2)
218ððM Zððððð7D
P(7,ð)
219ððM Zððððð8D
P(7,ð)
2ð9ððD
21ðððM
211ððM
P(7,ð)
216ððM Zððððð5D
P(7,ð) Aððððð7D
212ðð
216ðð
P(7,ð)
215ððM Zððððð3D
P(7,ð) Aððððð4D
272ðð
P(7,ð)
214ððM Zððððð4D
P(7,ð) Aððððð5D
21ððð
215ðð
P(7,ð) Aððððð6D
211ðð
214ðð
TAG
111ððD
121ðð
141ðð
2ð7ðð
222ðð
256ðð
279ðð
3ð9ðð
324ðð
366ðð
439ðð
A(1)
Bððððð1D
EXCPT
377ðð
472ðð
TAG
188ðð
328ðð
376ððD
A(8)
6ðððD
114ðð
115ðð
118ðð
119ðð
259ðð
A(8)
71ððD
188ðð
328ðð
A(1)
Aððððð1D
A(6)
457ððD
459ððM
46ððð
P(9,2)
273ððM 1ððððð1D
P(9,2) Aðððð12D
268ðð
27ððð
P(11,2) Aðððð13D
274ðð
P(11,2)
274ððM 1ððððð2D
A(1)
Oððððð4D
429ðð
43ððð
TAG
315ððD
429ðð
TAG
176ððD
43ððð
P(5,2)
22ðððM Zððððð9D
P(5,2) Aðððð11D
22ððð
A(2)
Aððððð8D
217ðð
A(2)
217ððM Zððððð6D
3ð6ðð
36ððð
327ðð
379ððD
2ð5ðð
Sððððð1D
314ðð
327ðð
425ðð
INTLIB/RSDINT
271ððM
276ðð
212ððM Zððððð2D
17ððð
261ðð
349ðð
184ðð
266ðð
363ðð
116ðð
264ðð
479ðð
117ðð
271ðð
273ðð
431ðð
Figure D-16 (Part 11 of 13). Source Program Example — RSDINT
D-54
Intrasystem Communications Programming V4R1
1ð/ð5/9ð
16:12:28
Page
16
\ 7ð31
XITMIN
TAG
\BLANK
LITERAL
'
' LITERAL
'
'
LITERAL
'\CANCL'
LITERAL
'CIMENU ' LITERAL
'DTLMNU ' LITERAL
'DTLRSP'
LITERAL
'DTLSCR ' LITERAL
'ICFðð
' LITERAL
'ICFð1
' LITERAL
'INTLIB ' LITERAL
'ITMMNU ' LITERAL
'ITMRSP'
LITERAL
'ITMSC2 ' LITERAL
5738RG1 V2R1Mð 91ð524
'ITMSC3 ' LITERAL
'RTDINTCL' LITERAL
'ð3ðð'
LITERAL
'ð31ð'
LITERAL
'ð4'
LITERAL
'1'
LITERAL
173ððD
4ð5ðð
179ðð
457ðð
459ðð
114ðð
118ðð
328ðð
119ðð
91ðð
92ðð
4ð8ðð
115ðð
188ðð
116ðð
4ð6ðð
318ðð
93ðð
95ðð
312ðð
172ðð
259ðð
IBM AS/4ðð RPG/4ðð
117ðð
264ðð
4ð7ðð
186ðð
326ðð
425ðð
175ðð
187ðð
314ðð
135ðð
136ðð
167ðð
253ðð
254ðð
258ðð
321ðð
36ððð
361ðð
437ðð
431ðð
2ð9ðð
27ððð
2ð5ðð
458ðð
269ðð
382ðð
384ðð
387ðð
388ðð
INTLIB/RSDINT
327ðð
168ðð
3ð6ðð
429ðð
1ð/ð5/9ð
16:12:28
Page
17
1ð/ð5/9ð
16:12:28
Page
18
41ððð
182ðð
3ð7ðð
43ððð
'2'
LITERAL
ð
LITERAL
ðððððð
LITERAL
ð1285
LITERAL
1ðð
LITERAL
Indicator References:
INDICATOR REFERENCES (M=MODIFIED D=DEFINED)
\IN
Iððððð1 Iððððð2 Iððððð3 Jððððð1 Jððððð2 Jððððð3
Kððððð1 Kððððð2 Kððððð3 Lððððð1 Lððððð2 Lððððð3
Mððððð1 Mððððð2 Mððððð3 Nððððð1 Nððððð2 Nððððð3
Oððððð1 Oððððð2 Oððððð3
135ðð
167ðð
168ðð
182ðð
253ðð
254ðð
258ðð
3ð6ðð
3ð7ðð
321ðð
36ððð
361ðð
437ðð
LR
39ðððM
OA
46ððD
481ð1
\ 7ð31 1ð
18ðððM
319ððM
25
182ðð
321ðð
437ðð
46
27ðððM
271ðð
\ 7ð31 66
322ððM
\ 7ð31 86
387ððM
388ððM
428ððM
\ 7ð31 87
113ððM
88
112ððM
316ððM
319ððM
32ððð
429ðð
89
112ððM
177ððM
18ðððM
181ðð
43ððð
\ 7ð31 9ð
97
Iððððð1 Jððððð1 Kððððð1 Lððððð1 Mððððð1 Nððððð1
Oððððð1
258ðð
98
Iððððð2 Jððððð2 Kððððð2 Lððððð2 Mððððð2 Nððððð2
Oððððð2
168ðð
254ðð
3ð7ðð
361ðð
99
Iððððð3 Jððððð3 Kððððð3 Lððððð3 Mððððð3 Nððððð3
Oððððð3
135ðð
167ðð
253ðð
3ð6ðð
36ððð
\ \ \ \ \
E N D
O F
C R O S S
R E F E R E N C E
\ \ \ \ \
5738RG1 V2R1Mð 91ð524
IBM AS/4ðð RPG/4ðð
INTLIB/RSDINT
M e s s a g e
S u m m a r y
\ QRG61ð3 Severity: ðð
Number:
1
Message . . . . :
No Overflow Indicator is specified but an
indicator is assigned to a file and automatic skip to 6 is
generated.
\ QRG7ð31 Severity: ðð
Number:
23
Message . . . . :
The Name or indicator is not referenced.
\ QRG7ð89 Severity: ðð
Number:
1
Message . . . . :
The RPG provides Separate-Indicator area for
file.
\ \ \ \ \
E N D
O F
M E S S A G E
S U M M A R Y
\ \ \ \ \
Figure D-16 (Part 12 of 13). Source Program Example — RSDINT
Appendix D. Program Examples
D-55
5738RG1 V2R1Mð
91ð524
IBM AS/4ðð RPG/4ðð
INTLIB/RSDINT
F i n a l
S u m m a r y
Message Count: (by Severity Number)
TOTAL
ðð
1ð
2ð
3ð
4ð
5ð
25
25
ð
ð
ð
ð
ð
Program Source Totals:
Records . . . . . . . . . . :
481
Specifications . . . . . . :
234
Table Records . . . . . . . :
ð
Comments . . . . . . . . . :
247
PRM has been called.
Program RSDINT is placed in library INTLIB. ðð highest Error-Severity-Code.
\ \ \ \ \
E N D
O F
C O M P I L A T I O N
\ \ \ \ \
1ð/ð5/9ð
16:12:28
Page
19
Figure D-16 (Part 13 of 13). Source Program Example — RSDINT
RPG/400 Target Program for a
Two-Session Inquiry
The following describes an RPG/400 target program for a
two-session inquiry.
Program Files: The RPG/400 two-session target program
uses the following files:
CFILE
An ICF file used to send records to and receive
records from the source program.
PFILE
A database file used to retrieve the requested
information to send to the source program.
QPRINT
An AS/400 printer file used to print records, both
sent and received, as well as major and minor
ICF return codes.
DDS Source: The DDS source for the ICF file (CFILE) is
illustrated in Figure D-17.
5714PW1 Rð1Mðð 88ð3ð1
SEU SOURCE LISTING
1ð/14/87 17:2ð:35
SOURCE FILE . . . . . . . QINTSRC/INTLIB
MEMBER . . . . . . . . . CFILE
SEQNBR\...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8 ...+... 9 ...+... ð
A\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
A\
\
A\
ICF FILE
\
A\
USED IN TARGET TWO SESSION PROGRAM
\
A\
\
A\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
A
INDARA
A ð5
RQSWRT
A 1ð
ALWWRT
A
INDTXT(1ð '1ð END TRANS.')
A 15
EOS
A 2ð
FAIL
A
INDTXT(2ð '2ð F ABORT ST')
A
RCVFAIL(25 'RECEIVED FAIL')
A 3ð
DETACH
A
INDTXT(3ð '3ð>DETACH TGT')
A
RCVDETACH(44 'RECV DETACH')
A
RCVTRNRND(4ð 'END OF TRN')
A
R SNDPART
A
INVITE
A
RECTYP
1
A
ITEMNO
6
A
EDATA
13ð
A
FILL1
13
A
R RCVPART
A
RECID2
6
A
PARTDS
8ð
A
FILL4
64
Figure D-17. DDS Source for an ICF File Used by a Target Program
D-56
Intrasystem Communications Programming V4R1
PAGE 1
The DDS for the database file (PFILE) is illustrated in
Figure D-18.
5714PW1 Rð1Mðð 88ð3ð1
SEU SOURCE LISTING
1ð/16/87 ð7:43:14
SOURCE FILE . . . . . . . QINTSRC/INTLIB
MEMBER . . . . . . . . . PFILE
SEQNBR\...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8 ...+... 9 ...+... ð
1ðð
A
LIFO
2ðð
A
R DBREC
3ðð
A
RECCUS
1
4ðð
A
DBSEQ
6
5ðð
A
DBDATA
13ð
6ðð
A
DBFILL
13
7ðð
A
K DBSEQ
\ \ \ \ E N D O F S O U R C E \ \ \ \
PAGE 1
ð7/ð2/87
ð5/ð6/87
1ð/ð1/87
ð8/18/87
ð7/ð2/87
1ð/ð1/87
ð7/ð4/87
Figure D-18. DDS Source for a Database File Used by a Target Program
ICF File Creation and Program Device Entry Definition:
The command needed to create the ICF file is:
CRTICFF FILE(INTLIB/CFILE)
SRCFILE(INTLIB/QINTSRC)
SRCMBR(CFILE)
ACQPGMDEV(RQSDEV)
TEXT("TARGET ICF FILE FOR TWO SESSION PROGRAM")
If a detach indication is received, control goes to
section 6 of the program. Otherwise, the program
goes to section 3. When a detach is received, indicator 44 is set on, as defined by the RCVDETACH
DDS keyword in the ICF file.
.3/
The command needed to define the program device entry is:
OVRICFDEVE PGMDEV(RQSDEV)
RMTLOCNAME(\REQUESTER)
Program Explanation: The following explains the structure
of the program example illustrated in Figure D-19 on
page D-58. The ICF file used in the example is defined by
the user, and uses externally described data formats. The
reference numbers in the explanation below correspond to
the numbers in the program example.
The program also tests to see whether the receive
detach indicator (indicator 44) is set. If it is, the
program goes to section 6.
.4/
All output operations to the ICF file in the example are done
using the write operation.
.1/
The file specification defines the files used in the
program.
If an error occurs on the write operation (a major
return code greater than 03), control passes to
section 5.
The files used in the program are implicitly opened at
the beginning of the RPG/400 cycle when the
program starts.
Ÿ Record format name (FMTNM)
If no error occurs on the write operation, the program
returns to section 2.
.5/
.6/
Control passes to this section whenever the program
has detected a communication error or has received
a detach indication from the source program. The
last record indicator is set on, which ends the
program. CFILE is implicitly closed.
.7/
The subroutine *PSSR is called for I/O operation
errors that are not handled by the subroutine in
section 6. This subroutine checks to see whether the
program device is already acquired when an acquire
Ÿ Major/minor return code (MAJMIN)
A read operation is issued to the program device to
receive an inquiry request from the source program.
If an error occurs on the read operation (a major code
greater than 03), control passes to the error section
(section 5).
When an error in an I/O operation is detected, an
EXCPT operation is issued to print an error message
saying that an error has occurred on the ICF file.
The major/minor return code is also printed.
The program then goes to section 6.
Ÿ Program device name (PGMDEV)
.2/
The program uses the requested number received
from the source program to access the record from
the database. The information retrieved from the
database file (PFILE) is moved into the work area for
the ICF file. A write operation is issued to the ICF
program device using record format SNDPART. The
write operation sends the requested information back
to the source program.
If the requested number is not found, a fail indication
is sent to the remote program using a write operation
in combination with a fail.
CFILE is the ICF file used to send records to and
receive records from the source program.
Note: The continuation lines on the file specification
for CFILE define the data structure name; for
example, FEEDBK for the feedback area (INFDS).
FEEDBK contains the following information, which is
used to monitor for error conditions after an I/O operation is issued to CFILE:
If an error occurs (a major return code greater than
03 is returned from the read operation), the program
goes to section 5. Otherwise, the program goes to
section 4.
Appendix D. Program Examples
D-57
operation is requested and if so, the second acquire
is ignored. Otherwise, the program ends.
5738RG1 V2R1Mð 91ð524
IBM AS/4ðð RPG/4ðð
INTLIB/RTDINT
Compiler . . . . . . . . . . . . . :
IBM AS/4ðð RPG/4ðð
Command Options:
Program . . . . . . . . . . . . :
INTLIB/RTDINT
Source file . . . . . . . . . . :
INTLIB/QINTSRC
Source member . . . . . . . . . :
\PGM
Text not available for message RXTðð73 file QRPGMSG.
Generation options . . . . . . . :
\NOLIST
\NOXREF
\NOATR
\NODUMP
Source listing indentation . . . :
\NONE
SAA flagging . . . . . . . . . . :
\NOFLAG
Generation severity level . . . :
9
Print file . . . . . . . . . . . :
\LIBL/QSYSPRT
Replace program . . . . . . . . :
\YES
Target release . . . . . . . . . :
\CURRENT
User profile . . . . . . . . . . :
\USER
Authority . . . . . . . . . . . :
\LIBCRTAUT
Text . . . . . . . . . . . . . . :
\SRCMBRTXT
Phase trace . . . . . . . . . . :
\NO
Intermediate text dump . . . . . :
\NONE
Snap dump . . . . . . . . . . . :
\NONE
Codelist . . . . . . . . . . . . :
\NONE
Ignore decimal data error . . . :
\NO
Actual Program Source:
Member . . . . . . . . . . . . . :
RTDINT
File . . . . . . . . . . . . . . :
QINTSRC
Library . . . . . . . . . . . . :
INTLIB
Last Change . . . . . . . . . . :
1ð/ð5/9ð 15:27:19
Description . . . . . . . . . . :
RPG Target Intra Program Example
5738RG1 V2R1Mð 91ð524
IBM AS/4ðð RPG/4ðð
INTLIB/RTDINT
SEQUENCE
IND
NUMBER
\...1....+....2....+....3....+....4....+....5....+....6....+....7...\ USE
S o u r c e
L i s t i n g
1ðð H\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
2ðð H\ THIS PROGRAM WILL HANDLE THE REQUEST FOR EITHER A BUYER
\
3ðð H\ NUMBER OR AN ITEM NUMBER. THIS IS ACCOMPLISHED BY MAKING
\
4ðð H\ THE DATA BASE FILE STRUCTURE (KEY LENGTH, KEY POSITION,
\
5ðð H\ RECORD LENGTH, RECORD SIZE, ETC.) THE SAME FOR BOTH FILES
\
6ðð H\ WITH ONLY THE RECORD CONTENTS DIFFERENT.
\
7ðð H\
\
8ðð H\ THIS PROGRAM ENDS WHEN A DETACH REQUEST IS RECEIVED FROM
\
9ðð H\ THE SOURCE PROGRAM.
\
1ððð H\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
11ðð
\.1/
H
12ðð FCFILE
CF E
WORKSTN
13ðð F
KINFDS FEEDBK
14ðð F
KINFSR \PSSR
RECORD FORMAT(S): LIBRARY INTLIB FILE CFILE.
EXTERNAL FORMAT SNDPART RPG NAME SNDPART
EXTERNAL FORMAT RCVPART RPG NAME RCVPART
15ðð FPFILE
IF E
K
DISK
RECORD FORMAT(S): LIBRARY INTLIB FILE PFILE.
EXTERNAL FORMAT DBREC RPG NAME DBREC
16ðð FQPRINT O
F
132
PRINTER
Aðððððð
INPUT FIELDS FOR RECORD SNDPART FILE CFILE FORMAT SNDPART.
Aððððð1
1
1 RECTYP
Aððððð2
2
7 ITEMNO
Aððððð3
8 137 EDATA
Aððððð4
138 15ð FILL1
Bðððððð
INPUT FIELDS FOR RECORD RCVPART FILE CFILE FORMAT RCVPART.
Bððððð1
1
6 RECID2
Bððððð2
7 86 PARTDS
Bððððð3
87 15ð FILL4
Cðððððð
INPUT FIELDS FOR RECORD DBREC FILE PFILE FORMAT DBREC.
Cððððð1
1
1 RECCUS
Cððððð2
2
7 DBSEQ
Cððððð3
8 137 DBDATA
Cððððð4
138 15ð DBFILL
Figure D-19 (Part 1 of 5). Target Program Example —RTDINT
D-58
Intrasystem Communications Programming V4R1
1ð/ð5/9ð
16:13:ð8
Page
1
16:13:ð8
Page
PAGE
PROGRAM
LINE
ID
2
\NOOPTIMIZE
DO
NUM
1ð/ð5/9ð
LAST
UPDATE
1ð/13/87
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
1ð/13/87
ð3/17/89
\\\\\
1ð/13/87
1ð/13/87
1ð/14/87
1ð/13/87
ð3/17/89
17ðð IFEEDBK
DS
18ðð I
\ROUTINE LOC
19ðð I
\STATUS ERR
2ððð I
38 47 FMTNM
21ðð I
273 282 PGMDEV
22ðð I
4ð1 4ð4 MAJMIN
23ðð I
4ð1 4ð2 MAJCOD
24ðð I
4ð3 4ð4 MINCOD
25ðð C\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
5738RG1 V2R1Mð 91ð524
IBM AS/4ðð RPG/4ðð
INTLIB/RTDINT
SEQUENCE
IND
NUMBER
\...1....+....2....+....3....+....4....+....5....+....6....+....7...\ USE
26ðð C\
\
27ðð C\ READ THE REQUEST FROM THE SOURCE PROGRAM. INDICATOR 4ð
\
28ðð C\ INDICATES RCVTRNRND OCCURRED. INDICATOR 44 INDICATES THAT \
29ðð C\ DETACH HAS BEEN RECEIVED.
\
3ððð C\
\
31ðð C\ INDICATOR 99 WILL BE TURNED ON FOR "I/O ERRORS" THEREBY
\
32ðð C\ PREVENTING THE RPG DEFAULT ERROR HANDLER FROM BEING CALLED. \
33ðð C\ THIS IS NECESSARY TO ALLOW THE PROGRAM TO PROCESS THE
\
34ðð C\ ICF MAJOR/MINOR RETURN CODE. THIS PROGRAM CHECKS
\
35ðð C\ FOR ERRORS ON EVERY ICF FILE OPERATION. A MAJOR
\
36ðð C\ CODE GREATER THAN ð3 INDICATES AN ERROR.
\
37ðð C\
\
38ðð C\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
39ðð
\.2/
4ððð C
READ
TAG
41ðð C
READ RCVPART
995ð
2 3
42ðð C
MAJCOD
CABGT'ð3'
ERROR
43ðð C
\IN44
CABEQ'1'
END
DET RECV?
44ðð C
MOVE RECID2
DBSEQ
45ðð C
MAJMIN
CABEQ'ðððð'
XMIT
RCVTRNRND?
46ðð C
\IN4ð
CABEQ'1'
XMIT
RCVTRNRND?
47ðð C
GOTO READ
NO,TRY AGAIN
48ðð C\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
49ðð C\
\
5ððð C\ A REQUEST FROM THE SOURCE PROGRAM RESULTS IN READING A
\
51ðð C\ SINGLE RECORD CONTAINING THE REQUESTED BUYER OR ORDER
\
52ðð C\ NUMBER. THE RESPONSE WILL BE RETURNED IN A SINGLE RECORD
\
53ðð C\ CONTAINING EITHER THE ITEM OR BUYER INFORMATION, DEPENDING \
54ðð C\ ON THE DATA BASE CONTENT.
\
55ðð C\
\
56ðð C\ THE RESPONSE IS SENT TO THE SOURCE PROGRAM BY WRITING TO
\
57ðð C\ THE ICF FILE USING FORMAT SNDPART.
\
58ðð C\
\
59ðð C\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
6ððð
\.3/
61ðð C
XMIT
TAG
62ðð C
DBSEQ
CHAINPFILE
9897
98 IF NOT FD
1 2
63ðð C
MOVE DBSEQ
ITEMNO
64ðð C
MOVE RECCUS
RECTYP
RECD FMT ID
65ðð C\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
66ðð C\
\
67ðð C\ WHEN THE REQUESTED BUYER OR ITEM NUMBER IS NOT FOUND,
\
68ðð C\ ðððððð IS PROPAGATED TO THE KEY FIELD BEFORE THE RESPONSE
\
69ðð C\ IS SENT BACK TO THE SOURCE PROGRAM.
\
7ððð C\ WHEN A DISK I/O OPERATION COMPLETES UNSUCCESSFULLY, A FAIL \
71ðð C\ INDICATION IS SENT.
\
72ðð C\
\
73ðð C\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
74ðð
\.4/
75ðð C
98
MOVE 'ðððððð' ITEMNO
76ðð C
98
MOVE '1'
\IN2ð
SEND FAIL
77ðð C
MOVELDBDATA
EDATA
MOVE DATA
DO
NUM
1ð/13/87
1ð/14/87
1ð/14/87
1ð/ð5/9ð
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
ð3/17/89
1ð/ð5/9ð 16:13:ð8
Page
LAST
PAGE
PROGRAM
UPDATE
LINE
ID
ð3/17/89
ð3/17/89
1ð/ð5/9ð
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
1ð/ð5/9ð
1ð/ð5/9ð
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
1ð/ð5/9ð
ð3/17/89
ð3/17/89
ð3/17/89
1ð/13/87
11/21/88
1ð/13/87
1ð/13/87
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
1ð/13/87
11/21/88
1ð/13/87
3
Figure D-19 (Part 2 of 5). Target Program Example —RTDINT
Appendix D. Program Examples
D-59
5738RG1 V2R1Mð 91ð524
IBM AS/4ðð RPG/4ðð
INTLIB/RTDINT
SEQUENCE
IND
NUMBER
\...1....+....2....+....3....+....4....+....5....+....6....+....7...\ USE
78ðð C
97
MOVE '1'
\IN2ð
SEND FAIL
79ðð C
WRITESNDPART
DATA W/DET
8ððð C
MAJCOD
CABGT'ð3'
ERROR
81ðð C
MOVE 'ð'
\IN2ð
RESET IND
82ðð C
GOTO READ
83ðð C\
84ðð C\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
85ðð C\
\
86ðð C\ IF ANY ICF FILE ERROR OCCURS, PRINT THE ERROR MESSAGE, AND
\
87ðð C\ THEN END THE JOB.
\
88ðð C\
\
89ðð C\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
9ððð
\.5/
91ðð C
ERROR
TAG
92ðð C
EXCPTMMERR
93ðð C
END
TAG
94ðð
\.6/
95ðð C
SETON
LR
1
96ðð C
RETRN
97ðð C\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
98ðð C\
\
99ðð C\
THIS IS THE PROGRAM EXCEPTION/ERROR SUBROUTINE THAT
\
1ðððð C\
RECEIVES CONTROL WHEN AN EXCEPTION OR ERROR OCCURS
\
1ð1ðð C\
AFTER AN I/O IS ISSUED TO AN ICF PROGRAM DEVICE AND
\
1ð2ðð C\
THERE IS A NON-ZERO VALUE UPDATED IN THE RPG STATUS
\
1ð3ðð C\
FIELD (ERR). THIS ROUTINE CHECKS FOR STATUS VALUES THAT \
1ð4ðð C\
RELATE TO ICF OPERATION.
\
1ð5ðð C\
IF THE PROGRAM DEVICE IS ALREADY ACQUIRED, THE EXCEPTION \
1ð6ðð C\
IS IGNORED, OTHERWISE THE PROGRAM IS TERMINATED.
\
1ð7ðð C\
\
1ð8ðð C\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
1ð9ðð
\.7/
11ððð C
\PSSR
BEGSR
111ðð C
MOVE '
' RETURN 6
DEFAULT
112ðð C
ERR
CABEQð1285
ENDPSR
ALREADY ACQ?
113ðð C
MOVE '\CANCL' RETURN
JOB ENDS
114ðð C
ENDPSR
ENDSRRETURN
BACK TO MAIN
115ðð C\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
116ðð OQPRINT E 1
MMERR
117ðð O
21 'ERROR ON ICF FILE'
118ðð O
34 'MAJOR/MINOR:'
119ðð O
MAJCOD
37
12ððð O
38 '/'
121ðð O
MINCOD
4ð
122ðð O
49 'FORMAT:'
123ðð O
FMTNM
6ð
124ðð O
69 'PGMDEV:'
125ðð O
PGMDEV
8ð
\ 61ð3
125ð1
OVERFLOW INDICATOR OA ASSIGNED TO FILE QPRINT.
Dðððððð
OUTPUT FIELDS FOR RECORD SNDPART FILE CFILE FORMAT SNDPART.
Dððððð1
RECTYP
1 CHAR
1
Dððððð2
ITEMNO
7 CHAR
6
5738RG1 V2R1Mð 91ð524
IBM AS/4ðð RPG/4ðð
INTLIB/RTDINT
SEQUENCE
IND
NUMBER
\...1....+....2....+....3....+....4....+....5....+....6....+....7...\ USE
Dððððð3
EDATA
137 CHAR 13ð
Dððððð4
FILL1
15ð CHAR
13
\ \ \ \ \
E N D
O F
S O U R C E
\ \ \ \ \
A d d i t i o n a l
D i a g n o s t i c
M e s s a g e s
\ 7ð89
12ðð
RPG PROVIDES SEPARATE INDICATOR AREA FOR FILE CFILE.
5738RG1 V2R1Mð 91ð524
IBM AS/4ðð RPG/4ðð
INTLIB/RTDINT
K e y
F i e l d
I n f o r m a t i o n
PHYSICAL
LOGICAL
FILE/RCD
FIELD
FIELD
ATTRIBUTES
ð2 PFILE
DBREC
DBSEQ
CHAR
6
Figure D-19 (Part 3 of 5). Target Program Example —RTDINT
D-60
Intrasystem Communications Programming V4R1
DO
NUM
DO
NUM
1ð/ð5/9ð 16:13:ð8
Page
LAST
PAGE
PROGRAM
UPDATE
LINE
ID
11/21/88
1ð/13/87
1ð/13/87
11/21/88
1ð/13/87
1ð/13/87
ð3/17/89
ð3/17/89
1ð/ð5/9ð
1ð/ð5/9ð
ð3/17/89
ð3/17/89
ð3/17/89
1ð/13/87
ð3/17/89
1ð/13/87
ð3/17/89
1ð/13/87
1ð/13/87
1ð/14/87
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
ð3/17/89
1ð/14/87
ð3/17/89
1ð/14/87
1ð/14/87
1ð/14/87
1ð/14/87
1ð/14/87
1ð/13/87
1ð/13/87
1ð/ð5/9ð
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
1ð/13/87
4
1ð/ð5/9ð
LAST
UPDATE
16:13:ð8
Page
PAGE
PROGRAM
LINE
ID
5
1ð/ð5/9ð
16:13:ð8
6
Page
5738RG1 V2R1Mð
91ð524
IBM AS/4ðð RPG/4ðð
INTLIB/RTDINT
C r o s s
R e f e r e n c e
File and Record References:
FILE/RCD
DEV/RCD
REFERENCES (D=DEFINED)
ð1 CFILE
WORKSTN
12ððD
RCVPART
12ððD Bðððððð
41ðð
SNDPART
12ððD Aðððððð
79ðð Dðððððð
ð2 PFILE
DISK
15ððD
62ðð
DBREC
15ððD Cðððððð
ð3 QPRINT
PRINTER
16ððD
116ðð
125ð1
Field References:
FIELD
ATTR
REFERENCES (M=MODIFIED D=DEFINED)
\IN2ð
A(1)
76ððM
78ððM
81ððM
\IN4ð
A(1)
46ðð
\IN44
A(1)
43ðð
\PSSR
BEGSR
12ðð
11ðððD
DBDATA
A(13ð) Cððððð3D
77ðð
\ 7ð31 DBFILL
A(13)
Cððððð4D
DBSEQ
A(6)
Cððððð2D
44ððM
62ðð
63ðð
EDATA
A(13ð) Aððððð3D
77ððM Dððððð3D
END
TAG
43ðð
93ððD
ENDPSR
ENDSR
112ðð
114ððD
ERR
Z(5,ð)
19ððD
112ðð
ERROR
TAG
42ðð
8ððð
91ððD
FEEDBK
DS(4ð4)
12ðð
17ððD
FILL1
A(13)
Aððððð4D Dððððð4D
\ 7ð31 FILL4
A(64)
Bððððð3D
FMTNM
A(1ð)
2ðððD
123ðð
ITEMNO
A(6)
Aððððð2D
63ððM
75ððM Dððððð2D
\ 7ð31 LOC
A(8)
18ððD
MAJCOD
A(2)
23ððD
42ðð
8ððð
119ðð
MAJMIN
A(4)
22ððD
45ðð
MINCOD
A(2)
24ððD
121ðð
MMERR
EXCPT
92ðð
116ðð
\ 7ð31 PARTDS
A(8ð)
Bððððð2D
PGMDEV
A(1ð)
21ððD
125ðð
READ
TAG
4ðððD
47ðð
82ðð
RECCUS
A(1)
Cððððð1D
64ðð
RECID2
A(6)
Bððððð1D
44ðð
RECTYP
A(1)
Aððððð1D
64ððM Dððððð1D
RETURN
A(6)
111ððD
113ððM
114ðð
XMIT
TAG
45ðð
46ðð
61ððD
'
'
LITERAL
111ðð
'\CANCL'
LITERAL
113ðð
'ð'
LITERAL
81ðð
'ðððð'
LITERAL
45ðð
5738RG1 V2R1Mð 91ð524
IBM AS/4ðð RPG/4ðð
INTLIB/RTDINT
'ðððððð'
LITERAL
75ðð
'ð3'
LITERAL
42ðð
8ððð
'1'
LITERAL
43ðð
46ðð
76ðð
78ðð
ð1285
LITERAL
112ðð
Indicator References:
INDICATOR REFERENCES (M=MODIFIED D=DEFINED)
\IN
43ðð
46ðð
76ððM
78ððM
81ððM
LR
95ððM
OA
16ððD
125ð1
\ 7ð31 ð5
\ 7ð31 1ð
\ 7ð31 15
2ð
76ððM
78ððM
81ððM
\ 7ð31 25
\ 7ð31 3ð
4ð
46ðð
44
43ðð
\ 7ð31 5ð
41ððM
97
62ððM
78ðð
98
62ððM
75ðð
76ðð
\ 7ð31 99
41ððM
\ \ \ \ \
E N D
O F
C R O S S
R E F E R E N C E
\ \ \ \ \
1ð/ð5/9ð
16:13:ð8
Page
7
1ð/ð5/9ð
16:13:ð8
Page
8
Figure D-19 (Part 4 of 5). Target Program Example —RTDINT
Appendix D. Program Examples
D-61
5738RG1 V2R1Mð
91ð524
IBM AS/4ðð RPG/4ðð
INTLIB/RTDINT
M e s s a g e
S u m m a r y
\ QRG61ð3 Severity: ðð
Number:
1
Message . . . . :
No Overflow Indicator is specified but an
indicator is assigned to a file and automatic skip to 6 is
generated.
\ QRG7ð31 Severity: ðð
Number:
11
Message . . . . :
The Name or indicator is not referenced.
\ QRG7ð89 Severity: ðð
Number:
1
Message . . . . :
The RPG provides Separate-Indicator area for
file.
\ \ \ \ \
E N D
O F
M E S S A G E
S U M M A R Y
\ \ \ \ \
5738RG1 V2R1Mð 91ð524
IBM AS/4ðð RPG/4ðð
INTLIB/RTDINT
F i n a l
S u m m a r y
Message Count: (by Severity Number)
TOTAL
ðð
1ð
2ð
3ð
4ð
5ð
13
13
ð
ð
ð
ð
ð
Program Source Totals:
Records . . . . . . . . . . :
125
Specifications . . . . . . :
53
Table Records . . . . . . . :
ð
Comments . . . . . . . . . :
72
PRM has been called.
Program RTDINT is placed in library INTLIB. ðð highest Error-Severity-Code.
\ \ \ \ \
E N D
O F
C O M P I L A T I O N
\ \ \ \ \
Figure D-19 (Part 5 of 5). Target Program Example —RTDINT
D-62
Intrasystem Communications Programming V4R1
1ð/ð5/9ð
16:13:ð8
Page
9
1ð/ð5/9ð
16:13:ð8
Page
1ð
Bibliography
The publications listed here provide additional information
about topics described or referred to in this book. These
books are listed with their full title and order number.
Ÿ CL Reference, SC41-5722, contains the commands,
command parameters, and syntax for the commands
used in this book.
AS/400 Books
Ÿ Work Management, SC41-5306, contains information
about how to create an initial work management environment and how to change it.
The following AS/400 books contain additional information
you may need when developing application programs that
use intrasystem communications support.
Ÿ ICF Programming, SC41-5442, provides the application
programmer with information needed to write programs
that use AS/400 communications and the OS/400 intersystem communications function (OS/400-ICF).
Ÿ Communications Configuration, SC41-5401, contains
general configuration information, including detailed
descriptions of network interface, line, controller, device,
mode, and class-of-service descriptions, configuration
lists and connection lists.
Ÿ DDS Reference, SC41-5712, contains information about
coding data description specifications for files.
Ÿ C/400* User's Guide, SC09-1347, provides the information needed to write, test, and maintain C/400 programs
for the AS/400 system.
Ÿ COBOL/400 User’s Guide, SC09-1812, provides the
information needed to write, test, and maintain
COBOL/400 programs for the AS/400 system.
Ÿ RPG/400 User’s Guide, SC09-1816, provides the information needed to write, test, and maintain RPG/400 programs for the AS/400 system.
Ÿ System Operation, SC41-4203, provides information on
how to use the system unit operator display.
System/36 Communications Books
The following book provides a description of the Intra Subsystem on the System/36, and information about setting up
and configuring the Intra Subsystem, communications operations, and return codes:
Ÿ Interactive Communications Feature: Programming for
Subsystems and Intra Subsystem Reference,
SC21-9533.
The following two books provide information and examples
about the interactive communications feature, a feature of the
System Support Program Product on the System/36 that
allows a program to communicate interactively with another
program or system:
Ÿ Interactive Communications Feature: Base Subsystems
Reference, SC21-9530.
Ÿ Interactive Communications Feature: Guide and Examples, SC21-7911.
The following book provides an overview for programming in
the System/36 environment:
Ÿ System/36 Environment Programming, SC41-4730.
 Copyright IBM Corp. 1997
H-1
H-2
Intrasystem Communications Programming V4R1
Index
A
acquire operation 4-3
Add ICF Device Entry (ADDICFDEVE) command 4-1
ADDICFDEVE command 4-1
advanced program-to-program communications (APPC)
definition C-1
allow-write function
definition 4-6
using C-3
APPC (advanced program-to-program
communications) C-1
application
communications 1-2
considerations
close 5-2
confirm 5-2
general 5-1
input 5-1
open/acquire 5-1
programs 4-1
testing 1-2, C-1
AS/400 manuals H-1
ASCVRYOFF parameter 3-1
asynchronous communications
definition C-2
AUT parameter 2-1
authority (AUT) parameter 2-1
B
BATCH parameter 4-2
bibliography H-1
binary synchronous communications (BSC)
definition C-2
binary synchronous communications equivalence link
(BSCEL)
definition C-2
BSC (binary synchronous communications)
definition C-2
BSCEL (binary synchronous communications equivalence link)
definition C-2
C
C Set ++ programming language
cancel function
definition 4-5
cancel-invite function
definition 4-6
CFGOBJ parameter 3-1
 Copyright IBM Corp. 1997
CFGTYPE parameter 3-1
Change Device Description (Intrasystem) (CHGDEVINTR)
command 2-1
Change ICF Device Entry (CHGICFDEVE) command 4-1
Change ICF File (CHGICFF) command 4-1
CHGDEVINTR command 2-1
CHGICFDEVE command 4-1
CHGICFF command 4-1
close operation
considerations 5-2
definition 4-7
CMNTYPE parameter 4-2
COBOL/400 programming language
source program D-14
target program D-33
command prompt 2-1
commands
Add ICF Device Entry (ADDICFDEVE) 4-1
Change Device Description (Intrasystem)
(CHGDEVINTR) 2-1
Change ICF Device Entry (CHGICFDEVE) 4-1
Change ICF File (CHGICFF) 4-1
command prompt 2-1
Create Device Description (Intrasystem)
(CRTDEVINTR) 2-1
Create ICF File (CRTICFF) 4-1
Delete File (DLTF) 4-1
direct entry 2-1
Display Field Description (DSPFFD) 4-1
Display File Description (DSPFD) 4-1
entry 2-1
Override ICF Device Entry (OVRICFDEVE) 4-1
Override ICF File (OVRICFF) 4-1
Remove ICF Device Entry (RMVICFDEVE) 4-1
Vary Configuration (VRYCFG) 3-1
communications
application testing 1-2
intrasystem
configuration 2-1
considerations 5-1
operations 4-3
communications type (CMNTYPE) parameter 4-2
configuring intrasystem communications 2-1
confirm function
advanced program-to-program communications
(APPC) C-1
considerations 5-2
definition 4-4
finance communications C-3
retail communications C-4
sending data 4-4
X-1
considerations
applications 5-1
close operation 5-2
confirm function 5-2
general 5-1
input 5-1
intrasystem communications 5-1
open/acquire 5-1
performance 5-2
conversation types C-1
Create Device Description (Intrasystem) (CRTDEVINTR)
command 2-1
Create ICF File (CRTICFF) command 4-1
CRTDEVINTR command 2-1
CRTICFF command 4-1
D
data
management 1-1
queue 4-5
receiving 4-4, C-3, C-4
sending 4-4, C-4
sense C-4, C-5
data description specifications (DDS) keywords A-2
DDS keywords A-2
Delete File (DLTF) command 4-1
detach function
asynchronous communications C-2
binary synchronous communications equivalence link
(BSCEL) C-2
definition 4-6
ending transactions 4-6
retail communications C-4
DEVD parameter 2-1
device description (DEVD) parameter 2-1
direct entry of commands 2-1
Display Field Description (DSPFFD) command 4-1
display file 4-5
Display File Description (DSPFD) command 4-1
DLTF command 4-1
DSPFD command 4-1
DSPFFD command 4-1
E
end-of-group function
binary synchronous communications equivalence link
(BSCEL) C-2
definition 4-4
finance communications C-3
retail communications C-4
sending data 4-4
Systems Network Architecture Uplink Facility
(SNUF) C-5
X-2
Intrasystem Communications Programming V4R1
end-of-session
considerations 5-2
end-of-session function
definition 4-7
ending
sessions 4-7
transactions 4-6
entry of commands
command prompt 2-1
direct 2-1
evoke function
advanced program-to-program communications
(APPC) C-1
asynchronous communications C-2
binary synchronous communications equivalence link
(BSCEL) C-2
definition 4-3
retail communications C-4
starting transactions 4-3
Systems Network Architecture Uplink Facility
(SNUF) C-5
examples
COBOL/400 source program D-14
COBOL/400 target program D-33
commands
Create Device Description (Intrasystem)
(CRTDEVINTR) command 2-1
Vary Configuration (VRYCFG) 3-1
VRYCFG 3-1
device description 2-1
ILE C/400 source program D-1
ILE C/400 target program D-9
intrasystem communications configuration 2-1
performance condideration 5-1
program D-1
return code usage 4-8, 4-9
RPG/400 source program D-39
RPG/400 target program D-56
single-session inquiry program D-1
two-session inquiry program D-14
F
fail function
advanced program-to-program communications
(APPC) C-1
asynchronous communications C-2
binary synchronous communications equivalence link
(BSCEL) C-3
definition 4-5
problem notification 4-5
Systems Network Architecture Uplink Facility
(SNUF) C-5
failed program start requests B-24
feedback area 4-8
return code usage
error condition 4-9
feedback area (continued)
using
error condition 4-9
file commands
Add ICF Device Entry (ADDICFDEVE) 4-1
Change ICF Device Entry (CHGICFDEVE) 4-1
Change ICF File (CHGICFF) 4-1
Create ICF File (CRTICFF) 4-1
Delete File (DLTF) 4-1
Display Field Descriptions (DSPFFD) 4-1
Display File Descriptions (DSPFD) 4-1
Override ICF Device Entry (OVRICFDEVE) 4-1
Override ICF File (OVRICFF) 4-1
Remove ICF Device Entry (RMVICFDEVE) 4-1
FILE parameter 4-2
finance communications
definition C-3
FMTSLT parameter 4-2
force-data function
advanced program-to-program communications
(APPC) C-1
definition 4-4
finance communications C-3
retail communications C-4
sending data 4-4
format-name function 4-4
definition 4-4
function-management-header data C-5
function-management-header function
definition 4-4
using C-2
functions
allow-write 4-6, C-3
cancel 4-5
cancel-invite 4-6
detach
asynchronous communications C-2
binary synchronous communications equivalence link
(BSCEL) C-2
ending transactions 4-6
retail communications C-4
end-of-group
binary synchronous communications equivalence link
(BSCEL) C-2
finance communications C-3
retail communications C-4
sending data 4-4
Systems Network Architecture Uplink Facility
(SNUF) C-5
end-of-session 4-7
evoke
advanced program-to-program communications
(APPC) C-1
asynchronous communications C-2
binary synchronous communications equivalence link
(BSCEL) C-2
retail communications C-4
functions (continued)
evoke (continued)
starting transactions 4-3
Systems Network Architecture Uplink Facility
(SNUF) C-5
fail
advanced program-to-program communications
(APPC) C-1
asynchronous communications C-2
binary synchronous communications equivalence link
(BSCEL) C-3
problem notification 4-5
Systems Network Architecture Uplink Facility
(SNUF) C-5
force-data
advanced program-to-program communications
(APPC) C-1
finance communications C-3
retail communications C-4
sending data 4-4
format-name 4-4
function-management-header 4-4, C-2
invite
finance communications C-3
receiving data 4-4
retail communications C-4
keyword A-2
negative-response 4-5
request-to-write 4-6, C-3
respond-to-confirm 4-6
subdevice selection 4-4
timer 4-6
G
general considerations of intrasystem communications
applications 5-1
get-attributes operation
definition 4-6
I
ICF (intersystem communications function)
ILE C/400 programming language
functions A-1
source program D-1
target program D-9
ILE COBOL/400 programming language
procedure statements A-1
ILE RPG/400 programming language
operation codes A-1
indicators
receive-cancel 4-8
receive-confirm 4-7
receive-detach 4-8
receive-end-of-group 4-7
Index
X-3
indicators (continued)
receive-fail 4-8
receive-function-management-header 4-8
receive-negative-response 4-8
receive-turnaround 4-8
input considerations 5-1
input/output feedback area 4-8
intersystem communications function (ICF)
data management 1-1
definition 1-1
file 4-1, 4-5
file commands
Add ICF Device Entry (ADDICFDEVE) 4-1
Change ICF Device Entry (CHGICFDEVE) 4-1
Change ICF File (CHGICFF) 4-1
Create ICF File (CRTICFF) 4-1
Delete File (DLTF) 4-1
Display Field Description (DSPFFD) 4-1
Display File Description (DSPFD) 4-1
Override ICF Device Entry (OVRICFDEVE) 4-1
Override ICF File (OVRICFF) 4-1
Remove ICF Device Entry (RMVICFDEVE) 4-1
language operations A-1
intrasystem
application programs 4-1
communications
application considerations 5-1
configuration 2-1
definition 1-1
device description 2-1
overview 1-1
performance considerations 5-2
support 1-1, 3-1
testing communications applications 1-2
invite function
definition 4-4
finance communications C-3
receiving data 4-4
retail communications C-4
J
jobs
5-2
K
keyword functions
keywords A-2
A-2
L
language operations
N
name of device description (CFGOBJ) parameter 3-1
negative-response function
definition 4-5
number of sessions
asynchronous communications C-2
binary synchronous communications equivalence link
(BSCEL) C-3
finance communications C-4
retail communications C-5
Systems Network Architecture Uplink Facility
(SNUF) C-5
O
online messages C-3
ONLINE parameter 2-1
open operation 4-3
open/acquire
considerations 5-1
operation 4-3
operations
acquire 4-3
close 4-7
communications 4-3
get-attributes 4-6
open 4-3
open/acquire 4-3
output C-1
read
asynchronous communications C-2
finance communications C-4
receiving data 4-4
retail communications C-5
read-from-invited-program-devices 4-5
release 4-7
write
asynchronous communications C-2
finance communications C-3
retail communications C-4
sending data 4-4
output operations C-1
Override ICF Device Entry (OVRICFDEVE) command
Override ICF File (OVRICFF) command 4-1
overview of intrasystem communications 1-1
OVRICFF command 4-1
A-1
P
M
manuals
AS/400
X-4
manuals (continued)
System/36 H-1
messages B-1
H-1
Intrasystem Communications Programming V4R1
parameters
ADDICFDEVE command
BATCH 4-2
4-1
parameters (continued)
ADDICFDEVE command (continued)
CMNTYPE 4-2
FILE 4-2
FMTSLT 4-2
PGMDEV 4-2
RMTLOCNAME 4-2
ASCVRYOFF 3-1
authority (AUT) 2-1
BATCH 4-2
CHGDEVINTR command
AUT 2-1
DEVD 2-1
ONLINE 2-1
TEXT 2-1
CHGICFDEVE command
BATCH 4-2
CMNTYPE 4-2
FILE 4-2
FMTSLT 4-2
PGMDEV 4-2
RMTLOCNAME 4-2
communications type (CMNTYPE) 4-2
CRTDEVINTR command
AUT 2-1
DEVD 2-1
ONLINE 2-1
RMTLOCNAME 2-1
TEXT 2-1
device description (DEVD) 2-1
FILE 4-2
name of device description (CFGOBJ) 3-1
ONLINE 2-1
OVRICFDEVE command
BATCH 4-2
CMNTYPE 4-2
FMTSLT 4-2
PGMDEV 4-2
RMTLOCNAME 4-2
SECURE 4-2
program device name (PGMDEV) 4-2
RANGE 3-1
record format selection (FMTSLT) 4-2
remote location name (RMTLOCNAME) 2-1, 4-2
SECURE 4-2
STATUS 3-1
TEXT 2-1
type of configuration description (CFGTYPE) 3-1
VRYCFG command
ASCVRYOFF 3-1
CFGOBJ 3-1
CFGTYPE 3-1
RANGE 3-1
STATUS 3-1
VRYWAIT 3-1
VRYWAIT 3-1
performance considerations 5-2
PGMDEV parameter 4-2
PIP (program initialization procedure)
definition 4-3
prestarting jobs for program start requests 5-2
problem notification 4-5
program
device entry commands 4-2
examples D-1
start requests 5-2, C-3
testing C-1
program device name (PGMDEV) parameter 4-2
program initialization procedure (PIP)
definition 4-3
R
RANGE parameter 3-1
read
function
finance communications C-3
retail communications C-4
operation
asynchronous communications C-2
finance communications C-4
receiving data 4-4
retail communications C-5
read operation function
definition 4-4
read-from-invited-program-devices operation
definition 4-5
receive-cancel response indicator
definition 4-8
receive-confirm response indicator
definition 4-7
receive-detach response indicator
definition 4-8
receive-end-of-group response indicator
definition 4-7
receive-fail response indicator
definition 4-8
receive-function-management-header response indicator
definition 4-8
receive-negative-response response indicator
definition 4-8
receive-turnaround indication C-3
receive-turnaround response indicator
definition 4-8
receiving data 4-4, C-3, C-4
record
blocking C-3
length C-1, C-3
record format selection (FMTSLT) parameter 4-2
related printed information H-1
release function
considerations 5-2
Index
X-5
release operation
definition 4-7
remote location name (RMTLOCNAME) parameter 2-1,
4-2
Remove ICF Device Entry (RMVICFDEVE) command 4-1
request-to-write function
definition 4-6
using C-3
respond-to-confirm function
definition 4-6
response indicator
definition 4-7
response indicators
receive-cancel 4-8
receive-confirm 4-7
receive-detach 4-8
receive-end-of-group 4-7
receive-fail 4-8
receive-function-management-header 4-8
receive-negative-response 4-8
receive-turnaround 4-8
using 4-7
retail communications
definition C-4
return codes
detailed descriptions of B-1
using 4-8, 4-9
RMTLOCNAME parameter 2-1, 4-2
RMVICFDEVE command 4-1
RPG/400 programming language
source program D-39
target program D-56
S
SECURE parameter 4-2
sending data 4-4, C-4
sense data
definition 4-6
finance communications C-4
retail communications C-5
sessions
ending 4-7
starting 4-3
single-session inquiry program
ILE C/400 source program example D-1
ILE C/400 target program example D-9
SNUF (Systems Network Architecture Uplink Facility)
definition C-5
source program
COBOL/400 two-session inquiry example D-14
ILE C/400 single-session inquiry example D-1
RPG/400 two-session inquiry example D-39
starting
sessions 4-3
transactions 4-3
X-6
Intrasystem Communications Programming V4R1
STATUS parameter 3-1
subdevice selection function
definition 4-4
system messages C-5
system-supplied formats A-2
System/36 manuals H-1
Systems Network Architecture Uplink Facility (SNUF)
definition C-5
T
target program
COBOL/400 two-session inquiry example D-33
ILE C/400 single-session inquiry example D-9
RPG/400 two-session inquiry example D-56
testing application programs
advanced program-to-program communications
(APPC) C-1
asynchronous communications C-2
binary synchronous communications (BSC) C-2
binary synchronous communications equivalence link
(BSCEL) C-2
communications applications 1-2
finance communications C-3
retail communications C-4
using intrasystem communications C-1
TEXT parameter 2-1
timer function
definition 4-6
transactions
definition 4-3
ending 4-6
starting 4-3
translation C-2
two-session inquiry program
COBOL/400 source program example D-14
COBOL/400 target program example D-33
RPG/400 source program example D-39
RPG/400 target program example D-56
type of configuration description (CFGTYPE)
parameter 3-1
V
variable buffer management (VARBUFMGT) C-1
Vary Configuration (VRYCFG) command 3-1
vary off 3-1
vary on 3-1
VRYCFG command 3-1
VRYWAIT parameter 3-1
W
what you should know vii
who should use this book vii
write operation
asynchronous communications C-2
definition 4-4
finance communications C-3
retail communications C-4
sending data 4-4
writing application programs 4-1
Index
X-7
Reader Comments—We'd Like to Hear from You!
AS/400
Intrasystem Communications
Programming
Version 4
Publication No. SC41-5447-00
Overall, how would you rate this manual?
Very
Satisfied
Overall satisfaction
How satisfied are you that the information in this manual is:
Accurate
Complete
Easy to find
Easy to understand
Well organized
Applicable to your tasks
THANK
YOU!
Please tell us how we can improve this manual:
May we contact you to discuss your responses? __ Yes __ No
Phone: (____) ___________ Fax: (____) ___________ Internet: ___________
To return this form:
Ÿ Mail it
Ÿ Fax it
United States and Canada: 800+937-3430
Other countries: (+1)+507+253-5192
Ÿ Hand it to your IBM representative.
Note that IBM may use or distribute the responses to this form without obligation.
Name
Company or Organization
Phone No.
Address
Satisfied
Dissatisfied
Very
Dissatisfied
Reader Comments—We'd Like to Hear from You!
SC41-5447-00
Fold and Tape
IBM
Please do not staple
Cut or Fold
Along Line

Fold and Tape
NO POSTAGE
NECESSARY
IF MAILED IN THE
UNITED STATES
BUSINESS REPLY MAIL
FIRST-CLASS MAIL
PERMIT NO. 40
ARMONK, NEW YORK
POSTAGE WILL BE PAID BY ADDRESSEE
ATTN DEPT 542 IDCLERK
IBM CORPORATION
3605 HWY 52 N
ROCHESTER MN 55901-9986
Fold and Tape
SC41-5447-00
Please do not staple
Fold and Tape
Cut or Fold
Along Line
IBM

Printed in the United States of America
on recycled paper containing 10%
recovered post-consumer fiber.
SC41-5447-ðð
Spine information:
IBM
AS/400
Intrasystem Communications
Programming
Version 4
Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertisement