home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / o / os2dsk03.zip / DISK3.DSK / RPLSETD.CMD < prev    next >
OS/2 REXX Batch file  |  1992-12-09  |  31KB  |  910 lines

  1. /* RPLSETD.CMD - REXX program to convert an existing OS/2 Remote IPL client  */
  2. /*               to use the 32-bit VGA and XGA device drivers or the 16-bit  */
  3. /*               8514 device driver.                                         */
  4. /*                                                                           */
  5. /*    Copyright: (C) Copyright IBM Corp. 1992                                */
  6. /*                                                                           */
  7. /*               Note 1: All the variables are global to all subroutines.    */
  8. driver = ''
  9. client = ''
  10. logfile = ''
  11. Rspfile = ''
  12. currentOS2 = 'OS2.20'
  13. newOS2 = 'OS2.20a'
  14. changeOS2 = 0
  15. msg.0 = 0
  16. msg.1 = ''
  17. msg.2 = ''
  18.  
  19. Parse Arg  p1 p2 p3 p4 p5 p6 .
  20. /* Check for help request (p1 = ? or '') */
  21. If p1 = '?' | p1 = '' Then Call Syntax_Help
  22.  
  23. Call Process_Input_Parameters
  24. If result <> 0 Then Call Error_Exit
  25.  
  26. If Rspfile <> '' Then Do
  27.    Call Read_Rspfile
  28.    If result <> 0 Then Call Error_Exit
  29. end
  30. else Do
  31.    /* if logfile specified, delete old log file (if it exists) */
  32.    If Logfile <> '' Then Call Delete_File Logfile
  33. end
  34.  
  35. /* were required parameters  entered ?*/
  36. If driver = '' | client = '' Then Call Syntax_Help
  37.  
  38. Call Validate_Display_DriverID
  39. If result <> 0 Then Call Error_Exit
  40.  
  41. ddbootdrv = ''
  42. dd_data.0 = 0
  43.  
  44. /* build list of directories in RPL\IBMCOM to process */
  45. lanlist.0 = 6
  46. lanlist.1 = 'TOKENRNG'
  47. lanlist.2 = 'ETHERNET'
  48. lanlist.3 = 'PCNETA'
  49. lanlist.4 = 'PCNET'
  50. lanlist.5 = 'ELNKII'
  51. lanlist.6 = 'ELNKMC'
  52.  
  53. Call Determine_RIPL_Directory
  54. If result <> 0 Then Call Error_Exit
  55.  
  56. /* determine if desired device driver is installed */
  57. If changeOS2 = 1 Then ddpath = rpldir'\'newOS2'\OS2\DLL\'
  58. else  ddpath = rpldir'\'currentOS2'\OS2\DLL\'
  59. filename = ddpath||driver||'.DLL'
  60. if File_Exist(filename) = 0 Then Do
  61.    ddpath = substr(ddpath, 1, length(ddpath) - 1)
  62.    msg.0 = 2
  63.    msg.1 = 'The display driver 'driver'.DLL is not installed in the Remote IPL'
  64.    msg.2 = 'directory 'ddpath'.'
  65.    Call Display_Log_Msg
  66.    Call Error_Exit
  67. end
  68.  
  69.  
  70. /* get LAN Server version */
  71. Call Get_LAN_Server_Version
  72. if result <> 0 Then Exit
  73.  
  74. /* determine if client is a single name or list of names */
  75. /* assume it is a client name to start with */
  76. cltlst.0 = 0
  77. filename = rpldir'\FITS\'client'.FIT'
  78. if File_Exist(filename) = 0 Then cltlst.0=1
  79.  
  80. if cltlst.0 = 0 Then Do
  81.    /* single client specified */
  82.    Call Update_Client_Files
  83. end
  84. else Do
  85.    /* a list of client names was provided in a list file */
  86.    clientlist = client
  87.    do until lines(clientlist) = 0
  88.       client = translate(linein(clientlist))
  89.       Call Update_Client_Files
  90.    end
  91.    Call Lineout clientlist
  92. end
  93. If Logfile <> '' Then Call Lineout Logfile
  94. exit
  95. /* end of main routine */
  96.  
  97.  
  98. /*************** Start of subroutines ***************************/
  99. /* Subroutine Syntax_Help */
  100. /* This subroutine displays the syntax help panel. */
  101. Syntax_Help:
  102.   If Logfile = '' Then Do
  103.      Say 'RPLSETD  [/H]  /D:driver  /C:client  [/O:current_OS2]  [/N:new_OS2]'
  104.      Say '         [/L:Logfile]'
  105.      Say '    where /H is a request for this help panel.  If specified, it must'
  106.      Say '             be first parameter.'
  107.      Say '          driver is the new display type for the client definition.'
  108.      Say '                 The following display types are valid:'
  109.      Say '                   IBMVGA32  - 32 bit VGA display driver'
  110.      Say '                   IBMXGA32  - 32 bit XGA display driver'
  111.      Say '                   IBM8514   - 16 bit 8514 display driver'
  112.      Say '          client is the name of the OS/2 Remote IPL client workstation'
  113.      Say '                 or it is the fully qualified name of a file containing'
  114.      Say '                 a list of client workstations.'
  115.      Say '          current_OS2 (optional) is the root directory for the current OS/2 2.0'
  116.      Say '                      operating system the client is booting.  This parameter'
  117.      Say '                      is case sensitive.  The default is OS2.20'.
  118.      Say '          new_OS2 (optional) is the root directory for the OS/2 2.0 operating'
  119.      Say '                  system that the client is to be switched to.  This parameter'
  120.      Say '                  is case sensitive.  The default is OS2.20a.'
  121.      Say ' '
  122.      Say 'Press any key for next screen.'
  123.      Pull dummy
  124.      Say ' '
  125.      Say '          Logfile (optional) is the name of a file to which all messages and'
  126.      Say '                  errors are to be logged.  If logfile is specified, no'
  127.      Say '                  messages or errors will be displayed on the screen.'
  128.      exit
  129.   end
  130.   else Do
  131.      msg.0 = 2
  132.      msg.1 = 'An error was detect in the following RPLSETD command syntax:'
  133.      msg.2 = '  RPLSETD' p1  p2  p3  p4  p5 p6
  134.      Call Display_Log_Msg
  135.      Call Error_Exit
  136.   end
  137.  
  138.  
  139.  
  140. /* Subroutine Error_Exit */
  141. /* This subroutine cleans up on an error exit. */
  142. Error_Exit:
  143.    If Logfile <> '' Then Do
  144.       Call Lineout Logfile
  145.       Say 'Error detected.  Check log file: 'Logfile
  146.    end
  147.    exit 4
  148.  
  149.  
  150. /* Subroutine Get_LAN_Server_Version */
  151. /* This subroutine determines the version of LAN Server installed on  */
  152. /* the Remote IPL server. */
  153. Get_LAN_Server_Version:
  154.    /* Read the first 60 bytes of SYSLEVEL.SRV and check the current server level*/
  155.    filename = lanpath'\SYSLEVEL.SRV'
  156.    syslevel = ''
  157.    Do i = 1 to 60
  158.       syslevel = syslevel || charin(filename)
  159.    end
  160.    Call Charout filename
  161.    verp = pos('IP', syslevel)
  162.    If verp <> 0 Then LS_version = substr(syslevel, verp+3, 4)
  163.    If LS_version = '' Then Do
  164.       msg.0 = 1
  165.       msg.1 = 'The version of LAN Server is prior to Version 2.0. '
  166.       Call Display_Log_Msg
  167.       return 4
  168.    end
  169.    return 0
  170.  
  171.  
  172.  
  173. /* Subroutine Update_Client_Files */
  174. /* This subroutine calls the subroutines to update each client file. */
  175. Update_Client_Files:
  176.    /* update the client copy of OS2INI.20 */
  177.    Call Update_Client_Ini
  178.    If result = 0 Then Do
  179.       msg.0 = 1
  180.       msg.1 = client' copy of OS2INI.20 was updated.'
  181.       Call Display_Log_Msg
  182.    end
  183.    else Do
  184.       msg.0 = 1
  185.       msg.1 = client' copy of OS2INI.20 was not updated.'
  186.       Call Display_Log_Msg
  187.    end
  188.  
  189.    /* update the client CONFIG.20 file.  If the client is DEFALT20, then */
  190.    /* there is special processing to update each of the master CONFIG.20 */
  191.    /* files in the RPL\IBMCOM tree. */
  192.    if client = 'DEFALT20' Then Do
  193.       /* for DEFALT20 update each of the lantype CONFIG.20 files */
  194.       Do lli = 1 to lanlist.0
  195.          lantype = lanlist.lli
  196.          configfilename = rpldir'\IBMCOM\'lantype'\CONFIG.20'
  197.          If File_Exist(configfilename) <> 0 Then Do
  198.             /* a CONFIG.20 file is present, update it */
  199.             Call Update_Client_Config_20
  200.             If result = 0 Then Do
  201.                msg.0 = 1
  202.                msg.1 = client lantype 'copy of CONFIG.20 was updated.'
  203.                Call Display_Log_Msg
  204.             end
  205.             else Do
  206.                msg.0 = 1
  207.                msg.1 = client lantype 'copy of CONFIG.20 was not updated.'
  208.                Call Display_Log_Msg
  209.             end
  210.          end
  211.       end
  212.    end
  213.    else Do
  214.       /* not the DEFALT20 client */
  215.       Call Update_Client_Config_20
  216.       If result = 0 Then Do
  217.          msg.0 = 1
  218.          msg.1 = client' copy of CONFIG.20 was updated.'
  219.          Call Display_Log_Msg
  220.       end
  221.       else Do
  222.          msg.0 = 1
  223.          msg.1 = client' copy of CONFIG.20 was not updated.'
  224.          Call Display_Log_Msg
  225.       end
  226.    end
  227.  
  228.    /* Update the client.FIT file */
  229.    Call Update_Client_Fit
  230.    If result = 0 Then Do
  231.       msg.0 = 1
  232.       msg.1 = client'.FIT was updated.'
  233.       Call Display_Log_Msg
  234.    end
  235.    else Do
  236.       msg.0 = 1
  237.       msg.1 = client'.FIT was not updated.'
  238.       Call Display_Log_Msg
  239.    end
  240.    msg.0 = 1
  241.    msg.1 = '  '
  242.    Call Display_Log_Msg
  243.    return 0
  244.  
  245.  
  246.  
  247. /* Subroutine Update_Client_Ini */
  248. /* This subroutine updates the OS2INI.20 file for a client workstation */
  249. /* to add the required profile data to support the specified device driver. */
  250. Update_Client_Ini:
  251.  
  252.    /* build fully qualified path name for OS2INI.20 */
  253.    ininame = rpldir'USER\'client'\OS2\OS2INI.20'
  254.  
  255.    /* Execute RPLRXUTL to update client copy of OS2.INI (OS2INI.20) */
  256.    rc=0
  257.    cmdline = 'RPLRXUTL.EXE /D:'driver ' /C:'ininame '1>nul'
  258.    address CMD cmdline
  259.    return rc
  260.  
  261.  
  262.  
  263.  
  264. /* Subroutine Update_Client_Fit */
  265. /* This subroutine creates a new client.FIT by making the following */
  266. /* changes to the original FIT: */
  267. /*   - Comment out the DISPLAY.DLL entries. */
  268. /*   - Enables the correct .FON entries for the specified display driver. */
  269. /*   - If requested, changes the target OS2 root directory. */
  270. Update_Client_Fit:
  271.  
  272.    /* build fully qualified path names for client.??? */
  273.    fitname = rpldir'\FITS\'client'.FIT'
  274.    tmpfitname = rpldir'\FITS\'client'.TMP'
  275.    bakfitname = rpldir'\FITS\'client'.BAK'
  276.    /* Call SysFileDelete tmpfitname */
  277.    Call Delete_File tmpfitname
  278.    Call Delete_File bakfitname
  279.  
  280.    If File_Exist(fitname) Then Do
  281.       /* client.FIT does exists, build a new FIT */
  282.       do until lines(fitname) = 0
  283.          data = linein(fitname)
  284.          If data <> '' & substr(data, 1, 2) <> '\\' Then Do
  285.             /* not a null line or a UNC line, check line */
  286.             datap = pos(':\OS2\DLL\DISPLAY.DLL', data)
  287.             if datap <> 0 Then Do
  288.                if substr(data,1,1) <> ';' Then Do
  289.                   /* comment out DISPLAY.DLL entry */
  290.                   newdata = ';'data
  291.                   data = newdata
  292.                end
  293.             end
  294.             else Do
  295.                /* check for .FON entry and enable/disable the entry */
  296.                /* depending on the driver type */
  297.                helvp = 0
  298.                courp = 0
  299.                timesp = 0
  300.                helvp = pos(':\OS2\DLL\HELV.FON', data)
  301.                If helvp = 0 Then Do
  302.                   courp = pos(':\OS2\DLL\COURIER.FON',data)
  303.                   If courp = 0 Then Do
  304.                      timesp = pos(':\OS2\DLL\TIMES.FON',data)
  305.                   end
  306.                end
  307.                If helvp <> 0 | courp <> 0 | timesp <> 0 Then Do
  308.                  datal = length(data)
  309.                  If driver = 'IBMVGA32' | DRIVER = 'IBMVGA' Then Do
  310.                     If substr(data, datal-2, 3) <> 'VGA' Then Do
  311.                        If substr(data, 1,1) <> ';' Then Do
  312.                           /* disable non-VGA .FON entry */
  313.                           newdata = ';'data
  314.                           data = newdata
  315.                        end
  316.                     end
  317.                     else If substr(data, 1, 1) = ';' Then Do
  318.                        /* enable VGA .FON entry */
  319.                        data = substr(data, 2)
  320.                     end
  321.                  end
  322.                  else If driver = 'IBMXGA32' | driver = 'IBM8514' Then Do
  323.                     If substr(data, datal-2, 3) <> 'BGA' Then Do
  324.                        If substr(data, 1, 1) <> ';' Then Do
  325.                           /* disable non-XGA/8514 .FON entry */
  326.                           newdata = ';'data
  327.                           data = newdata
  328.                        end
  329.                     end
  330.                     else If substr(data, 1, 1) = ';' Then Do
  331.                        /* enable XGA/8514 .FON entry */
  332.                        data = substr(data, 2)
  333.                     end
  334.                  end
  335.                end
  336.             end
  337.             /* check for possible operating system change */
  338.             if changeOS2 = 1 Then Do
  339.                If substr(data, 1, 2) = '; ' Then srvfname = word(data, 3)
  340.                else srvfname = word(data, 2)
  341.                os2p = pos(currentOS2'\', srvfname)
  342.                if os2p <> 0 Then Do
  343.                   /* old OS2 entry found, update it */
  344.                   os2p = pos(currentOS2, data, length(word(data,1))+1)
  345.                   newdata = substr(data, 1, os2p-1)
  346.                   newdata = newdata || newOS2
  347.                   newdata = newdata || substr(data, os2p+length(currentOS2))
  348.                   data = newdata
  349.                end
  350.             end
  351.          end
  352.          /* write data record to new FIT */
  353.          Call Lineout tmpfitname, data
  354.       end
  355.       Call Lineout tmpfitname   /* close file */
  356.       Call Lineout fitname      /* close file */
  357.  
  358.       /* rename original client.FIT */
  359.       cmdstr = '@rename 'fitname' 'client'.BAK'
  360.       address CMD cmdstr
  361.       if rc = 0 Then Do
  362.          /* rename client.TMP to be client.FIT */
  363.          cmdstr = '@rename 'tmpfitname' 'client'.FIT'
  364.          address CMD cmdstr
  365.          if rc = 0 Then Do
  366.             /* delete orginal client.FIT */
  367.             /* Call SysFileDelete bakfitname */
  368.             cmdstr = '@DEL 'bakfitname
  369.             address CMD cmdstr
  370.          end
  371.          else Do
  372.             /* rename error, try to restore original */
  373.             cmdstr = '@rename 'bakfitname'  'client'.FIT'
  374.             address CMD cmdstr
  375.       end
  376.    end
  377.    else return 4
  378.    return 0
  379.  
  380.  
  381.  
  382. /* Subroutine Update_Client_Config_20 */
  383. /* This subroutine creates a new CONFIG.20 for the client that has the */
  384. /* appropriate display device drivers enabled. */
  385. Update_Client_Config_20:
  386.  
  387.    /* if LS 2.0 file, convert it to new format */
  388.    If LS_version = '6000' Then Call Update_LS20_Config_20
  389.    If result <> 0 Then Do
  390.       msg.0 = 1
  391.       msg.1 = 'An error occurred while updating the file 'rpldir'\IBMCOM\'lantype'\CONFIG.20'
  392.       Call Display_Log_Msg
  393.       return 4
  394.    end
  395.  
  396.    /* build fully qualified path names for client CONFIG.20 */
  397.    If client = 'DEFALT20' Then Do
  398.       /* DEFALT20 is special case, it must be called for each lantype */
  399.       configname = rpldir'\IBMCOM\'lantype'\CONFIG.20'
  400.       tmpconfigname = rpldir'\IBMCOM\'lantype'\CONFIG.20T'
  401.       bakconfigname = rpldir'\IBMCOM\'lantype'\CONFIG.20B'
  402.    end
  403.    else Do
  404.       configname = rpldir'\MACHINES\'client'\CONFIG.20'
  405.       tmpconfigname = rpldir'\MACHINES\'client'\CONFIG.20T'
  406.       bakconfigname = rpldir'\MACHINES\'client'\CONFIG.20B'
  407.    end
  408.    /* Call SysFileDelete tmpconfigname */
  409.    Call Delete_File tmpconfigname
  410.    Call Delete_File bakconfigname
  411.  
  412.    If File_Exist(configname) Then Do
  413.       /* copy records to first DEVINFO (XGA) */
  414.       flag = 0
  415.       do until lines(configname) = 0
  416.          data = linein(configname)
  417.          If pos('DEVINFO=', data) <> 0 Then Leave
  418.          xgacomp = pos('ing 6 state', data)
  419.          If xgacomp <> 0 & driver = 'IBMXGA32' Then Do
  420.             /* update XGA comment statement */
  421.             newdata = substr(data, 1, xgacomp+3)||'7'||substr(data, xgacomp+5)
  422.             data = newdata
  423.          end
  424.          Call Lineout tmpconfigname, data
  425.       end
  426.  
  427.       /* process XGA statements */
  428.       position = pos(':\OS2\', data)
  429.       bootdrv2 = substr(data, position-1, 1)
  430.       flag = 0
  431.       Do while flag = 0
  432.          If driver = 'IBMXGA32' Then Do
  433.             If translate(substr(data, 1, 4)) = 'REM ' Then Do
  434.                data = substr(data, 5)
  435.             end
  436.             if pos('\OS2\MDOS\VVGA.SYS', data) <> 0 Then Do
  437.                If pos('=XGA.SYS', lastrecord) = 0 Then Do
  438.                   /* insert the XGA.SYS record */
  439.                   newdata = 'BASEDEV=XGA.SYS'
  440.                   Call Lineout tmpconfigname, newdata
  441.                end
  442.             end
  443.          end
  444.          else Do
  445.             /* make sure records are REMed out */
  446.             if substr(data, 1, 4) <> 'REM ' Then Do
  447.                newdata = 'REM '||data
  448.                data = newdata
  449.             end
  450.          end
  451.          Call lineout tmpconfigname, data
  452.          lastrecord = data
  453.          if pos('SET VIO_XGA=', data) <> 0 Then flag = 1
  454.          else data = linein(configname)
  455.       end
  456.  
  457.       /* copy records to next DEVINFO (8514) */
  458.       flag = 0
  459.       do until lines(configname) = 0
  460.          data = linein(configname)
  461.          If pos('DEVINFO=', data) <> 0 Then Leave
  462.          Call Lineout tmpconfigname, data
  463.       end
  464.  
  465.       /* process 8514 statements */
  466.       flag = 0
  467.       Do while flag = 0
  468.          If driver = 'IBM8514' Then Do
  469.             If translate(substr(data, 1, 4)) = 'REM ' Then Do
  470.                data = substr(data, 5)
  471.             end
  472.          end
  473.          else Do
  474.             /* make sure records are REMed out */
  475.             if substr(data, 1, 4) <> 'REM ' Then Do
  476.                newdata = 'REM '||data
  477.                data = newdata
  478.             end
  479.          end
  480.          Call lineout tmpconfigname, data
  481.          lastrecord = data
  482.          if pos('\V8514A.SYS', data) <> 0 Then flag = 1
  483.          else data = linein(configname)
  484.       end
  485.  
  486.       /* copy records to the VGA DEVINFO */
  487.       do until lines(configname) = 0
  488.          data = linein(configname)
  489.          newdata = translate(data)
  490.          If pos('DEVINFO=SCR,VGA', newdata) <> 0 Then Leave
  491.          Call Lineout tmpconfigname, data
  492.       end
  493.       newdata = ''
  494.  
  495.       /* process VGA statements */
  496.       flag = 0
  497.       Do while flag = 0
  498.          If driver = 'IBMVGA' | driver = 'IBMVGA32' Then Do
  499.             If translate(substr(data, 1, 4)) = 'REM ' Then Do
  500.                data = substr(data, 5)
  501.             end
  502.          end
  503.          else Do
  504.             /* make sure records are REMed out */
  505.             if substr(data, 1, 4) <> 'REM ' Then Do
  506.                newdata = 'REM '||data
  507.                data = newdata
  508.             end
  509.          end
  510.          Call lineout tmpconfigname, data
  511.          lastrecord = data
  512.          if pos('\VVGA.SYS', data) <> 0 Then flag = 1
  513.          else data = linein(configname)
  514.       end
  515.  
  516.       /* copy remaining records */
  517.       do until lines(configname) = 0
  518.          data = linein(configname)
  519.          Call Lineout tmpconfigname, data
  520.       end
  521.  
  522.       Call Lineout tmpconfigname   /* close file */
  523.       Call Lineout configname      /* close file */
  524.  
  525.       /* rename original CONFIG.20 */
  526.       cmdstr = '@rename 'configname' CONFIG.20B'
  527.       address CMD cmdstr
  528.       if rc = 0 Then Do
  529.          /* rename CONFIG.20T to be CONFIG.20 */
  530.          cmdstr = '@rename 'tmpconfigname' CONFIG.20'
  531.          address CMD cmdstr
  532.          if rc = 0 Then Do
  533.             /* delete orginal CONFIG.20 */
  534.             /* Call SysFileDelete bakconfigname */
  535.             cmdstr = '@DEL 'bakconfigname
  536.             address CMD cmdstr
  537.          end
  538.          else Do
  539.             /* rename error, try to restore original */
  540.             cmdstr = '@rename 'bakconfigname' CONFIG.20'
  541.             address CMD cmdstr
  542.          end
  543.       end
  544.    end
  545.    else return 4   /* file not found */
  546.    return 0
  547.  
  548.  
  549.  
  550. /* Subroutine Update_LS20_Config_20 */
  551. /* This subroutine converts a LAN Server 2.0 CONFIG.20 file to the new format */
  552. Update_LS20_Config_20:
  553.  
  554.    /* build fully qualified path names for client CONFIG.20 */
  555.    If client = 'DEFALT20' Then Do
  556.       /* DEFALT20 is special case, it must be called for each lantype */
  557.       configname = rpldir'\IBMCOM\'lantype'\CONFIG.20'
  558.       tmpconfigname = rpldir'\IBMCOM\'lantype'\CONFIG.20T'
  559.       bakconfigname = rpldir'\IBMCOM\'lantype'\CONFIG20.BAK'
  560.    end
  561.    else Do
  562.       configname = rpldir'\MACHINES\'client'\CONFIG.20'
  563.       tmpconfigname = rpldir'\MACHINES\'client'\CONFIG.20T'
  564.       bakconfigname = rpldir'\MACHINES\'client'\CONFIG20.BAK'
  565.    end
  566.    /* Call SysFileDelete tmpconfigname */
  567.    Call Delete_File tmpconfigname
  568.    Call Delete_File bakconfigname
  569.  
  570.    /* determine bootdrive id from PROTSHELL statement */
  571.    do until lines(configname) = 0
  572.       data = translate(linein(configname))
  573.       If substr(data, 1, 9) = 'PROTSHELL' Then Do
  574.          ddi = pos(':\', data)
  575.          newbootdrv = substr(data,ddi - 1, 1)
  576.          Leave
  577.       end
  578.    end
  579.    Call Lineout configname     /* close file */
  580.    if newbootdrv = '' Then return 4
  581.  
  582.    /* check to see if file has already been updated with new device driver */
  583.    /* statements */
  584.    /* Call SysFileSearch '=XGA.SYS', configname, 'xgasys.' */
  585.    /* read client CONFIG.20 looking for the XGA.SYS entry */
  586.    do until lines(configname) = 0
  587.       data = translate(linein(configname))
  588.       xgasysp = pos('=XGA.SYS', data)
  589.       if xgasysp <> 0 then Leave
  590.    end
  591.    Call Lineout configname     /* close file */
  592.    If xgasysp = 0 Then Do
  593.       /* file has not been updated, update it */
  594.  
  595.       /* check to see if dd_data needs to be initialized */
  596.       If ddbootdrv <> newbootdrv Then Do
  597.          dd_data.0 = 0
  598.          ddbootdrv = newbootdrv
  599.       end
  600.       If dd_data.0 = 0 Then Do
  601.          /* initialize dd_data */
  602.          dd_data.0 = 21
  603.          dd_data.1 = 'REM Use the following 7 statements for workstations with XGA displays:'
  604.          dd_data.2 = 'REM DEVINFO=SCR,VGA,'ddbootdrv':\OS2\VIOTBL.DCP'
  605.          dd_data.3 = 'REM DEVICE='ddbootdrv':\OS2\XGARING0.SYS'
  606.          dd_data.4 = 'REM BASEDEV=XGA.SYS'
  607.          dd_data.5 = 'REM DEVICE='ddbootdrv':\OS2\MDOS\VVGA.SYS'
  608.          dd_data.6 = 'REM DEVICE='ddbootdrv':\OS2\MDOS\VXGA.SYS '
  609.          dd_data.7 = 'REM SET VIDEO_DEVICES=VIO_XGA'
  610.          dd_data.8 = 'REM SET VIO_XGA=DEVICE(BVHVGA,BVHXGA)'
  611.          dd_data.9 = ' '
  612.          dd_data.10 = 'REM Use the following 5 statements for workstations with 8514/A adapters:'
  613.          dd_data.11 = 'REM DEVINFO=SCR,BGA,'ddbootdrv':\OS2\VIOTBL.DCP'
  614.          dd_data.12 = 'REM SET VIDEO_DEVICES=VIO_8514A'
  615.          dd_data.13 = 'REM SET VIO_8514A=DEVICE(BVHVGA,BVH8514A)'
  616.          dd_data.14 = 'REM DEVICE='ddbootdrv':\OS2\MDOS\VVGA.SYS'
  617.          dd_data.15 = 'REM DEVICE='ddbootdrv':\OS2\MDOS\V8514A.SYS'
  618.          dd_data.16 = ' '
  619.          dd_data.17 = 'REM Use the following 4 statements for workstations with VGA displays:'
  620.          dd_data.18 = 'DEVINFO=SCR,VGA,'ddbootdrv':\OS2\VIOTBL.DCP'
  621.          dd_data.19 = 'SET VIDEO_DEVICES=VIO_VGA'
  622.          dd_data.20 = 'SET VIO_VGA=DEVICE(BVHVGA)'
  623.          dd_data.21 = 'DEVICE='ddbootdrv':\OS2\MDOS\VVGA.SYS'
  624.       end
  625.  
  626.       If File_Exist(configname) = 1 Then Do
  627.          /* copy records until the DEVINFO=SCR,.. statement */
  628.          do until lines(configname) = 0
  629.             data = translate(linein(configname))
  630.             If substr(data, 1, 12) = 'DEVINFO=SCR,' Then Leave
  631.             Call Lineout tmpconfigname,data
  632.          end
  633.  
  634.          Call Lineout tmpconfigname, ' '   /* blank line */
  635.  
  636.          /* write new device driver statements to file */
  637.          do ddi= 1 to dd_data.0
  638.            Call lineout tmpconfigname, dd_data.ddi
  639.          end
  640.  
  641.          Call Lineout tmpconfigname, ' '   /* blank line */
  642.  
  643.          /* skip display records until POINTDD.SYS statement */
  644.          do until lines(configname) = 0
  645.             data = translate(linein(configname))
  646.             skip = 0
  647.             ddp1 = pos('XGARING0.SYS', data)
  648.             If ddp1 <> 0 Then skip = 1
  649.             else Do
  650.                ddp1 = pos('VXGA.SYS', data)
  651.                if ddp1 <> 0 Then skip = 1
  652.                else Do
  653.                   ddp1 = pos('VIO_XGA', data)
  654.                   if ddp1 <> 0 Then skip = 1
  655.                   else Do
  656.                      ddp1 = pos('VIO_VGA', data)
  657.                      if ddp1 <> 0 Then skip = 1
  658.                      else Do
  659.                         ddp1 = pos('VVGA.SYS', data)
  660.                         if ddp1 <> 0 Then skip = 1
  661.                         else Do
  662.                            ddp1 = pos('VGA DISPLAYS:', data)
  663.                            if ddp1 <> 0 Then skip = 1
  664.                            else Do
  665.                               ddp1 = pos('XGA DISPLAYS:', data)
  666.                               if ddp1 <> 0 Then skip = 1
  667.                            end
  668.                         end
  669.                      end
  670.                   end
  671.                end
  672.             end
  673.             If substr(data, 15, 11) = 'POINTDD.SYS' Then Leave
  674.             If skip = 0 Then Do
  675.               If data <> '' Then Call Lineout tmpconfigname, data
  676.             end
  677.          end
  678.  
  679.          Call Lineout tmpconfigname, data  /* write pointdd.sys */
  680.  
  681.          /* copy remaining records */
  682.          do until lines(configname) = 0
  683.             data = linein(configname)
  684.             Call Lineout tmpconfigname, data
  685.          end
  686.  
  687.          Call Lineout configname
  688.          Call Lineout tmpconfigname
  689.  
  690.          /* rename original CONFIG.20 */
  691.          cmdstr = '@rename 'configname' CONFIG20.BAK'
  692.          address CMD cmdstr
  693.          if rc = 0 Then Do
  694.             /* rename CONFIG.20T to be CONFIG.20 */
  695.             cmdstr = '@rename 'tmpconfigname' CONFIG.20'
  696.             address CMD cmdstr
  697.             if rc <> 0 Then Do
  698.                /* rename error, try to restore original */
  699.                cmdstr = '@rename 'bakconfigname' CONFIG.20'
  700.                address CMD cmdstr
  701.                return 4
  702.             end
  703.          end
  704.          else return 4
  705.       end
  706.    end
  707.    return 0
  708.  
  709.  
  710. Delete_File:
  711.    arg delfilename
  712.    If lines(delfilename) <> 0 Then Do
  713.       Call stream delfilename,C,'close'
  714.       cmdline = '@DEL 'delfilename
  715.       address CMD cmdline
  716.    end
  717.    else Call stream delfilename,C,'close'  /* must do a pseudo-close to prevent */
  718.                                        /* a zero length file from being created */
  719.    return 0
  720.  
  721.  
  722.  
  723. Display_Log_Msg:
  724.    If Rspfile = '' Then Do
  725.       /* display message locally */
  726.       Do i = 1 to msg.0
  727.          Say msg.i
  728.       end
  729.    end
  730.    else Do
  731.       /* log message */
  732.       Do i = 1 to msg.0
  733.          Call lineout Logfile, msg.i
  734.       end
  735.    end
  736.    return 0
  737.  
  738.  
  739. File_Exist:
  740.    Arg testfilename
  741.    If lines(testfilename) = 1 Then rc = 1
  742.    else rc = 0
  743.    /* lines() leaves file open, must force pseudo-close */
  744.    Call stream testfilename,C,'close'
  745.    return rc
  746.  
  747.  
  748.  
  749. Determine_RIPL_Directory:
  750.    /* find out where IBMLAN is installed */
  751.    os2path = value('PATH',,'OS2ENVIRONMENT')
  752.  
  753.    ibmlanp = pos(':\IBMLAN', os2path)
  754.    if ibmlanp = 0 Then Do
  755.      msg.1 = 'The PATH environment variable does not contain a reference to \IBMLAN.'
  756.      msg.2 = 'Either LAN Server 2.0 is not installed or the PATH variable has been '
  757.      msg.3 = 'modified to remove \IBMLAN references.  If LAN Server 2.0 is installed,'
  758.      msg.4 = 'use the SET command to update the PATH variable to specify the path'
  759.      msg.5 = 'for the directory \IBMLAN\NETPROG and then rerun RPLSETD.CMD.'
  760.      Call Display_Log_Msg
  761.      return 4
  762.    end
  763.  
  764.    landrv = substr(os2path, ibmlanp-1, 1)
  765.    lanpath = landrv':\IBMLAN'
  766.  
  767.    fname = lanpath'\IBMLAN.INI'
  768.  
  769.    /* read IBMLAN.INI looking for the RPLDIR entry */
  770.    do until lines(fname) = 0
  771.       data = linein(fname)
  772.       rpldirp = pos('rpldir', data)
  773.       if rpldirp <> 0 then do
  774.          rpldirp = pos('=', data)
  775.          rpldir = strip(substr(data, rpldirp+1))
  776.       end
  777.    end
  778.  
  779.    if rpldir = '' then do
  780.       msg.0 = 1
  781.       msg.1 = 'RPLDIR parameter was not found in IBMLAN.INI'
  782.       Call Display_Log_Msg
  783.       return 4
  784.    end
  785.    return 0
  786.  
  787.  
  788.  
  789. Validate_Display_DriverID:
  790.    /* initialize display driver ids */
  791.    displaydrv.0 = 3
  792.    displaydrv.1 = 'IBMVGA32'
  793.    displaydrv.2 = 'IBMXGA32'
  794.    displaydrv.3 = 'IBM8514'
  795.  
  796.    /* validate driver parameter */
  797.    flag = 0
  798.    Do i=1 to displaydrv.0
  799.       If driver=displaydrv.i Then Do
  800.          flag = 1
  801.          leave
  802.       end
  803.    end
  804.    if flag = 0 Then Do
  805.       msg.1 = 'Invalid display driver specified.'
  806.       msg.0 = 1
  807.       Call Display_Log_Msg
  808.       return 4
  809.    end
  810.    return 0
  811.  
  812.  
  813.  
  814. Read_Rspfile:
  815.    /* read response file and get keyword values */
  816.    Do until lines(Rspfile) = 0
  817.       data = translate(linein(Rspfile))
  818.       If substr(data, 1, 10) = 'DISPLAYDRIVER' Then Do
  819.          epos = pos('=', data)
  820.          driver = strip(substr(data, epos+1))
  821.       end
  822.       else If substr(data, 1, 7) = 'RIPLCLIENT' Then Do
  823.          epos = pos('=', data)
  824.          client = strip(substr(data, epos+1))
  825.       end
  826.       else If substr(data, 1, 7) = 'RIPLCLIENTLIST' Then Do
  827.          epos = pos('=', data)
  828.          client = strip(substr(data, epos+1))
  829.       end
  830.       else If substr(data, 1, 7) = 'LOGFILE' Then Do
  831.          epos = pos('=', data)
  832.          Logfile = strip(substr(data, epos+1))
  833.          Call Delete_File Logfile
  834.       end
  835.       else If substr(data, 1, 8) = 'CURRENTOS2DIR' Then Do
  836.          /* optional OS/2 root directory parameter */
  837.          epos = pos('=', data)
  838.          currentOS2 = strip(substr(data, epos+1))
  839.          changeOS2 = 1
  840.       end
  841.       else If substr(data, 1, 8) = 'NEWOS2DIR' Then Do
  842.          /* optional OS/2 root directory parameter */
  843.          epos = pos('=', data)
  844.          newOS2 = strip(substr(data, epos+1))
  845.          changeOS2 = 1
  846.       end
  847.    end
  848.    Call lineout Rspfile  /* close file */
  849.  
  850.    /* check for required keywords */
  851.    If driver = '' | client = '' | Logfile = '' Then Do
  852.       /* invalid/incomplete response file */
  853.       return 4
  854.    end
  855.    return 0
  856.  
  857.  
  858. Process_Input_Parameters:
  859.    parm.1 = p1
  860.    parm.2 = p2
  861.    parm.3 = p3
  862.    parm.4 = p4
  863.    parm.5 = p5
  864.    parm.6 = p6
  865.  
  866.    Do i = 1 to 6
  867.       If parm.i = '' Then Leave
  868.       parmtype = translate(substr(parm.i,1,2))
  869.       select
  870.          when parmtype = '/H' Then Call Syntax_Help
  871.  
  872.          when parmtype = '/D' Then Do
  873.             if substr(parm.i, 3, 1) = ':' Then driver = substr(parm.i, 4)
  874.             else driver = substr(parm.i, 3)
  875.             driver = translate(driver)
  876.          end
  877.  
  878.          when parmtype = '/C' Then Do
  879.             if substr(parm.i, 3, 1) = ':' Then client = substr(parm.i, 4)
  880.             else client = substr(parm.i, 3)
  881.             client = translate(client)
  882.          end
  883.  
  884.          when parmtype = '/O' Then Do
  885.             if substr(parm.i, 3, 1) = ':' Then currentOS2 = substr(parm.i, 4)
  886.             else currentOS2 = substr(parm.i, 3)
  887.             changeOS2 = 1
  888.          end
  889.  
  890.          when parmtype = '/N' Then Do
  891.             if substr(parm.i, 3, 1) = ':' Then newOS2 = substr(parm.i, 4)
  892.             else newOS2 = substr(parm.i, 3)
  893.             changeOS2 = 1
  894.          end
  895.  
  896.          when parmtype = '/L' Then Do
  897.             if substr(parm.i, 3, 1) = ':' Then Logfile = substr(parm.i, 4)
  898.             else Logfile = substr(parm.i, 3)
  899.          end
  900.  
  901.          otherwise Do
  902.            msg.0 = 1
  903.            msg.1 = 'The option 'parm.i' is not a valid option.'
  904.            Call Display_Log_Msg
  905.            return 4
  906.          end
  907.       end
  908.    end
  909.    return 0
  910.