TIP: Click on subject to list as thread! ANSI
echo: batpower
to: Richard Webb
from: Bob Ackley
date: 2009-04-06 06:41:44
subject: globally parse command line parameters

Replying to a message of Richard Webb to all:

 RW> Hello all!

 RW> TIme for another possibly elementary question.

 RW> I have a batch which I use to enter data into a file for
 RW> a radio network I manage.  MOst stations who report into
 RW> this network have a defined function or represent a defined
 RW> entity.

 RW> I've done a bunch of changes to how the monthly report of
 RW> this network's activity is submitted, allowing a batch file
 RW> to do it automagically at the first of the month if all days of
 RW> previous month are represented.

 RW> %1 is the only command line parameter that is going to have
 RW> anything consistent, and that's the call sign of the
 RW> operator who was the control station for the session being
 RW> entered.


 RW> There are eleven other "words" might be issued on the
 RW> command line, which would indicate any additional duties
 RW> performed by the control station.
 RW> NO controller will ever fill all eleven at once, not
 RW> possible  as many are geographically referenced .

 RW> I know I can play the old game as in

 RW> if %1==n goto nov
 RW> if %1==p goto papa
 RW> if %1==q goto quebec
 RW> ....
 RW> You get the idea.

 RW> DO the whole list, then do the same for %2.  But that gets
 RW> rather long and cumbersome.

 RW> I'll first check to see if %9 was defined, then %8, etc.  sO we've got
 RW> that covered.  But, it would be nice if I could just define branches
 RW> if any other command line parm than %1 is defined.

 RW> HEre's a bit of an example to illustrate what I'm getting at if it
 RW> isn't clear from the above.

 RW> The name of this batch is cr.bat, short and sweet for
 RW> central area net report .

 RW> SO today my friend LEon will be the control station.  HE'll
 RW> also most likely handle a variety  of other functions.  fOr
 RW> example, he'll handle five.  so today my command line would
 RW> appear as
 RW> cr wb5zed n p q d 5

 RW> TOmorrow he'll again be control, but he won't handle as
 RW> many.

 RW> so you might see:

 RW> cr wb5zed d 5

 RW> After the command line is entered and return is pressed of
 RW> course we use HOrst's logecho to get a first line of a text
 RW> file that has a time and date stamp.

 RW> Now, for today when my buddy Leon was control we're wanting
 RW> a report output which looks like this.
 RW> *** text in parentheses not included in actual output.

 RW> wb5zed november (corresponds with n parm above)
 RW> wb5zed papa (corresponds with P comm line parm above)
 RW> wb5zed quebec (corresponds with q above)
 RW> wb5zed digital:  (corresponds with d parm above)
 RW> *wb5zed rn5:  (corresponds with 5 above)


 RW> TOmorrow Leon won't be handling all of those, so after
 RW> command line is processed we open our created file for
 RW> editing.  I'll know from the report LEon provided me which
 RW> stations handled the additional functions.

 RW> I just don't want to have to repeat those if %1== statements for %2
 RW> for the same values basically.

 RW> Any quick and dirty way to get around it?

 RW>  maybe shift?


 RW> I still want to make use of the parameter entered as %1
 RW> though.

If you were doing it in REXX this would be a piece of cake.  REXX
allows one to use the 'select' structure similar to that in 'C'.  Same
result, less typing.

It might even be possible to put one select structure in a loop and use the loop
counter to determine which input parameter one is looking at.

--- FleetStreet 1.19+
* Origin: Bob's Boneyard, Emerson, Iowa (1:300/3)
SEEN-BY: 10/1 3 34/999 120/228 123/500 128/2 140/1 222/2 226/0 249/303 250/306
SEEN-BY: 261/20 38 100 1381 1404 1406 1410 1418 266/1413 280/1027 320/119
SEEN-BY: 393/68 396/45 633/104 260 267 285 640/954 690/682 734 712/0 313 848
SEEN-BY: 800/432 801/161 189 2222/700 2320/100 105 200 2905/0
@PATH: 300/3 14/5 140/1 261/38 633/260 712/848 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.