109 lines
6.0 KiB
HTML
109 lines
6.0 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="reference" />
|
||
|
<meta name="DC.Title" content="Example: Time out while waiting for input from a device display" />
|
||
|
<meta name="abstract" content="This program illustrates how to write a CL program using a display file that will wait for a specified amount of time for the user to enter an option. If he does not, the user is signed off." />
|
||
|
<meta name="description" content="This program illustrates how to write a CL program using a display file that will wait for a specified amount of time for the user to enter an option. If he does not, the user is signed off." />
|
||
|
<meta name="DC.subject" content="timing out" />
|
||
|
<meta name="keywords" content="timing out" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="sampl.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="timeo" />
|
||
|
<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>Example: Time out while waiting for input from a device display</title>
|
||
|
</head>
|
||
|
<body id="timeo"><a name="timeo"><!-- --></a>
|
||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
||
|
<h1 class="topictitle1">Example: Time out while waiting for input from a device display</h1>
|
||
|
<div><p>This program illustrates how to write a CL program using a display
|
||
|
file that will wait for a specified amount of time for the user to enter an
|
||
|
option. If he does not, the user is signed off.</p>
|
||
|
<div class="example"> <pre>DCLF FILE(QGPL/MENU)
|
||
|
DOWHILE '1' /* DO FOREVER */
|
||
|
SNDRCVF DEV(*FILE) RCDFMT(MENUFMT) WAIT(*NO)
|
||
|
WAIT MONMSG MSGID(CPF0889) EXEC(SIGNOFF)
|
||
|
CHGVAR VAR(&IN99) VALUE('0')
|
||
|
IF COND(&IN01) THEN(ITERATE)
|
||
|
SELECT
|
||
|
WHEN (&OPTION *EQ '1') (CALL ORDENT) /* OPTION 1-ORDER ENTRY */
|
||
|
WHEN (&OPTION *EQ '2') (CALL ORDDSP) /* OPTION 2-ORDER DISPLAY */
|
||
|
WHEN (&OPTION *EQ '3') (CALL ORDCHG) /* OPTION 3-ORDER CHANGE */
|
||
|
WHEN (&OPTION *EQ '4') (CALL ORDPRT) /* OPTION 4-ORDER PRINT */
|
||
|
WHEN (&OPTION *EQ '9') (SIGNOFF) /* OPTION 9-SIGNOFF */
|
||
|
OTHERWISE DO /* OPTION SELECTED NOT VALID */
|
||
|
CHGVAR VAR(&IN99) VALUE('1')
|
||
|
ENDDO
|
||
|
ENDSELECT
|
||
|
ENDDO
|
||
|
ENDPGM
|
||
|
|
||
|
</pre>
|
||
|
</div>
|
||
|
<div class="section"><p>The display file was created with the following command: </p>
|
||
|
<pre>CRTDSPF FILE(MENU) SRCFILE(QGPL/QDDSSRC) SRCMBR(MENU) +
|
||
|
DEV(*REQUESTER) WAITRCD(60)</pre>
|
||
|
</div>
|
||
|
<div class="section"><p>The display file will use the *REQUESTER device. When a <span class="cmdname">Wait
|
||
|
(WAIT)</span> command is issued, it waits for the number of seconds (60)
|
||
|
specified on the WAITRCD keyword. The following is the DDS for the display
|
||
|
file: </p>
|
||
|
<pre>SEQNBR *... ... 1 ... ... 2 ... ... 3 ... ... 4 ... ... 5 ... ...
|
||
|
6 ... ... 7 ... ... 8
|
||
|
|
||
|
0100 A PRINT CA01(01)
|
||
|
0200 A R MENUFMT BLINK
|
||
|
0300 A TEXT('Order
|
||
|
Entry Menu')
|
||
|
0400 A 1 31'Order Entry Menu'
|
||
|
0500 A 2 2'Select one
|
||
|
of the following: '
|
||
|
0600 A 3 4'1. Enter Order'
|
||
|
0700 A 4 4'2. Display Order'
|
||
|
0800 A 5 4'3. Change Order'
|
||
|
0900 A 6 4'4. Print Order'
|
||
|
1000 A 7 4'9. Sign Off'
|
||
|
1100 A 23 2'Option:'
|
||
|
1200 A OPTION 1 I 23 10
|
||
|
1300 A 99 ERRMSG('Invalid
|
||
|
option selected.')
|
||
|
|
||
|
* * * * * * E N D O F S O U R C E
|
||
|
* * * * *</pre>
|
||
|
</div>
|
||
|
<div class="section"><p>The program performs a SNDRCVF WAIT(*NO) to display the menu and
|
||
|
request an option from the user. Then it issues a WAIT command to accept
|
||
|
an option from the user. If the user enters a 1 through 4, the appropriate
|
||
|
program is called. If the user enters a 9, the SIGNOFF command is issued.
|
||
|
If the user enters an option that is not valid, the menu is displayed with
|
||
|
an 'OPTION SELECTED NOT VALID' message. The user can then enter another valid
|
||
|
option. If the user does not respond within 60 seconds, the CPF0889 message
|
||
|
is issued to the program and the <span class="cmdname">Monitor Message (MONMSG)</span> command
|
||
|
issues the SIGNOFF command.</p>
|
||
|
</div>
|
||
|
<div class="section"><p>A <span class="cmdname">Send File (SNDF)</span> command using a record format
|
||
|
containing the INVITE DDS keyword could be used instead of the SNDRCVF WAIT(*NO).
|
||
|
The function would be the same.</p>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div>
|
||
|
<div class="familylinks">
|
||
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="sampl.htm" title="These sample programs demonstrate the flexibility, simplicity, and versatility of CL programs.">Examples: CL programs and procedures</a></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|