home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / lad2st.zip / LAD2ST11.CMD next >
OS/2 REXX Batch file  |  1993-04-30  |  31KB  |  949 lines

  1. /*******************************************************************/
  2. /*                                                                 */
  3. /* Function:            LAD2ST11                                   */
  4. /*                                                                 */
  5. /* Version:             1.0 (April 30, 1993)                       */
  6. /*                                                                 */
  7. /* Description:         Transfers data from a LAD/2 workgroup      */
  8. /*                      directory into IBM LAN NetView Start 1.1   */
  9. /*                      (Start) migration files.                   */
  10. /*                                                                 */
  11. /* Input:                                                          */
  12. /*        /LADPATH=source pathname of the LAD/2 main directory     */
  13. /*        /CUSTOMER=customer name                                  */
  14. /*        /WGNAME=workgroup name                                   */
  15. /*        /USERNAME=user name                                      */
  16. /*          (optional - if not specified, all the users in the     */
  17. /*          workgroup are migrated)                                */
  18. /*        /OFILE=fully qualified override file name                */
  19. /*          (optional - if not specified, no node, LAN adapter, or */
  20. /*          LAN Server parameters will be overridden)              */
  21. /*        /MIGPATH=target pathname of an existing directory for    */
  22. /*          the generated Start migration files (optional -        */
  23. /*          defaults to the current directory)                     */
  24. /*                                                                 */
  25. /* Output:   IBM LAN NetView Start 1.1 migration files             */
  26. /*                                                                 */
  27. /* Notes:                                                          */
  28. /*        Possible return codes:                                   */
  29. /*           0 - Successful                                        */
  30. /*           1 - Bad or missing parameter                          */
  31. /*           2 - File not found                                    */
  32. /*           3 - Unable to load RexxUtil                           */
  33. /*           4 - Could not find workgroup entry                    */
  34. /*           5 - No users (or clients) found for processing        */
  35. /*           6 - Could not generate one or more migration files    */
  36. /*           7 - Could not find the migration directory            */
  37. /*                                                                 */
  38. /* Dependencies:         RexxUtils (REXX utilities function)       */
  39. /*                                                                 */
  40. /* DISCLAIMER OF WARRANTIES:                                       */
  41. /* The following [enclosed] code is an applet program created by   */
  42. /* the IBM Corporation.  This code is provided "AS IS", without    */
  43. /* warranty or support of any kind.  IBM shall not be liable for   */
  44. /* any damages arising out of the use of this applet code, even if */
  45. /* the users have been advised of the possibility of such damages. */
  46. /* IBM reserves the right to make improvements or changes to this  */
  47. /* applet code at any time without any notice to you.  This applet */
  48. /* can be further copied and redistributed without restriction.    */
  49. /*                                                                 */
  50. /*******************************************************************/
  51.  
  52. parse upper arg parm.1 parm.2 parm.3 parm.4 parm.5 parm.6 rest
  53.  
  54. if ((parm.1 = '?') | (parm.1 = '')) then
  55.      do
  56.       say 'LAD2ST11.CMD - Transfers data from a LAD/2 workgroup directory'
  57.       say 'into IBM LAN NetView Start 1.1 (Start) migration files.'
  58.       say ' '
  59.       say 'Parameters:'
  60.       say '   /LADPATH=source pathname of the LAD/2 main directory'
  61.       say '   /CUSTOMER=customer name'
  62.       say '   /WGNAME=workgroup name'
  63.       say '   /USERNAME=user name'
  64.       say '     (optional - if not specified, all the users in the workgroup'
  65.       say '     are migrated)'
  66.       say '   /OFILE=fully qualified override file name'
  67.       say '     (optional - if not specified, no node, LAN adapter,'
  68.       say '     or LAN Server parameters will be overridden)'
  69.       say '   /MIGPATH=target pathname of an existing directory for'
  70.       say '     the generated Start migration files (optional -'
  71.       say '     defaults to the current directory)'
  72.       say ' '
  73.       say 'Example call:'
  74.       say '   lad2st11 /ladpath=y:\lad2\ /customer=market /wgname=sales'
  75.       exit 1
  76.      end
  77.  
  78. ladpath = ''
  79. cpath = ''
  80. wgpath = ''
  81. migpath = ''
  82. ofile = ''
  83. username = ''
  84. customer = ''
  85. wgname = ''
  86. exitrc = 0
  87.  
  88. do i = 1 to 6
  89.    parmfound = false
  90.    currparm = translate(parm.i)
  91.    if (substr(currparm,1,9) = '/LADPATH=') then
  92.       do
  93.          parmfound = true
  94.          ladpath = strip(substr(currparm,10,length(currparm)))
  95.          if (ladpath = '') then
  96.              do
  97.                 say 'A value was not specified with the /LADPATH parameter.'
  98.                 say '   The parameter is ignored.'
  99.              end
  100.       end
  101.    if (substr(currparm,1,10) = '/CUSTOMER=') then
  102.       do
  103.          parmfound = true
  104.          customer = strip(substr(currparm,11,length(currparm)))
  105.          if (customer = '') then
  106.              do
  107.                 say 'A value was not specified with the /CUSTOMER parameter.'
  108.                 say '   The parameter is ignored.'
  109.              end
  110.       end
  111.    if (substr(currparm,1,9) = '/MIGPATH=') then
  112.       do
  113.          parmfound = true
  114.          migpath = strip(substr(currparm,10,length(currparm)))
  115.          if (migpath = '') then
  116.              do
  117.                 say 'A value was not specified with the /MIGPATH parameter.'
  118.                 say '   The parameter is ignored.'
  119.              end
  120.       end
  121.    if (substr(currparm,1,8) = '/WGNAME=') then
  122.       do
  123.          parmfound = true
  124.          wgname = strip(substr(currparm,9,length(currparm)))
  125.          if (wgname = '') then
  126.              do
  127.                 say 'A value was not specified with the /WGNAME parameter.'
  128.                 say '   The parameter is ignored.'
  129.              end
  130.       end
  131.    if (substr(currparm,1,10) = '/USERNAME=') then
  132.       do
  133.          parmfound = true
  134.          username = translate(strip(substr(currparm,11,length(currparm))))
  135.          if (username = '') then
  136.              do
  137.                 say 'A value was not specified with the /USERNAME parameter.'
  138.                 say '   The parameter is ignored.'
  139.              end
  140.       end
  141.    if (substr(currparm,1,7) = '/OFILE=') then
  142.       do
  143.          parmfound = true
  144.          ofile = strip(substr(currparm,8,length(currparm)))
  145.          if (ofile = '') then
  146.              do
  147.                 say 'A value was not specified with the /OFILE parameter.'
  148.                 say '   The parameter is ignored.'
  149.              end
  150.       end
  151.    if ((parmfound = false) & \(currparm = '')) then
  152.       do
  153.          say 'Parameter ' || currparm || ' is not recognized.  It is being ignored.'
  154.       end
  155. end
  156.  
  157. say ''
  158.  
  159. if (ladpath = '') then
  160.    do
  161.       say '/LADPATH parameter missing.'
  162.       say '   Specify the LAD2 directory path and retry.'
  163.       exit 1
  164.     end
  165.  
  166. if \(substr(ladpath,length(ladpath),1) = '\') then
  167.    ladpath = ladpath || '\'
  168.  
  169. if (customer = '') then
  170.    do
  171.       say '/CUSTOMER parameter missing.'
  172.       say '   Specify the customer name and retry.'
  173.       exit 1
  174.     end
  175. else
  176.    do
  177.       cpath = ladpath || translate(customer) || '\'
  178.       say 'Customer path is ' || cpath || '.'
  179.    end
  180.  
  181. if (wgname = '') then
  182.    do
  183.       say '/WGNAME parameter missing.'
  184.       say '   Specify the workgroup name parameter and retry.'
  185.       exit 1
  186.     end
  187. else
  188.    do
  189.       wgpath = cpath || translate(wgname) || '\'
  190.       say 'Workgroup path is ' || wgpath || '.'
  191.    end
  192.  
  193. if (migpath = '') then
  194.    do
  195.       say '/MIGPATH parameter not specified.'
  196.       say '   The target directory for generated Start migration files will default to the current directory.'
  197.       migpath = directory()
  198.    end
  199. else
  200.    do
  201.       currDir = directory()
  202.       newDir = migpath
  203.       if (substr(newDir,length(newDir),1) = '\') then
  204.          newDir = substr(newDir,length(newDir),length(newDir)-1)
  205.       newDir = directory(newDir)
  206.       currDir = directory(currDir)
  207.       if (newDir = '') then
  208.          do
  209.             say 'ERROR:  Cannot find migration directory path ' || migpath || '.'
  210.             exit 7
  211.          end
  212.    end
  213.  
  214. if \(substr(migpath,length(migpath),1) = '\') then
  215.    migpath = migpath || '\'
  216. say 'Target migration path ' || migpath || '.'
  217.  
  218. /* Load REXX utilities and initialize variables */
  219.  
  220. rc = RxFuncAdd('SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs')
  221. if \((rc = 0) | (rc = 1)) then
  222.    do
  223.       say 'ERROR:  Could not load RexxUtils.'
  224.       say '   Insure that you have it installed on your workstation and try again.'
  225.       exit 3
  226.    end
  227. call SysLoadFuncs
  228.  
  229. /****************************************************/
  230. /* Read values from the override file, if it exists */
  231. /****************************************************/
  232.  
  233. defNum = 0
  234. if \(ofile = '') then
  235.    do
  236.       call SysFileTree ofile, 'file', 'F'
  237.       if (file.0 = 0) then
  238.          do
  239.             say 'ERROR:  Could not find override file:  ' || ofile
  240.             say '   Check your invocation parameters and if the override file exists and retry.'
  241.             exit 2
  242.          end
  243.       say '   Reading in override file ' || ofile || '.'
  244.       rc = stream(ofile, 'c', 'open read')
  245.       do until lines(ofile) = 0
  246.          line = linein(ofile)
  247.          if \(line = '') then
  248.             do
  249.                defNum = defNum + 1
  250.                def.defNum.1 = translate(word(line,1))
  251.                posBlank = pos(' ', line)
  252.                if (posBlank > 0) then
  253.                   def.defNum.2 = strip(substr(line,posBlank+1,length(line)))
  254.                else
  255.                   def.defNum.2 = ' '
  256.             end
  257.       end
  258.       rc = stream(ofile, 'c', 'close')
  259.    end
  260.  
  261. /* fileStruct.1.1 = filename
  262.    fileStruct.1.2.1..n = lines
  263.    fileStruct.1.3 = size
  264. */
  265.    fileStructNum = 4
  266.    fileStruct.1.1 = 'EXTD.TBL'
  267.    fileStruct.2.1 = 'LAPS.TBL'
  268.    fileStruct.3.1 = 'LS30.TBL'
  269.    fileStruct.4.1 = 'RECEIVER.TBL'
  270.  
  271. do j = 1 to fileStructNum
  272.    filename = wgpath || fileStruct.j.1
  273.    call SysFileTree filename, 'file', 'F'
  274.    if (file.0 = 0) then
  275.       do
  276.          say 'ERROR:  Could not find ' || filename
  277.          exit 2
  278.       end
  279.    rc = stream(filename, 'c', 'open read')
  280.    i = 1
  281.    do until lines(filename) = 0
  282.       fileStruct.j.2.i = linein(filename)
  283.       i = i + 1
  284.    end
  285.    rc = stream(filename, 'c', 'close')
  286.    fileStruct.j.3 = i - 1
  287. end
  288.  
  289. /****************************/
  290. /* Find the workgroup file. */
  291. /****************************/
  292.  
  293. filename = ladpath || 'LADCODE\WORKGRP.TBL'
  294. call SysFileTree filename, 'file', 'F'
  295. if (file.0 = 0) then
  296.    do
  297.       say 'ERROR:  Could not find ' || filename
  298.       exit 2
  299.    end
  300. rc = stream(filename, 'c', 'open read')
  301. wgLine = ''
  302. do until lines(filename) = 0
  303.    line = linein(filename)
  304.    if ((substr(line,1,8) = customer) & (substr(line,9,7) = wgname)) then
  305.       wgLine = line
  306. end
  307. rc = stream(filename, 'c', 'close')
  308.  
  309. if (wgLine = '') then
  310.    do
  311.       say 'Could not find the corresponding customer/workgroup entry in' || filename || '.'
  312.       say '   Check your parameters and/or the contents of ' || filename || ' and retry.'
  313.       exit 4
  314.    end
  315.  
  316. /********************************/
  317. /* Find the user/client name(s) */
  318. /********************************/
  319.  
  320. userNum = 0
  321. do i = 1 to fileStructNum - 1
  322.    do k = 1 to fileStruct.i.3
  323.       found = false
  324.       newUser = substr(fileStruct.i.2.k,1,7)
  325.       do j =1 to userNum
  326.          /* Skip over DEFAULT and TEST. */
  327.          if ((user.j = newUser) | ((newUser = 'DEFAULT') | (newUser = 'TEST'))) then
  328.             found = true
  329.       end
  330.       if (found = false) then
  331.          do
  332.             if (username = '') then
  333.                do
  334.                   userNum = userNum + 1
  335.                   user.userNum = newUser
  336.                end
  337.             else
  338.                if (newUser = username) then
  339.                   do
  340.                      userNum = userNum + 1
  341.                      user.userNum = newUser
  342.                   end
  343.          end
  344.    end
  345. end
  346.  
  347. if (userNum = 0) then
  348.    do
  349.       say 'Could not find the specified username ' || username || '  in the workgroup.'
  350.       say '   Check your invocation parameters and retry.'
  351.       exit 5
  352.    end
  353.  
  354. do userPos = 1 to userNum
  355.    /* Find the correct line for EXTD */
  356.    extdLine = ' '
  357.    do i = 1 to fileStruct.1.3
  358.       if (substr(fileStruct.1.2.i,1,7) = user.userPos) then
  359.          do
  360.             extdLine = fileStruct.1.2.i
  361.          end
  362.    end
  363.  
  364.    /* Find the correct line for LAPS */
  365.    lapsLine = ' '
  366.    do i = 1 to fileStruct.2.3
  367.       if ((substr(fileStruct.2.2.i,1,8) = customer) & (substr(fileStruct.2.2.i,9,7) = wgname)) then
  368.          do
  369.             lapsLine = fileStruct.2.2.i
  370.          end
  371.    end
  372.    /* The TEST entry in LAPS.TBL applies to all the clients in the workgroup. */
  373.    if (lapsLine = '') then
  374.       do i = 1 to fileStruct.2.3
  375.          if ((substr(fileStruct.2.2.i,1,8) = 'TEST') & (substr(fileStruct.2.2.i,9,7) = 'TEST')) then
  376.             do
  377.                lapsLine = fileStruct.2.2.i
  378.             end
  379.       end
  380.    
  381.    /* Find the correct line for LS30 */
  382.    ls30Line = ' '
  383.    do i = 1 to fileStruct.3.3
  384.       if (substr(fileStruct.3.2.i,1,7) = user.userPos) then
  385.          do
  386.             ls30Line = fileStruct.3.2.i
  387.          end
  388.    end
  389.  
  390.    /* Find the correct line for receiver */
  391.    receiverLine = ' '
  392.    do i = 1 to fileStruct.4.3
  393.       if (substr(fileStruct.4.2.i,8,7) = user.userPos) then
  394.          do
  395.             receiverLine = fileStruct.4.2.i
  396.          end
  397.    end
  398.    
  399.    NodeName = strip(user.userPos)
  400.    outfilename = migpath || NodeName || '.IMP'
  401.    say 'On Migration File: ' || outfilename
  402.  
  403.    node.0.1 = '*NODE*'
  404.    node.0.2 = ''
  405.    node.1.1 = 'EMAdapterNum'
  406.    node.1.2 = '3'
  407.    node.2.1 = 'DBType'
  408.    node.2.2 = 'stop'
  409.    node.3.1 = 'LANType'
  410.    node.3.2 = 'stop'
  411.    node.4.1 = 'EMType'
  412.    node.4.2 = 'stop'
  413.    node.5.1 = 'GWType'
  414.    node.5.2 = ' '
  415.    node.6.1 = 'EMDFTSess'
  416.    node.6.2 = '0'
  417.    emdftSessNum = substr(extdLine,92,1)
  418.    node.7.1 = 'EMNDFTSess'
  419.    node.7.2 = '0'
  420.    emnondftSessNum = substr(extdLine,28,1)
  421.    node.8.1 = 'DEFLOCALCP'
  422.    node.8.2 = NodeName
  423.  
  424.    localNodeID = substr(extdLine,151,8)
  425.    if \(localNodeID = '') then
  426.       node.8.2 = localNodeID
  427.  
  428.    node.9.1 = 'CPALIAS'
  429.    node.9.2 = node.8.2
  430.    
  431.    localNodeAlias = substr(extdLine,159,8)
  432.    if \(localNodeAlias = '') then
  433.       node.9.2 = localNodeAlias
  434.  
  435.    node.10.1 = 'OSversion'
  436.    node.10.2 = 'os/2 2.0'
  437.    node.11.1 = 'BootDrive'
  438.    node.11.2 = c2d(substr(wgLine,106,1)) - 64
  439.    if \(lapsDrive = '') then
  440.       do
  441.          lapsDrive = translate(substr(lapsLine,16,1))
  442.          if \(lapsDrive = 'C')  then
  443.             do
  444.                say '   When migrating the node, Start will set the LAPS drive to C.'
  445.                say '   In LAD/2, the LAPS drive was set to drive ' || lapsDrive || '.'
  446.             end
  447.       end
  448.  
  449.    node.12.1 = 'DBInstalled'
  450.    node.12.2 = '0'
  451.    node.13.1 = 'CMInstalled'
  452.    node.13.2 = '0'
  453.    node.14.1 = 'LANInstalled'
  454.    node.14.2 = '0'
  455.    
  456.    node.15.1 = 'MachineType'
  457.    node.15.2 = '0000'
  458.    node.16.1 = 'MachineNum'
  459.    node.16.2 = '000'
  460.    node.17.1 = 'MfgPlant'
  461.    node.17.2 = '00'
  462.    node.18.1 = 'SerialNum'
  463.    node.18.2 = '0000000'
  464.  
  465.    if \(ls30Line = '') then
  466.       do
  467.          node.15.2 = substr(ls30Line,43,4) /* MachineType */
  468.          node.16.2 = substr(ls30Line,47,3) /* MachineNum */
  469.          node.17.2 = substr(ls30Line,50,2) /* MfgPlant */
  470.          node.18.2 = substr(ls30Line,58,7) /* SerialNum */
  471.       end
  472.  
  473.    do i = 19 to 23
  474.       digit = d2c(i+30)
  475.       node.i.1 = 'StartDFTSess' || digit
  476.       node.i.2 = ' '
  477.       y = i+5
  478.       node.y.1 = 'StartNDFTSess' || digit
  479.       node.y.2 = ' '
  480.    end
  481.    node.29.1 = 'WKSTComment'
  482.    node.29.2 = ' '
  483.    node.30.1 = 'NodeID'
  484.    node.30.2 = ' '
  485.    if \(extdLine = '') then
  486.       node.30.2 = substr(extdLine,146,5)
  487.  
  488. /****************************/
  489. /* work on database section */
  490. /****************************/
  491.  
  492.    if (substr(wgLine,181,1) = 'I') then
  493.       do
  494.          num = substr(extdLine,145,1)
  495.          node.12.2 = c2d(substr(wgLine,185,1)) - 64
  496.          select
  497.             when (num = 0) then
  498.                do
  499.                   node.2.2 = 'local'
  500.                   say '   Start does not support standalone database functionality.'
  501.                   say '   Start will migrate the node without database functionality.'
  502.                end
  503.             when (num = 1) then
  504.                node.2.2 = 'svr'
  505.             when (num = 2) then
  506.                node.2.2 = 'req'
  507.             when (num = 3) then
  508.                do
  509.                   /* Migration won't accept reqsvr when num=3 */
  510.                   node.2.2 = 'svr'
  511.                   say '   The Start migration facility does not support requester/server functionality.'
  512.                   say '   Start will migrate the node with server functionality.'
  513.                end
  514.             otherwise nop
  515.          end  
  516.       end
  517.  
  518. /*******************************/
  519. /* work on emdftparms sections */
  520. /*******************************/
  521.    
  522.    emdftparms.0.1 = '*EMDFTPARMS*'
  523.    emdftparms.0.2 = ' '
  524.    emdftparms.1.1 = 'SessionNum'
  525.    emdftparms.1.2 = ' '
  526.    emdftparms.2.1 = 'SessionType'
  527.    emdftparms.2.2 = '1'
  528.    emdftparms.3.1 = 'SessShortID'
  529.    emdftparms.3.2 = ' '
  530.    emdftparms.4.1 = 'PresSpace'
  531.    emdftparms.4.2 = '2'
  532.    emdftparms.5.1 = 'PresSpaceRow'
  533.    emdftparms.5.2 = ' '
  534.    emdftparms.6.1 = 'PresSpaceCol'
  535.    emdftparms.6.2 = ' '
  536.    emdftparms.7.1 = 'SessionName'
  537.    emdftparms.7.2 = emdftparms.3.2
  538.  
  539.    do i = 1 to 5
  540.       j = 95 + (10 * (i - 1))
  541.       dftshort.i = substr(extdLine,j,1)
  542.       dftsess.i = substr(extdLine,j+1,8)
  543.       dftsize.i = substr(extdLine,j+9,1)
  544.    end
  545.  
  546.    emdftprinterBool = false
  547.    emdftSessTotal = emdftSessNum
  548.    if (substr(extdLine,93,1) = 'Y') then
  549.       do
  550.          emdftprinterBool = true
  551.          emdftSessTotal = emdftSessNum + 1
  552.       end
  553.  
  554.    /* Don't process dft sessions if CM is not installed and dft adapter <> 3,
  555.    and if there are no config_3270_dft sessions. */
  556.    if \( (substr(wgLine,211,1) = 'Y') & ( (substr(wgLine,180,1) = 'I') & (substr(extdLine,91,1) = '3' ))) then
  557.         emdftSessTotal = 0
  558.  
  559.    if (emdftSessTotal > 0) then
  560.     do
  561.         node.6.2 = emdftSessTotal
  562.         do i = 1 to emdftSessTotal
  563.            do j = 0 to  7
  564.                emdft.j.1.i = emdftparms.j.1
  565.                emdft.j.2.i = emdftparms.j.2
  566.            end
  567.            emdft.1.2.i = i
  568.            if \(dftshort.i = '') then
  569.                emdft.3.2.i = dftshort.i
  570.            if \(dftsess.i = '') then
  571.                emdft.7.2.i = dftsess.i
  572.            if \(dftsize.i = '') then
  573.                emdft.4.2.i = dftsize.i
  574.            if ((emdftprinterBool = true) & (i = emdftSessTotal)) then
  575.                do
  576.                   emdft.2.2.i = '2'
  577.                   emdft.4.2.i = ' '
  578.                end
  579.            if (substr(extdLine,94,1) = 'Y') then
  580.                do
  581.                   num = 18 + i
  582.                   node.num.2 = dftsess.i
  583.                end
  584.       end
  585.     end
  586.  
  587. /**********************************/
  588. /* work on emnondftparms sections */
  589. /**********************************/
  590.    
  591.    emnondftparms.0.1 = '*EMNONDFTPARMS*'
  592.    emnondftparms.0.2 = ' '
  593.    emnondftparms.1.1 = 'SessionNum'
  594.    emnondftparms.1.2 = ' '
  595.    emnondftparms.2.1 = 'SessionType'
  596.    emnondftparms.2.2 = '1'
  597.    emnondftparms.3.1 = 'SessShortID'
  598.    emnondftparms.3.2 = ' '
  599.    emnondftparms.4.1 = 'PresSpace'
  600.    emnondftparms.4.2 = '2'
  601.    emnondftparms.5.1 = 'PresSpaceRow'
  602.    emnondftparms.5.2 = ' '
  603.    emnondftparms.6.1 = 'PresSpaceCol'
  604.    emnondftparms.6.2 = ' '
  605.    emnondftparms.7.1 = 'LUName'
  606.    emnondftparms.7.2 = emnondftparms.3.2
  607.    emnondftparms.8.1 = 'LULocalAdd'
  608.    emnondftparms.8.2 = ' '
  609.    emnondftparms.9.1 = 'ForAdapter'
  610.    emnondftparms.9.2 = '0'
  611.    emnondftparms.10.1 = 'AdapType'
  612.    emnondftparms.10.2 = 'LAN'            
  613.  
  614.    do i = 1 to 5
  615.       j = 31 + (12 * (i - 1))
  616.       nondftshort.i = substr(extdLine,j,1)
  617.       nondftsesn.i = substr(extdLine,j+1,8)
  618.       nondftnau.i = substr(extdLine,j+9,2)
  619.       nondftsize.i = substr(extdLine,j+11,1)
  620.    end
  621.  
  622.    emnondftprinterBool = false
  623.    emnondftSessTotal = emnondftSessNum
  624.    if (substr(extdLine,29,1) = 'Y') then
  625.       do
  626.          emnondftprinterBool = true
  627.          emnondftSessTotal = emnondftSessNum + 1
  628.       end
  629.  
  630.    /* Don't process non-dft sessions if CM is not installed
  631.    and if there are no config_3270_non_dft sessions. */
  632.    if \((substr(wgLine,212,1) = 'Y') & (substr(wgLine,180,1) = 'I')) then
  633.         emnondftSessTotal = 0
  634.  
  635.    if (emnondftSessTotal > 0) then
  636.     do
  637.         node.7.2 = emnondftSessTotal
  638.         do i = 1 to emnondftSessTotal
  639.            do j = 0 to 10
  640.                emnondft.j.1.i = emnondftparms.j.1
  641.                emnondft.j.2.i = emnondftparms.j.2
  642.            end
  643.            emnondft.1.2.i = i
  644.            if \(nondftshort.i = '') then
  645.                emnondft.3.2.i = nondftshort.i
  646.            if \(nondftsesn.i = '') then
  647.                emnondft.7.2.i = nondftsesn.i
  648.            if \(nondftnau.i = '') then
  649.                emnondft.8.2.i = nondftnau.i
  650.            if \(nondftsize.i = '') then
  651.                emnondft.4.2.i = nondftsize.i
  652.            if ((emnondftprinterBool = true) & (i = emnondftSessTotal)) then
  653.                do
  654.                   emnondft.2.2.i = '2'
  655.                   emnondft.4.2.i = ' '
  656.                end
  657.            if (substr(extdLine,30,1) = 'Y') then
  658.                do
  659.                   num = 23 + i
  660.                   node.num.2 = nondftsesn.i
  661.                end
  662.       end
  663.     end
  664.  
  665. /******************************/
  666. /* work on dftadapter section */
  667. /******************************/
  668.  
  669.    dftadapterBool = false
  670.    dftadapter.0.1 = '*ADAPTER*'
  671.    dftadapter.0.2 = ' '
  672.    dftadapter.1.1 = 'AdapterNum'
  673.    dftadapter.1.2 = '3'
  674.    dftadapter.2.1 = 'AdapterType'
  675.    dftadapter.2.2 = 'dft 3270'
  676.  
  677.    /* If CM is installed and the dft adapter = 3
  678.    create a dft adapter entry. */
  679.    if (substr(wgLine,180,1) = 'I') then
  680.       do
  681.          node.13.2 = c2d(substr(wgLine,107,1)) - 64
  682.          if (substr(extdLine,91,1) = '3' ) then
  683.             do
  684.                dftadapterBool = true
  685.                node.4.2 = 'dft'
  686.             end
  687.          else
  688.             do
  689.                say '   Specified DFT adapter type is not 3270 Connection'
  690.                say '          and was not included in the migration file.'
  691.                if (substr(extdLine,91,1) = '1' ) then
  692.                   say '          The DFT adapter type was 3278/79.'
  693.                if (substr(extdLine,91,1) = '2' ) then
  694.                   say '          The DFT adapter type was Advanced 3278/79.'
  695.             end
  696.       end
  697.  
  698. /***************************/
  699. /* work on adapter section */
  700. /***************************/
  701.  
  702.    lanadapterBool = false
  703.    lanadapter.0.1 = '*ADAPTER*'
  704.    lanadapter.0.2 = ' '
  705.    lanadapter.1.1 = 'AdapterNum'
  706.    lanadapter.1.2 = '0'
  707.    lanadapter.2.1 = 'AdapterType'
  708.    lanadapter.2.2 = ' '
  709.    lanadapter.3.1 = 'AdapterSpeed'
  710.    lanadapter.3.2 = ' '
  711.    lanadapter.4.1 = 'LocalAdminAdd'
  712.    lanadapter.4.2 = '000000000000'
  713.    lanadapter.5.1 = 'EMDestAdd'
  714.    lanadapter.5.2 = ' '
  715.    lanadapter.6.1 = 'EMRUsize'
  716.    lanadapter.6.2 = '1920'
  717.    lanadapter.7.1 = 'CSMLANID'
  718.    lanadapter.7.2 = 'CASMID'
  719.    lanadapter.8.1 = 'EthernetType'
  720.    lanadapter.8.2 = '802.3'
  721.  
  722.    if \(lapsLine = '') then
  723.       do
  724.          lanadapterBool = true
  725.  
  726.          /* If non-dft sessions are defined, add LAN EMType functionality. */
  727.          if (emnondftSessTotal > 0) then
  728.             node.4.2 = node.4.2 || ' lan'
  729.  
  730.          adapterNum = substr(lapsLine,213,1)
  731.          select
  732.             when (adapterNum = 0) then
  733.                do
  734.                   lanadapter.2.2 = 'tr-unknown'
  735.                   lanadapter.3.2 = '4'
  736.                   lanadapter.8.1 = ' '
  737.                   lanadapter.8.2 = ' '
  738.                   say '   IBM Token Ring adapter specified.'
  739.                   say '      Start will assume it is type Token Ring 16/4 /a with a set speed of 4.'
  740.                end
  741.             when (adapterNum = 1) then
  742.                do
  743.                   lanadapter.3.1 = ' '
  744.                   lanadapter.2.2 = 'ibm ethernet /a'
  745.                end
  746.             when (adapterNum = 2) then
  747.                do
  748.                   lanadapter.3.1 = ' '
  749.                   lanadapter.2.2 = '3comethermc'
  750.                end
  751.             when (adapterNum = 3) then
  752.                do
  753.                   lanadapter.3.1 = ' '
  754.                   lanadapter.2.2 = 'ungermann-bass niups2'
  755.                end
  756.             when (adapterNum = 4) then
  757.                do
  758.                   lanadapter.2.2 = 'bus master token ring'
  759.                   lanadapter.3.2 = '4'
  760.                   lanadapter.8.1 = ' '
  761.                   lanadapter.8.2 = ' '
  762.                   say '   IBM Bus Master Token Ring adapter specified.'
  763.                   say '      Assuming it has a set speed of 4.'
  764.                end
  765.             otherwise nop
  766.          end  
  767.  
  768.          if \(receiverLine = '') then
  769.             do
  770.                /* Get the LocalAdminAdd if it exists, otherwise, 
  771.                it's a UAA and needs to be defaulted to 000000000000. */
  772.                str = substr(wgLine,99,1)
  773.                if (str = 'Y') then
  774.                   lanadapter.4.2 = substr(receiverLine,194,12)
  775.                else
  776.                   say '   Universal Adapter Address defaulted to 000000000000.'
  777.             end
  778.  
  779.          if \(extdLine = '') then
  780.             do
  781.                /* Get the EMDestAdd. */
  782.                lanadapter.5.2 = substr(extdLine,8,12)
  783.  
  784.                /* Default the CSMLANID to the NETWORK_ID. */
  785.                lanadapter.7.2 = substr(extdLine,20,8)
  786.  
  787.                /* Check if DIX was specified. */
  788.                str = substr(wgLine,97,1)
  789.                if (str = '2') then
  790.                   if ((adapterNum = '1') | ((adapterNum = '2') | (adapterNum = '3'))) then
  791.                      lanadapter.8.2 = 'DIX'
  792.             end
  793.  
  794.          /* Put the Ethernet or Token Ring prefix before the LocalAdminAdd. */
  795.          if ((adapterNum = '1') | ((adapterNum = '2') | (adapterNum = '3'))) then
  796.             lanadapter.4.2 = 'I' || lanadapter.4.2
  797.          else
  798.             lanadapter.4.2 = 'T' || lanadapter.4.2
  799.  
  800.       end
  801.  
  802. /***********************/
  803. /* work on LAN section */
  804. /***********************/
  805.    
  806.    lanBool = false
  807.    lansrparms.0.1 = '*LANSRPARMS*'
  808.    lansrparms.0.2 = ' '
  809.    lansrparms.1.1 = 'AdapterNum'
  810.    lansrparms.1.2 = '0'
  811.    lansrparms.2.1 = 'DomainName'
  812.    lansrparms.2.2 = ' '
  813.    lansrparms.3.1 = 'COMPUTERNAME'
  814.    lansrparms.3.2 = ' '
  815.    lansrparms.4.1 = 'FileAccessMode'
  816.    lansrparms.4.2 = '3'  /* defaulting to mixed */
  817.  
  818.    if (substr(wgLine,182,1) = 'I') then
  819.       do
  820.          lanBool = true
  821.          node.14.2 = c2d(substr(ls30Line,25,1)) - 64
  822.          lanType = translate(substr(ls30Line,26,1))
  823.          if (lanType = 'R') then
  824.             node.3.2 = 'req'
  825.          if (lanType = 'D') then
  826.             node.3.2 = 'dom'
  827.          if ((lanType = 'A') | (lanType = 'B')) then
  828.             node.3.2 = 'svr'
  829.  
  830.          domainName = substr(ls30Line,16,8)
  831.          if \(domainName = '') then
  832.            lansrparms.2.2 = domainName
  833.          
  834.          computerName = substr(ls30Line,8,8)
  835.          if \(computerName = '') then
  836.             lansrparms.3.2 = computerName
  837.          else
  838.             lansrparms.3.2 = nodeName
  839.         
  840.       end
  841.  
  842. /*******************/
  843. /* override values */
  844. /*******************/
  845.  
  846.    do i = 1 to defNum
  847.       /* Are there any values in the nodes section? */
  848.       do j = 1 to 30
  849.          if (translate(node.j.1) = def.i.1) then
  850.             do
  851.                say '   Overriding ' || node.j.1 || ' old value ''' || node.j.2 || ''' with new value ''' || def.i.2 || '''.'
  852.                node.j.2 = def.i.2
  853.             end
  854.       end 
  855.  
  856.       /* Are there any values in the LAN adapter section? */
  857.       do j = 1 to 8
  858.          if (translate(lanadapter.j.1) = def.i.1) then
  859.             do
  860.                say '   Overriding ' || lanadapter.j.1 || ' old value ''' || lanadapter.j.2 || ''' with new value ''' || def.i.2 || '''.'
  861.                lanadapter.j.2 = def.i.2
  862.             end
  863.       end 
  864.  
  865.       /* Are there any values in the LAN parameters section? */
  866.       do j = 1 to 4
  867.          if (translate(lansrparms.j.1) = def.i.1) then
  868.             do
  869.                say '   Overriding ' || lansrparms.j.1 || ' old value ''' || lansrparms.j.2 || ''' with new value ''' || def.i.2 || '''.'
  870.                lansrparms.j.2 = def.i.2
  871.             end
  872.       end 
  873.    end
  874.  
  875. /**********************/
  876. /* Create output file */
  877. /**********************/
  878.  
  879.    rc = SysFileDelete(outfilename)
  880.    if (rc = 0) then
  881.        say '   Deleted old file.'
  882.  
  883.    rc = stream(outfilename, 'c', 'open')
  884.    if ((substr(rc,1,5) = 'ERROR') | (substr(rc,1,8) = 'NOTREADY')) then
  885.       do
  886.          say 'ERROR:  Could not open file ' || outfilename || '.'
  887.          say '   Check your migration path and retry.'
  888.          exitrc = 6
  889.       end
  890.    else
  891.    do
  892.  
  893.    do i = 0 to 30
  894.       outline = insert(node.i.2,node.i.1,18)
  895.       rc = lineout(outfilename,outline)
  896.    end
  897.  
  898.    do i = 1 to emdftSessTotal
  899.       rc = lineout(outfilename,' ')
  900.       do j = 0 to 7
  901.          outline = insert(emdft.j.2.i,emdft.j.1.i,18)
  902.          rc = lineout(outfilename,outline)
  903.       end
  904.    end
  905.  
  906.    do i = 1 to emnondftSessTotal
  907.       rc = lineout(outfilename,' ')
  908.       do j = 0 to 10
  909.          outline = insert(emnondft.j.2.i,emnondft.j.1.i,18)
  910.          rc = lineout(outfilename,outline)
  911.       end
  912.    end
  913.    
  914.    if (dftadapterBool = true) then
  915.       do
  916.          rc = lineout(outfilename,' ')
  917.          do j = 0 to 2
  918.             outline = insert(dftadapter.j.2,dftadapter.j.1,18)
  919.             rc = lineout(outfilename,outline)
  920.          end
  921.       end
  922.  
  923.    if (lanadapterBool = true) then
  924.       do
  925.          rc = lineout(outfilename,' ')
  926.          do j = 0 to 8
  927.             outline = insert(lanadapter.j.2,lanadapter.j.1,18)
  928.             rc = lineout(outfilename,outline)
  929.          end
  930.       end
  931.  
  932.    if (lanBool = true) then
  933.       do
  934.          rc = lineout(outfilename,' ')
  935.          do j = 0 to 4
  936.             outline = insert(lansrparms.j.2,lansrparms.j.1,18)
  937.             rc = lineout(outfilename,outline)
  938.          end
  939.       end
  940.  
  941.    rc = lineout(outfilename,' ')
  942.    rc = lineout(outfilename,'*ENDPARMS*')
  943.    rc = stream(outfilename, 'c', 'close')
  944.  
  945.    end
  946. end
  947.  
  948. exit exitrc
  949.