PPWIZARD is a free preprocessor for HTML, REXX, Visual Basic or any text files.
[Bottom][Contents][Search][Prev]: #MacroSpace[Next]: #OnExit
\ -> Commands -> #NextId


The #NextId command is designed to make it easy for you to generate code (for example rexx) with global variable names (rexx or ppwizard variables) that will not clash with others of the same name. It does this by creating a unique namespace which exists up until the next #NextId command changes it.

For example you may have a global variable called "string", it may be used in a number of locations (including called subroutines), if no care is taken you may "corrupt" the value. Now in rexx you could use the "procedure" command however there are reasons why you would not want to use it. This command allows you to call the variable by the name "@@string" and have the '@@' (or whatever characters you choose) replaced with a unique identifier. Other parts of your code might also refer to "@@string" however the "@@" would be replaced by a different prefix.

Note that there is only ever one ID in use at any time. Apart from the obvious use of having short unique variable names without risk of clashing with those defined elsewhere in your code you can also protect yourself from clashing with variables that ppwizard uses.


[WhiteSpace]#NextId  ON   | OFF
[WhiteSpace]#NextId  PUSH | POP
[WhiteSpace]#NextId  REPLACE ["]Parm["] | MASK ["]Parm["]
[WhiteSpace]#NextId  LOCK ["]Key["] | UNLOCK ["]Key["]
[WhiteSpace]#NextId  CHARS ["]CharsFirst["] ["]CharsRest["]

If no parameters are supplied then NextId processing is turned on (if off) and the next id (new namespace) is chosen.

If parameters are supplied then the first (possibly only) parameter is a command, valid commands are:

Example #1

The following shows some rexx fragments where I am using Next ID processing to ensure that each routine has its own variables (which other routines don't also use).

   #define @@FRED ...
   parse arg @@Parm1, @@Parm2
   @@Result = Function1(1, 2)
   return(@@Result || @@Parm1 || <$@@FRED>)

   #define @@FRED ...
   parse arg @@Parm1, @@Parm2
   @@Result = ...

Note that the ppwizard variable "FRED" and the rexx variables "Parm1" and "Parm2" actually have different names between "function1" and "function2" and therefore do not overwrite each overs values.

Example #2

We need to keep some state information in a PPWIZARD macro:

#( '<?NewLine>'
   #define SelfRegister
   <$HereWeAre "{$?MacName} - {$#1} = {$SELFREG=^Y^}">
   #if ['{$SELFREG}' = 'N']
       #define+ @@SelfReg  false  ;;Want to remove self registration info
       #define+ @@SelfReg  true   ;;Want this filekey self registered
   OK = <$WiseObj>.SetFileSelfRegister("{$#1}", <$@@SelfReg>)

Another very common use is to define all rexx variables you might use in any rexx code your macros might call, this ensures they will not clash with those of other macros or those that PPWIZARD itself might use.

email me  any feedback, additional information or corrections.
See this page online (look for updates)

[Top][Contents][Search][Prev]: #MacroSpace[Next]: #OnExit

My whole website and this manual itself was developed using PPWIZARD (free preprocessor written by Dennis Bareis)
Saturday May 28 2022 at 2:55pm