home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 17 Fixes30 / 17-Fixes30.zip / cs_140.exe / archctl.cmd next >
OS/2 REXX Batch file  |  1998-11-25  |  4KB  |  119 lines

  1. /****************************************************/
  2. /* Turn off Archiving for all products in a Fixpak. */
  3. /* Copyright IBM Corporation, 1998                  */
  4. /****************************************************/
  5. '@Echo off'
  6. ver='v1.0'
  7. Parse source whoami
  8. Parse value whoami with . . whoami
  9.  
  10. curdir=Directory()        /* remember where we are */
  11.  
  12. /***********************************/
  13. /* Register all REXXUTIL functions */
  14. /***********************************/
  15. rc=RxFuncAdd('SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs')
  16. If rc>1 then
  17.   Do
  18.     Say 'Unable to register REXXUTIL functions.'
  19.     Signal Done
  20.   End
  21. Call SysLoadFuncs
  22. Say Filespec('NAME',whoami) ver
  23. Say 'Copyright (c) IBM Corporation, 1998.'
  24.  
  25. Arg archive fixpak_source .
  26. If fixpak_source='' Then
  27.   Signal Tell
  28. If right(fixpak_source,1)='\' Then
  29.   fixpak_source=left(fixpak_source,length(fixpak_source)-1)
  30.  
  31. On='01'x
  32. Off='00'x
  33. signature='ffff'x||'SYSLEVEL'            /* Identifies a valid SRV_PROD file */
  34. src=fixpak_source||'\FIX\???.?'
  35. Call SysFileTree src,'dirs','DO'
  36. Say 'Product directories found in Fixpak:' dirs.0
  37. Do j=1 To dirs.0
  38.   Name=Filespec('NAME',dirs.j)
  39.   Parse Value Name With ext'.'.
  40.   srv_file=dirs.j||'\SRV_PROD.'||ext
  41.   If stream(srv_file,'C','Query Exists')='' Then
  42.     Do
  43.       Say 'No 'srv_file' found in 'dirs.j
  44.       Signal Done
  45.     End
  46.   /************************************/
  47.   /* Read in all of the SRV_PROD file */
  48.   /************************************/
  49.   size=stream(srv_file,'C','Query Size')
  50.   Call stream srv_file,'C','Open Read'
  51.   data=charin(srv_file,1,size)                      /* Read in all of file */
  52.   Call stream srv_file,'C','Close'
  53.   If substr(data,1,length(signature))<>signature Then       /* Valid file? */
  54.     Do
  55.       Say srv_file' is not a valid SRV_PROD file, does not start with ffffSYSLEVEL'
  56.       Signal Done
  57.     End
  58.   arch=substr(data,20,1)                                 /* Archive, 01=on */
  59.   Select
  60.   When archive='OFF' & arch=On Then               /* Turn off and it's on? */
  61.     Do
  62.       data=overlay(Off,data,20)                             /* Turn it off */
  63.       Call SysFileDelete(srv_file)                      /* Delete old file */
  64.       Call Stream srv_file,'C','Open Write'
  65.       Call Charout srv_file,data                          /* Write new one */
  66.       Call Stream srv_file,'C','Close'
  67.       Say 'Archiving turned OFF in' srv_file
  68.     End
  69.   When archive='OFF' & arch=Off Then          /* Turn off and already off? */
  70.     Say 'Archiving already OFF in 'srv_file
  71.   When archive='ON' & arch=Off Then               /* Turn on and it's off? */
  72.     Do
  73.       data=overlay(On,data,20)                               /* Turn it on */
  74.       Call SysFileDelete(srv_file)                      /* Delete old file */
  75.       Call Stream srv_file,'C','Open Write'
  76.       Call Charout srv_file,data                          /* Write new one */
  77.       Call Stream srv_file,'C','Close'
  78.       Say 'Archiving turned ON in' srv_file
  79.     End
  80.   Otherwise                                   /* Turn off and already off? */
  81.     Say 'Archiving already ON in 'srv_file
  82.   End
  83. End
  84.  
  85. /*******************************/
  86. /* Only exit from this program */
  87. /* Cleanup then exit           */
  88. /*******************************/
  89. Done:
  90. Call directory curdir    /* put us back where we started */
  91. Exit
  92.  
  93. /**************************************/
  94. /* Display help info for this program */
  95. /**************************************/
  96. Tell:
  97. Say 'Form: ARCHCTL ON|OFF fixpak_source'
  98. Say
  99. Say '"ON" or "OFF" - action to perform. ON enables Archiving, OFF disables it.'
  100. Say '"fixpak_source" will normally be the drive the first Fixpak diskette is in'
  101. Say 'but it could be the root of the Fixpak when copied to harddisk (where the'
  102. Say '\FIX subdirectory is located). Default for OS/2 Fixpaks is ON.'
  103. Say
  104. Say 'For OFF, will change the Archive bit (SRV_PROD byte 20) from 01 to 00'
  105. Say 'For ON, will change the Archive bit (SRV_PROD byte 20) from 00 to 01'
  106. Say
  107. Say 'Turn Archiving OFF Examples:'
  108. Say 'Place first Fixpak diskette in A:'
  109. Say '   enter ARCHCTL OFF A:'
  110. Say 'XCOPY all fixpak diskette data to a N:\FIXES\FP32'
  111. Say '    enter ARCHCTL OFF N:\FIXES\FP32'
  112. Say
  113. Say 'Turn Archiving ON Examples:'
  114. Say 'Place first Fixpak diskette in A:'
  115. Say '   enter ARCHCTL ON A:'
  116. Say 'XCOPY all fixpak diskette data to a N:\FIXES\FP32'
  117. Say '    enter ARCHCTL ON N:\FIXES\FP32'
  118. Signal Done
  119.