| This is a .COM file that will prepare a full symbol for you...
$!
$! QUOTES.COM, Version 1.7
$!
$! Computes the TouchTone symbols for a Voice Quote StockList
$!
$! David McAdoo, Digital Equipment Corp, April 1987
$!
$! Revisions:
$! V1.0 JDM 04/03/87 Original release
$! V1.1 JDM 04/06/87 Prices incorrectly translated
$! V1.2 JDM 04/06/87 Param P5 enables debugging
$! V1.3 DJG 08/12/87 Change to Voice Quote format and
$! output symbol name
$! V1.4 MJN 04/08/92 Accept any length months
$! V1.5 PK 04/27/92 Clear CHAR1,CHAR2 if P2 empty
$! V1.6 PK 12/04/92 Type file data in line format
$! V1.7 PK 10/29/93 Write file data to QUOTES.SYM
$!
$! Wishlist:
$! Format output into columns
$!
$! Type @QUOTES ? for HELP
$!
$ MONTH_LIST = "JAN/FEB/MAR/APR/MAY/JUN/JUL/AUG/SEP/OCT/NOV/DEC"
$ PRICE_LIST = "05/10/15/20/25/30/35/40/45/50/55/60/65/70/75/80/85/90/95/00/01/02/03/04"
$ CALL_LIST = "ABCDEFGHIJKL"
$ PUT_LIST = "MNOPQRSTUVWX"
$ ALPHA_LIST = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
$ DIGIT_LIST = "2/22/222/3/33/333/4/44/444/5/55/555/6/66/666/7/11/77/777/8/88/888/9/99/999/111"
$ SINGLE_LIST = "2/2/2/3/3/3/4/4/4/5/5/5/6/6/6/7/1/7/7/8/8/8/9/9/9/1"
$!
$ DELIMITER = "/"
$
$ if P1 .eqs. "?" then goto HELP
$ if P1 .eqs. "" then QUERY = 1
$ if P1 .eqs. "" then BATCH = 0
$ if P1 .nes. "" then QUERY = 0
$ if P1 .nes. "" then BATCH = 1
$
$ lastStock = ""
$
$ if BATCH then goto TOP2
$
$ TOP:
$ write sys$output ""
$ inquire P1 "Stock"
$ if P1 .eqs. "" then goto DONE2
$ lastStock = P1
$ inquire P2 "Month"
$ inquire P3 "Price"
$ inquire P4 "P/C "
$
$ TOP2:
$! Check input parameters - only P1 is required
$! P2, P3, and P3 are optional, if specified, all must be present
$ if P1 .eqs. "" then inquire P1 "Stock"
$ if P2 .eqs. "" then goto OK
$
$ CHECK_P2:
$ if F$LENGTH(P2) .gt. 3 then P2 = f$extract(0,3,P2)
$ if F$LENGTH(P2) .eq. 3 then goto CHECK_P3
$ write sys$output "Error - P2 (the Month) must be at least 3 characters"
$ exit
$
$ CHECK_P3:
$ if P3 .nes. "" then goto CHECK_P3_2
$ write sys$output "Error - P3 is required"
$ exit
$
$ CHECK_P3_2:
$ if P3 .eqs. "72" then goto CHECK_P4 ! special case - 7 1/2
$ if P3 .eqs. "122" then goto CHECK_P4 ! special case - 12 1/2
$ if P3 .eqs. "172" then goto CHECK_P4 ! special case - 17 1/2
$ if P3 .eqs. "222" then goto CHECK_P4 ! special case - 22 1/2
$ if P3/5*5 .eqs. P3 then goto CHECK_P4 ! must be multiple of 5
$ write sys$output "Error - P3 is not an even multiple of 5"
$ exit
$
$ CHECK_P4:
$ if P4 .eqs. "C" then goto OK
$ if P4 .eqs. "P" then goto OK
$ write sys$output "Error - P4 must be exactly 1 character - C or P"
$ exit
$
$ OK:
$! Translate the "1/2" point intervals to unused PRICE_LIST codes
$ if P3 .eqs. "72" then P3 = "01" ! special case - 7 1/2
$ if P3 .eqs. "122" then P3 = "02" ! special case - 12 1/2
$ if P3 .eqs. "172" then P3 = "03" ! special case - 17 1/2
$ if P3 .eqs. "222" then P3 = "04" ! special case - 22 1/2
$
$ if QUERY then open/write data QUOTES.SYM
$ QUOTE = ""
$ LEN_ALPHA_LIST = F$LENGTH(ALPHA_LIST)
$
$! Translate Stock
$ I = 0
$ LEN = F$LENGTH(P1)
$ OLD = ""
$ LOOP1:
$ CHAR = F$EXTRACT(I,1,P1)
$ INDEX = F$LOCATE(CHAR,ALPHA_LIST)
$ if INDEX .eq. LEN_ALPHA_LIST then goto ERR_A
$ NEW = F$ELEMENT(INDEX,DELIMITER,SINGLE_LIST)
$ if NEW .eq. OLD then QUOTE = QUOTE + "#"
$ OLD = NEW
$ CODE = F$ELEMENT(INDEX,DELIMITER,DIGIT_LIST)
$ QUOTE = QUOTE + CODE
$ I = I + 1
$!$ if I .ne. LEN then QUOTE = QUOTE + "-"
$ if I .ne. LEN then goto LOOP1
$
$! Translate Month & Put/Call
$ if P2 .eqs. "" then CHAR1 = ""
$ if P2 .eqs. "" then CHAR2 = ""
$ if P2 .eqs. "" then goto DONE
$ I = 0
$ LOOP2:
$ M = F$ELEMENT(I,DELIMITER,MONTH_LIST)
$ if M .eqs. DELIMITER then goto ERR_M
$ I = I + 1
$ if M .nes. P2 then goto LOOP2
$
$ if P4 .eqs. "C" then CHAR1 = F$EXTRACT(I-1,1,CALL_LIST)
$ if P4 .eqs. "P" then CHAR1 = F$EXTRACT(I-1,1,PUT_LIST)
$ INDEX = F$LOCATE(CHAR1,ALPHA_LIST)
$ if INDEX .eq. LEN_ALPHA_LIST then goto ERR_A
$ NEW = F$ELEMENT(INDEX,DELIMITER,SINGLE_LIST)
$ if NEW .eq. OLD then QUOTE = QUOTE + "#"
$ OLD = NEW
$ CODE = F$ELEMENT(INDEX,DELIMITER,DIGIT_LIST)
$!$ QUOTE = QUOTE + "-" + CODE
$ QUOTE = QUOTE + CODE
$
$! Translate Price
$ PRICE = P3
$ if PRICE .eqs. "5" then PRICE = "05" ! special case
$ if PRICE .eqs. "72" then PRICE = "01" ! special case - 7 1/2
$ if PRICE .eqs. "122" then PRICE = "02" ! special case - 12 1/2
$ if PRICE .eqs. "172" then PRICE = "03" ! special case - 17 1/2
$ if PRICE .eqs. "222" then PRICE = "04" ! special case - 22 1/2
$ LEN = F$LENGTH(P3)
$ if PRICE .eqs. P3 then PRICE = F$EXTRACT(LEN-2,2,P3)
$
$ I = 0
$ LOOP3:
$ P = F$ELEMENT(I,DELIMITER,PRICE_LIST)
$ if P .eqs. DELIMITER then goto ERR_P
$ I = I + 1
$ if P .nes. PRICE then goto LOOP3
$
$ CHAR2 = F$EXTRACT(I-1,1,ALPHA_LIST)
$ INDEX = F$LOCATE(CHAR2,ALPHA_LIST)
$ if INDEX .eq. LEN_ALPHA_LIST then goto ERR_A
$ NEW = F$ELEMENT(INDEX,DELIMITER,SINGLE_LIST)
$ if NEW .eq. OLD then QUOTE = QUOTE + "#"
$ OLD = NEW
$ CODE = F$ELEMENT(INDEX,DELIMITER,DIGIT_LIST)
$!$ QUOTE = QUOTE + "-" + CODE + "-1"
$ QUOTE = QUOTE + CODE + "1"
$
$ DONE:
$!$ QUOTE = QUOTE + "-##"
$ QUOTE = QUOTE + "##"
$ if P5 .nes. "" then write sys$output "Char1 = ''char1', char2 = ''char2'"
$ if QUERY then write sys$output "''p1' ''p2' ''p3' ''p4' = ''p1'''char1'''char2' = ''quote'"
$!$ if QUERY then write data "''p1' ''p2' ''p3' ''p4' = ''p1'''char1'''char2' = ''quote'"
$ if QUERY then if P2 .nes. "" then write data "''p1' ''p2' ''p3' ''p4'"
$ if QUERY then if P2 .eqs. "" then write data "''p1'"
$ if QUERY then write data "''p1'''char1'''char2'"
$ if QUERY then write data "''quote'"
$ if QUERY then write data ""
$ if QUERY then goto TOP
$ if BATCH then write sys$output "''p1' ''p2' ''p3' ''p4' = ''p1'''char1'''char2' = ''quote'"
$ goto DONE2
$
$ ERR_A:
$ write sys$output "Error - exceeded range of ALPHA_LIST"
$ goto DONE2
$
$ ERR_M:
$ write sys$output "Error - Month not found, exceeded range of MONTH_LIST"
$ goto DONE2
$
$ ERR_P:
$ write sys$output "Error - Price not found, exceeded range of PRICE_LIST"
$ goto DONE2
$
$ DONE2:
$ if QUERY then close data
$ if QUERY then write sys$output "Symbols are in QUOTES.SYM"
$!$ if QUERY then type QUOTES.SYM
$!$ if QUERY then write sys$output "''lastStock' ''p2' ''p3' ''p4' = ''lastStock'''char1'''char2' = ''quote'"
$ exit
$
$ HELP:
$ type sys$input
QUOTES is a command file that generates the TouchTone symbols
used by the SchwabQuotes service. SchwabQuotes is a service
offered by Charles Schwab Co to account members that provides
real-time stock and option quotations over the telephone.
SchwabQuotes requires that the stock and option symbols be
translated into a series of numbers that can be entered via
a TouchTone keypad.
QUOTES may be invoked with the following parameters:
@QUOTES <symbol> <month> <price> <mode>
where
<symbol> is the symbol of the stock or option desired.
Symbol may be any length, but must be alphabetic.
Symbol is used for both stock and options.
<month> is the option expiration month, expressed as a
three-character abbreviation of the months JAN-DEC.
<price> is the option excercise price. It may range from
$5 to $300 in 5-point increments. There are 4 special
$5 to $300 in 5-point increments. In addition, there
are four special codes that are used to indicate the
1/2 point increments under $25. Thus the following
codes and prices correspond:
72 = $ 7 1/2
122 = $12 1/2
172 = $17 1/2
222 = $22 1/2
<type> is the option type, i.e., Put or Call. It must be
a one-character value, either P or C.
Parameter P1 may be used alone for specifying either stocks or options.
Parameters P2 - P4 are used for specifying options.
QUOTES may be run in one of two mode, either QUERY or BATCH.
BATCH mode is selected when QUOTES is invoked with all parameters
specified on the command line, i.e.,
@QUOTES DEC JUL 170 C
The command file executes once, displays the TouchTone key sequence
on the screen, and then exits.
QUERY mode is selected by invoking QUOTES and letting it
prompt for all parameters, i.e.,
@QUOTES
QUERY mode is intended for use when a number of stocks or options
are to be translated. QUERY mode enters a loop which prompts for
input. Each symbol is translated and written to a file. The loop is
terminated by entering a <CR> at the Stock prompt. At that time QUOTES
types to the screen the contents of the file it created, and then exits.
Examples:
P1 P2 P3 P4
Stock Month Price P/C
-----------------------------
@QUOTES DEC => 3-#33-222-##
@QUOTES DEC JUL 170 C => 3-#33-222-4-66-1-##
|