Ibm Data Server DB2 Manuel d'utilisateur Page 240

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 298
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 239
226 DB2 Deployment Guide
Setting an exit code in the script is useful if this script will be invoked from
another script or from an application. In this case we must decide whether the
command shell where the script is executed should be terminated or not. We use
the /b option on the exit code to specify this.
򐂰 Apply the /b option to have the command shell continue running after the
script is done. The exit code is then stored in the errorlevel environment
variable
򐂰 Omit the /b option to terminate the command shell after the script is done. The
exit code will then be the process exit code of the command shell.
Example 5-8 Check the command line processor return code on Windows
REM Initialize the DB2 environment and call the command line processor
REM -------------------------------------------------------------------
set DB2CLP=**$$**
db2 -o- -l itsodb.log -f itsodb.ddl
REM ------------------------------------------
REM Example A
REM ------------------------------------------
if errorlevel == 4 exit /b 4
exit /b 0
REM ------------------------------------------
REM Example B
REM ------------------------------------------
db2 -o- -l createdb.log -s CREATE DB ITSO
if errorlevel == 8 exit /b 8
if errorlevel == 4 exit /b 4
exit /b 0
򐂰 Example A:
In this example we handle any return code greater than or equal to 4. That is,
we do not distinguish between a system error and DB2/SQL error. This is
equal to Example B for the UNIX script.
򐂰 Example B:
In this example we distinguish between a system error and a DB2/SQL error.
This is equal to Example C for the UNIX script.
Note: The statement if errorlevel == number evaluates to true if the return
code is equal to or greater than the number specified, which mean that you
have to check the values in descending order.
Vue de la page 239
1 2 ... 235 236 237 238 239 240 241 242 243 244 245 ... 297 298

Commentaires sur ces manuels

Pas de commentaire