next step produces an error. The :IF/THEN , :ELSE , :ENDIF structure allows you to make a decision based on the JCW v alue following the :FTNXL job step. The system-de￿ned JCW that CI creates is called CIERROR . CI sets the JCW modi￿er to the last CI error n umber. Sometimes, CI aborts a job based on the v alue of the CIERROR modi￿er.

User-defined JCWs

User-de￿ned JCWs allo w you to supply input to programs b y using Command In terpreter (CI) and get status from programs that can be examined in CI. Characteristics of user-de￿ned JCWs include:

Available to each process in the same session or job. Have names di￿erent from JCW or CIERROR .

Are created and set in teractively with :SETJCW or programmatically with the PUTJCW intrinsic.

Can be examined interactively with :SHOWJCW or programmatically with the FINDJCW intrinsic.

MPE/iX does not examine user-de￿ned JCWs. The v alue of a user-de￿ned JCW has meaning only to the user. Keyw ords and de￿nitions assigned to the t ype and modi￿er can be iden tical to those assigned to system JCWs or di￿eren t. You determine what action to tak e based on your own de￿nitions.

Using a User-defined JCWThe following job shows an example of using a user-de￿ned JCW.

:JOB STUDENT.INTRO/PASSWORD :SETJCW UPDATE=OK

:RUN UPDATEDB

:IF UPDATE=OK THEN

:RUN REPORT

:ELSE

:SHOWJCW

:TELLOP REPORT NOT RUN

:TELLOP TOO MANY INPUT ERRORS :ENDIF

:EOJ

In this example, the job stream begins b y de￿ning and setting a user-de￿ned JCW called UPDATE to the value OK ( OK is the same as OK0 or 0). Running the program named UPDATEDB edits a database. If too man y errors occur, UPDATEDB changes the value of UPDATE by using the PUTJCW intrinsic. The :IF/THEN , :ELSE structure tests the v alue of UPDATE . If the program is successful (in other w ords, if there are not too man y errors), it runs another program called REPORT . If too many errors did occur in the UPDATEDB program, the job sho ws the JCW values, sends two messages to the console operator, and ends.

3-24 Program Development