Go to:  Davar site entry | Site contents | Site index | Personal computer | 4DOS | Text bottom

GENER  4DOS  Batch  Command

GENER batch command sets ON or OFF value to environment variable TR.

Normally every batch command starts with "@ECHO  OFF" to suppress batch tracing.  When it is necessary to release tracing, OFF can be changed temporarily to ON, and then back to OFF, after debugging is over.

This process quickly becomes annoying when several linked batch commands are involved in processing.  There is an old technique, to start every batch command with "@ECHO  %TR%", which gives the ability to switch tracing OFF/ON easily by setting an appropriate value to the TR environment variable ("SET  TR=ON" or "SET  TR=OFF").

TR command used with the appropriate parameter can simplify this setting procedure (if parameter is omitted, tracing mode is toggled from the current one).

Demo of GENER command operation can be found below the command text.

Note: AUTOEXEC.BAT or AUTOEXEC.NT should contain command "SET TR=OFF"  Tracing is OFF.



:  GENER  Genertional File Management  12/01/1994-10/15/1998
:  ---------------------------------------------------------
:  Copyright (C) 1994-1999 by Vladimir Veytsel


:  1.  Generational file path (NB:   Close by "\";  E.g.:   A:\  or  A:\BATCH\)
:     "?"    - Display  batch command text (Equivalent:  "/")
:  2.  Generational file name base - i.e.  without generation number
:     (Generation names would be -    E.g.:  SYNC-3)
:      or  for names longer than 6, E.g.:  CONSULT5)
:  3.  Generational file extension
:  4.  Maximum generation number (Default:  9, 1-9)
:     (Maximum generation number is enforced within 1-9 range)

:     Pushes files from Max gener to 0 making space for Max generation filling
:     E.g.:   0 1 2 3 4 5  Source generational structure
:             / / / / /   Pushed from 1 through 5 (original 0 is lost)
:            0 1 2 3 4    New structure with gener # 5 available for filling

:     E.g.:   CALL GENER C:,SYNC,ZIP
:            PKZIP -bC:  -aopr C:\SYNC-9 A:\*.*

:            CALL GENER D:\BOYAN\UP-DOWN,CONSULT,PTR,5
:            REN CONSULT.PTR CONSULT5.*

@ECHO %TR%

 IF %1.==/.  .OR.  %1.==?.  (LIST %_BATCHNAME ^ QUIT)

 SET MX=%4 ^ IF %MX%.==.  .OR.  %MX% GT 9 SET MX=9 ^ IF %MX% LT 1 SET MX=1
 SET NM=%2
 IFF %@LEN[%NM%] LT 7 THEN
     SET NM=%NM%-
 ELSE
     SET NM=%@SUBSTR[%NM%,0,7]
 ENDIFF

 IF EXIST %1%NM%?.%3 ATTRIB -RSH %1%NM%?.%3 /Q

 IF EXIST %1%NM%0.%3 DEL %1%NM%0.%3 /Q

 DO GN=1 TO 9
    IF EXIST %1%NM%%GN%.%3 REN %1%NM%%GN%.%3 %1%NM%%@EVAL[%GN% - 1].%3 /Q
    IF %MX%.==%GN%.  LEAVE
 ENDDO

 UNSET MX NM GN
  


Toggle current tracing mode (from OFF to ON).


   Tue  9/28/99 20:32  C:\> TR

   Batch command tracing mode is now ON

Toggle current tracing mode (from ON to OFF).


   Tue  9/28/99 20:33  C:\> TR

   IF %1.==/.  .OR.  %1.==?.  (LIST %_BATCHNAME ^ GOTO Finish)
   IF "%1"=="=" .OR.  %@UPPER[%1].==C.  GOTO Finish
   IF %1.==0.  .OR.  %@UPPER[%1].==OFF.  (SET TR=OFF ^ GOTO Finish)
   IF %1.==1.  .OR.  %@UPPER[%1].==ON.   (SET TR=ON  ^ GOTO Finish)
   IFF %TR%.==OFF.  THEN
   SET TR=OFF
   Batch command tracing mode is now OFF


View [and save] GENER.BTM text   (Use [Back] button or [Alt]+[CL] to return here)
Copyright © 19941999 by
Go to:  Davar site entry | Site contents | Site index | Personal computer | 4DOS | Text top
----------------------------------------------------------------------------- Fri 10/15/99 20:05 C:\> ECHO AAAAA > C:\TEST-0.TXT Fri 10/15/99 20:06 C:\> ECHO BBBBB > C:\TEST-1.TXT Fri 10/15/99 20:06 C:\> ECHO CCCCC > C:\TEST-2.TXT Fri 10/15/99 20:06 C:\> ECHO DDDDD > C:\TEST-3.TXT Fri 10/15/99 20:06 C:\> DIR C:\TEST-?.TXT Volume in drive C is unlabeled Serial number is 54BC:F68A Contents of c:\test-?.txt TEST-0.TXT 7 10/15/99 20:12 TEST-1.TXT 7 10/15/99 20:12 TEST-2.TXT 7 10/15/99 20:12 TEST-3.TXT 7 10/15/99 20:12 ----------------------------------------------------------------------------- Fri 10/15/99 20:06 C:\> GENER C:\,TEST,TXT,3 Fri 10/15/99 20:08 C:\> DIR C:\TEST-?.TXT Volume in drive C is unlabeled Serial number is 54BC:F68 Contents of c:\test-?.txt TEST-0.TXT 7 10/15/99 20:12 TEST-1.TXT 7 10/15/99 20:12 TEST-2.TXT 7 10/15/99 20:12 Fri 10/15/99 20:08 C:\> TYPE TEST-0.TXT BBBBB Fri 10/15/99 20:09 C:\> TYPE TEST-1.TXT CCCCC Fri 10/15/99 20:10 C:\> TYPE TEST-2.TXT DDDDD