ibm-information-center/dist/eclipse/plugins/i5OS.ic.rbam6_5.4.0.1/srfil.htm

133 lines
8.2 KiB
HTML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-us" xml:lang="en-us">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="security" content="public" />
<meta name="Robots" content="index,follow" />
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
<meta name="DC.Type" content="task" />
<meta name="DC.Title" content="Send and receive data with a display file" />
<meta name="abstract" content="The only commands you can use with a display file to send or receive data in CL procedures and programs are the Send File (SNDF), Receive File (RCVF), and Send/Receive File (SNDRCVF) commands." />
<meta name="description" content="The only commands you can use with a display file to send or receive data in CL procedures and programs are the Send File (SNDF), Receive File (RCVF), and Send/Receive File (SNDRCVF) commands." />
<meta name="DC.subject" content="CL program, receiving data, control language (CL), program, sending data, control language (CL), display file, receiving, display file, sending, SNDRCVF (Send/Receive File) command, use, Send/Receive File (SNDRCVF) command, command, CL, SNDRCVF (Send/Receive File), Send/Receive File (SNDRCVF), file, subfile records, record, data, example" />
<meta name="keywords" content="CL program, receiving data, control language (CL), program, sending data, control language (CL), display file, receiving, display file, sending, SNDRCVF (Send/Receive File) command, use, Send/Receive File (SNDRCVF) command, command, CL, SNDRCVF (Send/Receive File), Send/Receive File (SNDRCVF), file, subfile records, record, data, example" />
<meta name="DC.Relation" scheme="URI" content="wfile.htm" />
<meta name="DC.Relation" scheme="URI" content="wmsgs.htm" />
<meta name="DC.Relation" scheme="URI" content="../cl/sndf.htm" />
<meta name="DC.Relation" scheme="URI" content="../cl/rcvf.htm" />
<meta name="DC.Relation" scheme="URI" content="../cl/sndrcvf.htm" />
<meta name="copyright" content="(C) Copyright IBM Corporation 1998, 2006" />
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 1998, 2006" />
<meta name="DC.Format" content="XHTML" />
<meta name="DC.Identifier" content="srfil" />
<meta name="DC.Language" content="en-us" />
<!-- All rights reserved. Licensed Materials Property of IBM -->
<!-- US Government Users Restricted Rights -->
<!-- Use, duplication or disclosure restricted by -->
<!-- GSA ADP Schedule Contract with IBM Corp. -->
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
<link rel="stylesheet" type="text/css" href="./ic.css" />
<title>Send and receive data with a display file</title>
</head>
<body id="srfil"><a name="srfil"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Send and receive data with a display file</h1>
<div><p>The only commands you can use with a display file to send or receive
data in CL procedures and programs are the <span class="cmdname">Send File (SNDF)</span>, <span class="cmdname">Receive
File (RCVF)</span>, and <span class="cmdname">Send/Receive File (SNDRCVF)</span> commands.</p>
<div class="section"> <p>The system formats the content of the variables associated with
the output or output/input fields in the record format when you run a <span class="cmdname">Send
File (SNDF)</span> command. Additionally the system sends it to the display
device. This is similar to when you run a <span class="cmdname">Receive File (RCVF)</span> command.
The values of the fields associated with input or output/input fields in the
record format on the display are placed in the corresponding CL variables.</p>
<p>The <span class="cmdname">Send/Receive
File (SNDRCVF)</span> command sends the contents of the CL variables to
the display. The command then performs the equivalent of a RCVF command to
obtain the updated fields from the display. Note that CL does not support
zoned decimal numbers. Consequently, fields in the display file that are defined
as zoned decimal, cause *DEC fields to be defined in the CL procedure or program.
*DEC fields are internally supported as packed decimal, and the CL commands
convert the packed and zoned data types as required. Fields that overlap
in the display file because of coincident display positions result in separately
defined CL variables that do not overlap. You cannot use record formats that
contain floating point data in a CL procedure or program. </p>
<div class="note"><span class="notetitle">Note:</span> If a <span class="cmdname">Send/Receive
File (SNDRCVF)</span> or <span class="cmdname">Receive File (RCVF)</span> command
for a workstation indicates WAIT(*NO), then the system uses the WAIT command
to receive data. The same is true if a <span class="cmdname">Send File (SNDF)</span> command
is issued using a record format containing the INVITE DDS keyword.</div>
<p>Except
for message subfiles, any attempt to send or receive subfile records causes
run-time errors. Most other functions specified for display files in DDS
are available; some functions (such as using variable starting line numbers)
are not. </p>
<p>The following example shows the steps required to create a
typical operator menu and to send and receive data using the <span class="cmdname">Send/Receive
File (SNDRCVF)</span> command. The menu looks like this: </p>
<pre class="screen"> Operator Menu
1. Accounts Payable
2. Accounts Receivable
90. Signoff
Option:
</pre>
<p>First, enter the following DDS source. The record format is MENU,
and OPTION is an input-capable field. The OPTION field uses DSPATR(MDT). This
causes the system to check this field for valid values even if the operator
does not enter anything.</p>
<div class="fignone"><pre>|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
A R MENU
A 1 2'Operator Menu'
A 3 4'1. Accounts Payable'
A 5 4'2. Accounts Receivable'
A 5 4'90. Signoff'
A 7 2'Option'
A OPTION 2Y 01 + 2VALUES(1 2 90) DSPATR(MDT)
A
A</pre>
</div>
<p>Enter the CRTDSPF command to create the display file. In CL programming,
the display file name (INTMENU) can be the same as the record format name
(MENU), though this is not true for some other languages, like RPG for i5/OS™.</p>
<p>The
display file could also be created using the Screen Design Aid (SDA) utility.</p>
<p>Next,
enter the CL source to run the menu.</p>
<p>The CL source for this menu is:
</p>
<pre> PGM /* OPERATOR MENU */
DCLF INTMENU
BEGIN: SNDRCVF RCDFMT(MENU)
IF COND(&amp;OPTION *EQ 1) THEN(CALL ACTSPAYMNU)
IF COND(&amp;OPTION *EQ 2) THEN(CALL ACTSRCVMNU)
IF COND(&amp;OPTION *EQ 90) THEN(SIGNOFF)
GOTO BEGIN
ENDPGM</pre>
<p>When this source is compiled, the DCLF command automatically
declares the input field OPTION in the procedure as a CL variable.</p>
<p>The <span class="cmdname">Send/Receive
File (SNDRCVF)</span> command defaults to WAIT(*YES); that is, the program
waits until input is received by the program.</p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="wfile.htm" title="Two types of files are supported in CL procedures and programs: display files and database files.">Work with files in CL procedures</a></div>
</div>
<div class="reltasks"><strong>Related tasks</strong><br />
<div><a href="wmsgs.htm" title="This discusses some of the ways that messages can be used to communicate between users and programs.">Messages</a></div>
</div>
<div class="relinfo"><strong>Related information</strong><br />
<div><a href="../cl/sndf.htm">Send File (SNDF) command</a></div>
<div><a href="../cl/rcvf.htm">Receive File (RCVF) command</a></div>
<div><a href="../cl/sndrcvf.htm">Send/Receive File (SNDRCVF) command</a></div>
</div>
</div>
</body>
</html>