HP 3000 Manuals

Lesson 2 Using Variables and Expressions [ Using the 900 Series HP 3000: Advanced Skills Module 7: Solutions Guide ] MPE/iX 5.0 Documentation


Using the 900 Series HP 3000: Advanced Skills Module 7: Solutions Guide

Lesson 2 Using Variables and Expressions 

Q 6-8                 The method of dereferencing used in the two ECHO
                      statements of the STATS command file is explicit 
                      dereferencing (exclamation points are used).

Q 6-9                 To give the three user-defined variables, USER,
                      GROUP, and ACCT, the same values as those currently
                      stored in the system-defined variables,
                      HPUSER,HPGROUP, and HPACCT, you would do the
                      following:

                      SETVAR USER, HPUSER
                      SETVAR GROUP, HPGROUP
                      SETVAR ACCT, HPACCT

Q 6-10                According to the IF-THEN statement in the STATS
                      file, the following messages are displayed in each
                      of the following situations:

                         a.  The current number of jobs is 10 and the job
                             limit is 12.
________________________________________________________________________
|                                                                      |
| ***APPROACHING JOB LIMIT --- STREAM JOB LATER***                     |
|                                                                      |
________________________________________________________________________

            

                         b.  The current number of jobs is 5 and the job
                             limit is 10.
________________________________________________________________________
|                                                                      |
| ***NUMBER OF JOBS IS STILL REASONABLE --- STREAM JOB NOW***          |
|                                                                      |
________________________________________________________________________

            

Exercise 6-2:  IF-THEN-ELSE Statement 

1.                    Your IF-THEN-ELSE statement should look like this:

                               IF HPSESCOUNT >= (HPSESLIMIT*3)/4 THEN
                                  SHOWVAR HPSESCOUNT
                                  SHOWVAR HPSESLIMIT
                                  ECHO ***TOO MANY PEOPLE ON SYSTEM --- LOG OFF NOW***
                               ELSE
                                  SHOWVAR HPSESCOUNT
                                  SHOWVAR HPSESLIMIT
                                  ECHO *** CURRENT SESSION LIMIT NOT EXCEEDED ***
                               ENDIF

****************** End of Exercise 6-2 ************* 

Q 6-11                As long as you respond with anything other than //,
                      you will be prompted continually for file names.

Q 6-12                To terminate being prompted for any more file
                      names, you must respond with //.

Exercise 6-3:  WHILE Loop 

   1.  Your CF command file should look like this:

            INPUT RESPONSE;PROMPT="Do you want to change the prompt? (Y or N): "
               IF RESPONSE = 'Y' THEN
                  SETVAR MYRESP 'N'
                  WHILE MYRESP = 'N' DO
                      INPUT HPPROMPT;PROMPT="Enter your new prompt (10 char. max): "
                      ECHO !HPPROMPT
                      INPUT MYRESP;PROMPT="Is this prompt OK? (Y or N): "
                  ENDWHILE
               ELSE
                  ECHO Current prompt remains in effect !HPPROMPT
            DELETEVAR RESPONSE,MYRESP

   2.  When you enter your final prompt, this prompt should be displayed:

       USERx:

   3.  Use this command to change HPPROMPT to the initial system prompt:
________________________________________________________________________
|                                                                      |
| SETVAR HPPROMPT,":"                                                  |
|                                                                      |
________________________________________________________________________

            

************ End of Exercise 6-3 ************ 



MPE/iX 5.0 Documentation