			~-
				- ~ Being of an inquisitive nature I ex
	PP.BAT			piored some of these questions. The
	ECIIO OFF			answer, in general, is that you cen
	CLS			have any number of recursive chains
	IF NOT %1@==@ GOTO %1			or calls, so long as memory and file
	ECHO Enter PP E for elite		PP P for pica	handles are avallable. If you are care-

	ECHO	PP W for wide	PP C for condensed	ful of counts and end conditions, you
	ECHO	PP B for BOLD	PP D for doublestrike	won't get in too much trouble. On
	ECHO	PP R to reset printer		the other hand, if one of these were
	CRLF			to run away. . .
	:E			To ease into this subject, we'll con-

	ECIIO lM [1^G ,PRN			sider recursive chaining first. Recur-
	CRLF			sive chaining is an alternative to SET
	:P			that initialises variables for further
	ECHO [P ~PRN			use by the program. The differe~nce is
	CRLF			that this way the program sets %1
	.			through %9, so an operation like
	.			SHIFT might be used against them.
	.			Nothing fancy is needed for recursive
	F'g 			~chaining. Consider a file called
				CHAI N.BAT:
	COMMAND ~GIZMO		on this are given bel~w.)	ECI1O OFF
	ECHO This line is agein		This call/return procedure can be	CLS
	from the main program.		nested to any depth that your mem-	IF %1@==(~? CHAIN 1 2 3 4 5 6 7 8 9

	This illustrates the general princi- ory allows, and you can play tricks			:DO
	ples. We cen vastly improve on this, with variables. Try these three batch			ECHO cDO SOMETHING WITH
	though. The special form: programs.			FILE%1>
	COMMANDIC strin3 MAIN.BAT			SHIFT
	says, in effect, to invoke a new com- ECHO OFF			IF NOT %1~==@ GOTO DO
	mand processor, feed it 'string' as an CLS			Here is a catalogue printer for your
	input command, execute the com- ECHO MAIN here. Are you watching?			hard disk. Your various subdirec-
	mand, then EXIT. If we feed a com- COMMAND/C SU8FILE1 file speak			tories are 'remembered' in the re-
	mand processor a betch file name, it sub %1 >NUL			cursive call staterrent.
	executes the batch file. Because of ECHO Whewf We made it back to			CAT.BAT
	this we can rename GIZMO to GlZ- MAIN again.			ECI1O OFF
	MO.BAT and drop the EXIT com- SUBFILE1.BAT			CLS
	mand from the end, thereby convert- ECHO This is %3%1 1 %2ing. ~CON			IF %1@==~? CAT DBASE LOTUS
	ing it into a plain vanilla batch file. COMMANDJC %3%12 %1 %2 %3			ORD WRK C

	Change DRIVE.BAT as follows:	%4		CDN
	ECHO OFF	ECHO Goodbye from %3%1	1.	DIR I SORT ~PRN
	CLS	~CO N		: LOO P
	ECHO Th is line is from	SUBFILE2.BAT		DIR \% ~ I SORT ~PRN
	the main program.	ECHO Now %3%1 2 %2s. >CON		FOR %%@ IN(SHIFT IF) DO %%@
	COMMANDIC GIZMO	IF NOT %4@==@ ECh10		NOT %1@==@ GOTO LOOP
	ECHO This line is agnin	What does "%4" mean? ~CON		CAT.BAT will print catalogues for

	from the main program.	Try launching this collection with		any arbitrary selection of directories

	This is almost the effect we want. 'MAIN' and 'MAIN AXOEOTL'.			if called like this:

	We are spared the installation mes- More practically, suppose I have a	CAT DIR1 DIR2 DIR3	.

	sage from the command processor, lot of programs to download from			Suppose you have a fite card
	but the secondary command proces- the mainframe with DLOAD.BAT.			ACTION.DATA which expects to find
	sor echoes everything. Even if you What I want are several members			data in the {orm of tokens in a file
	put ECHO OFF at the beginning of from eech of several partitioned			called DATA.BAT. Possibly DATA-
	GIZMO.BAT it will still echo the first datasets. This whole procedure			.BAT was generated by another prog-
	prompt and the ECHO OFF. If it is might take all nightÄI plan to sub-			ram which couid be another Ä or
	really important to silence every- mit a huge metabatch file when I go			even this Ä batch file. DATA.BAT

	thing, you can use redirection.	home in the evening. I can create a		contains a statement as follows
	Change the programs as follows:	driver for DLOAD.BAT and off we go:		ACTION DATA] DATA2 DATA3 . . .
	GIZMO.BAT:	COMMAND/C DLOAD BNW.TE.CLIST		ACTION.BAT starts as follows;
	VOL >CON	TECLIST M1 M2 M3 M4 		IF %~{~?==@ DATA
	ECHO This line from the	COMMAND/C DLOAD ~NW.TE.SAS		As we cen see, if ACTION.BAT is
	called file. >CON	TESAS M1 M2 M3 M4. 		called with no arguments, it will im-
	VER >CON	COMMAND/C DLOAD BNW.TE.		mediately chain to DATA.BAT which
	DRIVE.BAT:	TABLES		calls ACTION right back, passing

	ECHO OFF	TETABLES M1 M2 M3 M4 . 	DATA1' DATA2, DATA3 	to it as

	CLS	If nothing goes horribly wrong, I	%1, %2, %3
	ECI 10 This line from the	shouid return in the morning to find	So far I haven't been able to think
	original batch program	the selected members neatly copied	of something I needed to do with
	COMMAND/C GIZMO >NUL	into appropriate subdirectories.	betch processing that couidn't be
	ECh10 This line again from	.	done more easily some other way.
	the called program	áeCU\-SlOn	No doubt the Lisp-wallahs out there

The trick here is to send all output By now you may be saying 'All that will immediately think of several im-
from the secondary command pro- is very weil, but if a batch file can be portant applications. On the other
cessor into NUL. Then we override made to call another file, what wouid hand, this may be one of those case
this in the called batch file with re- happen if you asked it to call itself or which vividly illustrates the differ-
directions to CON for everything we maybe call another batch file that ence between what you get away
really want tQ see. (More examples called the first one, or maybe...' with and what's useful. ~3
,

Quelle unbekannt

%1,

