home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / g / getquo30.zip / MAKE_SCR.FOR < prev    next >
Text File  |  1993-01-09  |  8KB  |  254 lines

  1. OPTIONS X
  2. C  C:\AUTOSIG\MAKE_SCR.FOR
  3. C
  4. C  This UTAH FORTRAN program creates an .SCR file for AUTOSIG to
  5. C  access BASICQUOTES.  It assumes the default directory is C:\AUTOSIG
  6. C  and all files are located there unless a configuration control file
  7. C  exists.
  8. C
  9. C  Inputs:
  10. C     TICKER.LST   - List of stock symbols in Fortran A6 format.
  11. C     PROGRAM.CTL  - Configuration control file containing drives, paths,
  12. C                    and PROGRAM file name if not C:\AUTOSIG\AUTOSIG.EXE
  13. C
  14. C  Outputs:
  15. C     ATOSTART.BAT - Batch file for automatic operation.
  16. C     DYyymmdd.LOG - Session log of the quotes recieved.
  17. C     DYyymmdd.SCR - SCR file envoked by ATOSTART when AUTOSIG is started.
  18. C       where   yy - Year
  19. C               mm - Month
  20. C               dd - Day
  21. C
  22. C  Rev. 0    Clinton D. Huntemann    -   April 27, 1992
  23. C            (71247,2065)
  24. C            5 Longwood Avenue
  25. C            Londonderry, New Hampshire 03053
  26. C            phone (603) 432-7554
  27. C
  28. C  Rev. 1    Clinton D. Huntemann    -   May 6, 1992
  29. C            Added '/Z' to the script file to automatically logout
  30. C            from AUTOSIG (allows unattended operation).  Also, added 
  31. C            PROGRAM.CTL for variable configuration control.  STRIPPER
  32. C            was added to the processing stream in ATOSTART.BAT.
  33. C
  34. C  Rev. 1A   Clinton D. Huntemann    -   May 13, 1992
  35. C            Fixed embarassing errors.
  36. C
  37. C  Rev. 1B   Clinton D. Huntemann    -   May 23, 1992
  38. C            Adjusted script file to compensate for missing or not
  39. C            found symbols.  (Part of overall GETQUOTE fix.)
  40. C
  41. C  Rev. 2    Clinton D. Huntemann    -   Oct. 25, 1992
  42. C            Added code to skip weekends.
  43. C
  44. C  Rev. 2A   Clinton D. Huntemann    -   Nov. 27, 1992
  45. C            Incorporated weekend skip code into subroutine to search a
  46. C            file NODAYS.DAT for a list of holidays and other days the
  47. C            market may be closed.
  48. C
  49. C  Rev. 2B   Clinton D. Huntemann    -   Jan. 9, 1993
  50. C            Fixed some poor control commands in ATOSTART.BAT when run
  51. C            without a PROGRAM.CTL file.
  52. C
  53.       DIMENSION FNAME1(2),FNAME2(2),MPATH(10),PATH1(10),PATH2(10),
  54.      1PATH3(10),ATO(2),DRV(10)
  55.       REAL RYR,RMO,RDY
  56.       INTEGER MONTH,DAY,YEAR,WEEK,SKIP
  57. C
  58. C Update data file name based on system date
  59. C
  60.       CALL DATE(MONTH,DAY,YEAR,WEEK)
  61.       YEAR = YEAR-100*INT(YEAR/100)
  62.       ENCODE (RMO,2,4001) MONTH
  63.  4001 FORMAT (I2)
  64.       IF (MONTH .LT. 10) ENCODE (RMO,2,4002) MONTH
  65.  4002 FORMAT ('0',I1)
  66.       ENCODE (RDY,2,4001) DAY
  67.       IF (DAY .LT. 10) ENCODE (RDY,2,4002) DAY
  68.       ENCODE (RYR,2,4001) YEAR
  69.       IF (YEAR .LT. 10) ENCODE (RYR,2,4002) YEAR
  70.       ENCODE (FNAME1,14,4003) RYR,RMO,RDY
  71.  4003 FORMAT ('DY',3A2,'.LOG')
  72.       ENCODE (FNAME2,14,4004) RYR,RMO,RDY
  73.  4004 FORMAT ('DY',3A2,'.SCR')
  74. C
  75. C Retrieve the configuration file
  76. C
  77.       DO 51 I=1,10
  78.       DRV(I) = 'C:    '
  79.       MPATH(I)='      '
  80.       PATH1(I)='      '
  81.       PATH2(I)='      '
  82.    51 PATH3(I)='      '
  83.       ENCODE (MPATH,8,5003) '\5C\AUTOSIG'
  84.  5003 FORMAT (10A6)
  85.       ENCODE (PATH1,8,5003) '\5C\AUTOSIG'
  86.       ENCODE (PATH2,8,5003) '\5C\AUTOSIG'
  87.       ENCODE (PATH3,8,5003) '\5C\AUTOSIG'
  88.       ENCODE (ATO,8,5003) 'AUTOSIG '
  89.       IERR=0
  90.       CALL OPEN (4,'PROGRAM.CTL',IERR)
  91.       IF (IERR .NE. 0) GOTO 59
  92.       READ (4,5005) DRV
  93.  5005 FORMAT (12X,10(A2,1X))
  94.       READ (4,5004) ATO
  95.  5004 FORMAT (12X,A6,A2)
  96.       READ (4,5006) MPATH
  97.  5006 FORMAT (12X,10A6)
  98.       READ (4,5006) PATH1
  99.       READ (4,5006) PATH2
  100.       READ (4,5006) PATH3
  101.       CALL CLOSE (4)
  102. C
  103. C Update the AUTOSIG Batch File
  104. C
  105.    59 CALL OPEN (5,'ATOSTART.BAT')
  106.       WRITE (5,4999) FNAME2
  107.  4999 FORMAT ('echo Starting ATOSTART for ',2A6)
  108.       IF ((DRV(1).NE.'C:    ').AND.(DRV(1).NE.'      '))
  109.      1WRITE (5,5000) DRV(1),MPATH
  110.  5000 FORMAT ('SUBST ',A2,' ',10A6)
  111.       IF ((DRV(2).NE.'C:    ').AND.(DRV(2).NE.'      '))
  112.      1WRITE (5,5000) DRV(2),PATH1
  113.       IF ((DRV(3).NE.'C:    ').AND.(DRV(3).NE.'      '))
  114.      1WRITE (5,5000) DRV(3),PATH2
  115.       IF ((DRV(4).NE.'C:    ').AND.(DRV(4).NE.'      '))
  116.      1WRITE (5,5000) DRV(4),PATH3
  117.       CALL NODAY(SKIP)
  118.       IF (SKIP .NE. 0) GOTO 60
  119.       WRITE (5,5002) DRV(1),ATO,FNAME2
  120.  5002 FORMAT ('call ',A2,A6,A2,' /Z/X',2A6)
  121.       WRITE (5,5001)
  122.  5001 FORMAT ('call STRIPPER')
  123.    60 DO 61 M=1,10
  124.    61 IF ((DRV(M).NE.'C:    ').AND.(DRV(M).NE.'      '))
  125.      1WRITE (5,5007) DRV(M)
  126.  5007 FORMAT ('SUBST ',A2,' /d')
  127.       CALL CLOSE (5)
  128. C
  129. C Create the .SCR file
  130. C
  131.       CALL OPEN (5,FNAME2)
  132.       WRITE (5,6000)
  133.  6000 FORMAT (' sendline ATDT %HOSTPHONE'/' match CONNECT')
  134.       WRITE (5,6001)
  135.  6001 FORMAT (' pause 1'/' send ''^C'''/' match ''User ID:''')
  136.       WRITE (5,6002)
  137.  6002 FORMAT (' display ''{'' %COM ''}'''/' sendline %HOSTUSERID')
  138.       WRITE (5,6003)
  139.  6003 FORMAT (' if %hostuserid ''\5C\'' then goto have.pswd')
  140.       WRITE (5,6004)
  141.  6004 FORMAT ('  match ''Password:'''/' sendline %HOSTPASSWORD')
  142.       WRITE (5,6005)
  143.  6005 FORMAT ('label have.pswd'/' sendline SET BRIEF NO'
  144.      1/' match ''choice''')
  145.       WRITE (5,6006) DRV(2),FNAME1
  146.  6006 FORMAT (' capture ',A2,2A6)
  147. C
  148. C Open the Ticker List file
  149. C
  150.       CALL OPEN (4,'TICKER.LST')
  151.    99 WRITE (5,6007)
  152.  6007 FORMAT (' sendline ''GO BASICQUOTE''')
  153.       IF ((WEEK .EQ. 0).OR.(WEEK .EQ. 6)) GOTO 200
  154. C
  155. C Cycle through the ticker symbols on file (if not a weekend)
  156. C
  157.       DO 101 K=1,3
  158.       READ (4,6009,ERR=199,END=200) TICKER
  159.  6009 FORMAT (1A6)
  160.       WRITE (5,6008) TICKER
  161.  6008 FORMAT (' match ''Issue:'''/' sendline ''',A6,Z)
  162.       DO 100 I=2,6
  163.       READ (4,6009,ERR=199,END=101) TICKER
  164.   100 WRITE (5,6010) TICKER
  165.  6010 FORMAT (',',A6,Z)
  166.   101 WRITE (5,6011)
  167.  6011 FORMAT ('''')
  168.       WRITE (5,6012)
  169.  6012 FORMAT (' match ''Issue:'''/' send ''^M''')
  170.       GO TO 99
  171. C
  172. C Close the Script file
  173. C
  174.   200 CALL CLOSE (4)
  175.       WRITE (5,6013)
  176.  6013 FORMAT (' match ''Issue:'''/' capture OFF'/' send ''^M'''/
  177.      1' exit Z')
  178. C
  179. C Cleanup and exit
  180. C
  181.       CALL CLOSE (5)
  182.       WRITE (0,7000) FNAME2,FNAME1
  183.  7000 FORMAT (//'Files ATOSTART.BAT and ',2A6,' created.'/
  184.      1'To start, type ATOSTART'/
  185.      2'File ',2A6,' will be created when ATOSTART is run.'//)
  186.       STOP 'Normal stop'
  187. C
  188.   199 CALL CLOSE (4)
  189.       CALL CLOSE (5)
  190.       WRITE (0,7099) FNAME2,FNAME2
  191.  7099 FORMAT ('Error creating files ATOSTART.BAT or ',2A6,'.'/
  192.      1'DO NOT USE ',2A6,'.'//)
  193.       STOP 'Abnormal stop'
  194.       END
  195.       SUBROUTINE NODAY(SKIP)
  196. C
  197. C   This Subroutine looks up a list of dates to skip processing
  198. C   (i.e. days the market is closed).  It returns SKIP > 0 if current
  199. C   date is a weekend or matches a date in the list.
  200. C
  201. C
  202. C   Programm Originator:
  203. C        Clinton D. Huntemann  (71247,2065)
  204. C        5 Longwood Avenue
  205. C        Londonderry, New Hampshire 03053
  206. C        phone (603) 432-7554
  207. C
  208. C   Revision History:
  209. C        Rev. 0 - November 28, 1992       CDH
  210. C                 Original
  211. C
  212. C
  213.       DIMENSION LINE(7)
  214.       INTEGER MONTH,DAY,YEAR,WEEK,SKIP
  215. C
  216. C   Get current date
  217. C
  218.       CALL DATE(MONTH,DAY,YEAR,WEEK)
  219.       IF ((WEEK.EQ.0).OR.(WEEK.EQ.6)) THEN
  220.           SKIP = 6
  221.           TYPE 'Processing skipped for weekends'
  222.           RETURN
  223.           ENDIF
  224. C
  225. C   Open list of skipped days
  226. C
  227.       CALL OPEN (4,'NODAYS.DAT',SKIP)
  228.       IF (SKIP.NE.0) THEN
  229.           TYPE 'NODAYS.DAT file not found'
  230.           SKIP = 0
  231.           RETURN
  232.           ENDIF
  233.       READ (4,1000,END=199) LINE
  234.  1000 FORMAT (7A6)
  235.       READ (4,1000,END=199) LINE
  236. C
  237. C   Look for dates match
  238. C
  239.   100 READ (4,1000,END=199) LINE
  240.       DECODE (LINE,10,1001) IMO,IDY,IYR
  241.  1001 FORMAT (2(I2,1X),I4)
  242.       IF ((IMO.EQ.MONTH).AND.(IDY.EQ.DAY).AND.(IYR.EQ.YEAR)) THEN
  243.           SKIP = 1
  244.           CALL CLOSE (4)
  245.           TYPE 'Processing skipped via NODAYS.DAT entry'
  246.           WRITE (1,1000) LINE
  247.           RETURN
  248.           ENDIF
  249.       GOTO 100
  250.   199 SKIP = 0
  251.       CALL CLOSE (4)
  252.       RETURN
  253.       END
  254.