<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://pickwiki.org/index.php?action=history&amp;feed=atom&amp;title=InputWait</id>
	<title>InputWait - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://pickwiki.org/index.php?action=history&amp;feed=atom&amp;title=InputWait"/>
	<link rel="alternate" type="text/html" href="https://pickwiki.org/index.php?title=InputWait&amp;action=history"/>
	<updated>2026-04-28T23:40:28Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.0</generator>
	<entry>
		<id>https://pickwiki.org/index.php?title=InputWait&amp;diff=1905&amp;oldid=prev</id>
		<title>Conversion script: link fix</title>
		<link rel="alternate" type="text/html" href="https://pickwiki.org/index.php?title=InputWait&amp;diff=1905&amp;oldid=prev"/>
		<updated>2015-02-26T23:48:55Z</updated>

		<summary type="html">&lt;p&gt;link fix&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Back to [[BasicSource]]&lt;br /&gt;
&lt;br /&gt;
Here&amp;#039;s a subroutine to mimic the INPUT WAITING capability that exists&lt;br /&gt;
in Unidata. It has all the functionality including duplicating the&lt;br /&gt;
behaviour of the underscore and colon when specifying the maximum string&lt;br /&gt;
length. For example, if you want to input three characters for variable&lt;br /&gt;
THIS, waiting for 10 seconds, requiring a carriage return to signify input&lt;br /&gt;
but without a line feed, and defaulting to the string &amp;quot;zip&amp;quot;; you would code:&lt;br /&gt;
&lt;br /&gt;
CALL INPUTWAIT(THIS, &amp;#039;3_:&amp;#039;, &amp;#039;10&amp;#039;, &amp;#039;zip&amp;#039; )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     SUBROUTINE INPUTWAIT(STR, MAX, TIM, DEF)&lt;br /&gt;
     * S[[/R]] - KRJ - Duplicates INPUT... WAITING mechanism on UNIDATA&lt;br /&gt;
     * which doesn&amp;#039;t exist in UNIVERSE&lt;br /&gt;
     *&lt;br /&gt;
     * STR is the string being input&lt;br /&gt;
     * MAX is the maximum string length (can have underline and colon)&lt;br /&gt;
     * TIM is the delay in seconds&lt;br /&gt;
     * DEF is the default if nothing is entered&lt;br /&gt;
     *&lt;br /&gt;
     * This matches up with the format&lt;br /&gt;
     * INPUT STR,MAX FOR TIM ELSE STR = DEF&lt;br /&gt;
     * PT standard setup&lt;br /&gt;
     $OPTIONS PICK.FORMAT CASE FORMAT.OCONV TIME.MILLISECOND PERF.EQ.EXEC&lt;br /&gt;
     $OPTIONS ONGO.RANGE -READ.RETAIN&lt;br /&gt;
     * See whether a colon or underline is in the string MAX&lt;br /&gt;
     * COL shows that the cursor is to be held on the line&lt;br /&gt;
     * UND shows that a carriage return is required input&lt;br /&gt;
     *&lt;br /&gt;
     IF INDEX(MAX, &amp;#039;:&amp;#039;, 1) THEN COL = @TRUE ELSE COL = @FALSE&lt;br /&gt;
     IF INDEX(MAX, &amp;#039;_&amp;#039;, 1) THEN UND = @TRUE ELSE UND = @FALSE&lt;br /&gt;
  *&lt;br /&gt;
     MAX = OCONV(MAX, &amp;#039;MCN&amp;#039;)&lt;br /&gt;
     STR = &amp;#039;&amp;#039;&lt;br /&gt;
     NUM = 0&lt;br /&gt;
     CHR = &amp;#039;&amp;#039;&lt;br /&gt;
     LOOP&lt;br /&gt;
        TAB = @FALSE&lt;br /&gt;
        BEG = SYSTEM(12)&lt;br /&gt;
        EOW = @FALSE&lt;br /&gt;
        LOOP&lt;br /&gt;
  * Check whether there is anything in the type-ahead buffer (TAB)&lt;br /&gt;
           INPUT TAB, -1&lt;br /&gt;
           NOW = SYSTEM(12)&lt;br /&gt;
  * Check how long we&amp;#039;ve been waiting for input&lt;br /&gt;
           IF NOW LT BEG THEN EOW = @TRUE&lt;br /&gt;
           IF ((NOW-BEG)/1000) GE TIM THEN EOW = @TRUE&lt;br /&gt;
        UNTIL TAB OR EOW DO NAP 100 REPEAT&lt;br /&gt;
  * We&amp;#039;ve either got something or we have waited too long. check TAB&lt;br /&gt;
        IF TAB THEN&lt;br /&gt;
           CHR = KEYIN()&lt;br /&gt;
  * A carriage return or linefeed is an &amp;lt;ENTER&amp;gt;&lt;br /&gt;
           IF CHR = CHAR(10) OR CHR = CHAR(13) THEN CHR = &amp;#039;&amp;#039;&lt;br /&gt;
           IF CHR NE &amp;#039;&amp;#039; THEN&lt;br /&gt;
  * Check for a backspace, but we must have something to backspace over!&lt;br /&gt;
              IF CHR = CHAR(8) THEN&lt;br /&gt;
                 IF NUM THEN&lt;br /&gt;
                    CRT @(-9):&amp;#039; &amp;#039;:@(-9):&lt;br /&gt;
                    STR = STR[1, LEN(STR)-1]&lt;br /&gt;
                    NUM -= 1&lt;br /&gt;
                 END&lt;br /&gt;
              END ELSE&lt;br /&gt;
  * Check for maximum length&lt;br /&gt;
                 IF NOT(MAX) OR NUM LT MAX THEN&lt;br /&gt;
  * We could parse out control chars here, but UNIDATA don&amp;#039;t&lt;br /&gt;
                    STR := CHR&lt;br /&gt;
                    NUM += 1&lt;br /&gt;
                    CRT CHR:&lt;br /&gt;
                 END&lt;br /&gt;
  * Check for any maximum length&lt;br /&gt;
                 IF NOT(UND) AND MAX AND NUM GE MAX THEN CHR = &amp;#039;&amp;#039;&lt;br /&gt;
              END&lt;br /&gt;
           END&lt;br /&gt;
        END ELSE CHR = &amp;#039;&amp;#039;&lt;br /&gt;
     UNTIL CHR = &amp;#039;&amp;#039; DO REPEAT&lt;br /&gt;
  * On the way out - see if we had to wait too long&lt;br /&gt;
     IF EOW THEN STR = DEF ELSE&lt;br /&gt;
  * If we didn&amp;#039;t we may have to do the carriage return / line feed&lt;br /&gt;
        IF COL ELSE CRT&lt;br /&gt;
     END&lt;br /&gt;
     RETURN&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Conversion script</name></author>
	</entry>
</feed>