home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / rxhll.zip / IBMLINK.REX < prev    next >
OS/2 REXX Batch file  |  1993-10-25  |  4KB  |  148 lines

  1.  
  2. /* #include <ibmlink.rex> */
  3.  
  4. HostEnterIBMLinkInfo: procedure expose Host.
  5.    /**
  6.    ***   This will enter the account, userid, password and service (IBMLINK)
  7.    ***   to connect to the IBMLink main menu
  8.    ***
  9.    ***   On Entry:  CL/Menu
  10.    ***   On Exit:   IBMLink Main Menu
  11.    **/
  12.  
  13.    code = HostWaitFor(60, 'SVM0201P')
  14.    if code = -1 then
  15.       call HostError
  16.  
  17.    code = hllapi('Sendkey', '@0'Host.Account'@T'Host.Userid)
  18.    if (length(Host.Userid) < 7) then
  19.       code = hllapi('Sendkey', '@T')
  20.  
  21.    code = hllapi('Sendkey', Host.Password)
  22.    if (length(Host.Password) < 8) then
  23.       code = hllapi('Sendkey', '@T')
  24.  
  25.    code = hllapi('Sendkey', 'IBMLink@E')
  26.  
  27.    code = HostWaitFor(180, 'MAINMENU')
  28.    if code = -1 then
  29.       call HostError
  30.    call HostIBMLinkNotify
  31.    return
  32.  
  33.  
  34. HostIBMLinkNotify: procedure expose Host.
  35.    /**
  36.    ***  This will display the notification messages at the bottom right
  37.    ***  of the IBMLink main menu.
  38.    **/
  39.  
  40.    call HostScreenToStem
  41.  
  42.    FoundRow = 0
  43.    do i = 1 to (Screen.Rows - 2) while FoundRow = 0
  44.       if pos("___________________", Screen.i) > 0 then
  45.          FoundRow = i
  46.    end /* row loop */
  47.  
  48.    if FoundRow > 0 then
  49.       do
  50.       code = Open(Host.News, 'Append')
  51.       call lineout Host.News, copies('═', 79)
  52.       call lineout Host.News, date()'...'
  53.       do i = (FoundRow + 1) to (Screen.Rows - 2)
  54.          parse var Screen.i . '|' NewsItem
  55.          call lineout Host.News, NewsItem
  56.       end /* do */
  57.       call lineout Host.News, copies('═', 79)
  58.       code = Close(Host.News)
  59.       end /* if */
  60.    return
  61.  
  62.  
  63. HostIBMLinkLogon: procedure expose Host.
  64.    /**
  65.    ***  This will log the use on to the host.
  66.    **/
  67.  
  68.  
  69.    call HostLogonClMenu
  70.  
  71.    if Host.Logmode = '' then
  72.       Logmode = ''
  73.    else
  74.       Logmode = 'M('Host.Logmode')'
  75.  
  76.    rc = hllapi('Sendkey', '/L' Host.Applid Host.Userid Logmode'@E')
  77.    rc = hllapi('Wait')
  78.  
  79.    do while Host.Password = ''
  80.       say 'Enter the password for' Host.Applid '['Host.Application']'
  81.       Host.Password = GetNoEcho()
  82.    end
  83.  
  84.    say "Logging on."
  85.  
  86.    call HostEnterIBMLinkInfo
  87.    return
  88.  
  89.  
  90. HostIBMLinkLogoff: procedure expose Host.
  91.    /**
  92.    ***  This will log off from the host assuming that the first valid
  93.    ***  entry field will support a logoff command.  This does no error
  94.    ***  checking or screen validation.
  95.    **/
  96.  
  97.    say "Logging off."
  98.  
  99.    rc = hllapi('Sendkey', 'LOGOFF@E')
  100.    rc = hllapi('Wait')
  101.  
  102.    /* See if we have to 'release' the application */
  103.  
  104.    code = HostWaitFor(30, 'SVM0201P')
  105.    if code = 0 then
  106.       rc = hllapi('Sendkey', '@T@T@TRELEASE@E')
  107.    return
  108.  
  109.  
  110. HostIBMLinkETRDownload: procedure expose Host. Entry.
  111.    /**
  112.    ***  This will download an IBMLink ETR entry into an internal
  113.    ***  buffer and pass it to the caller
  114.    **/
  115.  
  116.    call HostScreenToStem
  117.    parse var Screen.2 'Page' PanelCurrent 'of' PanelMax
  118.  
  119.    /* Make sure we have valid numbers in the panel count */
  120.  
  121.    if datatype(PanelCurrent, 'N') <> 1 then
  122.       do
  123.       call HapiError
  124.       return
  125.       end
  126.  
  127.    if datatype(PanelMax, 'N') <> 1 then
  128.       do
  129.       call HapiError
  130.       return
  131.       end
  132.  
  133.    Entry. = ''
  134.    j = 1
  135.    do Panels = PanelCurrent to PanelMax
  136.       FirstRow = 6
  137.       do Row = FirstRow to (Screen.Rows - 4)
  138.          Entry.j = strip(Screen.Row, 'Trailing')
  139.          j = j + 1
  140.       end
  141.       if Panels <> PanelMax then
  142.          do
  143.          call HostPageDown
  144.          end
  145.    end /* Panels */
  146.    Entry.0 = j
  147.    return
  148.