You have a nice DB2 CLP prompt, looks like “db2>”, but you want more, you want a efficient prompt. It is possible with DB2 to add or modify your CLP ! DB2 have a registry variable named DB2_CLPPROMPT which allows us to define the prompt to be used in the CLP interactive mode.
To define this variable, let’s use the DB2set command:
Db2set DB2_CLPPROMPT="db2isgreat> "
Our new DB2 Prompt will be “db2isgreat> “. It’s much more better, but we can do more. DB2_CLPPROMPT registry variable can contain the tokens %n, %ia, %d, %da and %i:
- %n – New line
- %ia – Authorization ID of the current instance attachment
- %d – Local alias of the currently connected database
- %da – Authorization ID of the current database connection
- %i – Local alias of the currently attached instance
Now, let’s try with these tokens:
Db2set DB2_CLPPROMPT="%ia@%i, %da@%d> "
With an instance attachment to instance “DB2″ with authorization ID “mycado”. Database “sample” with authorization ID “mycadoax”, will return something like:
MYCADO@DB2, MYCADOAX@SAMPLE >
You can now everytime where you are, and one which instance/database you’re working on.