[an error occurred while processing this directive]
Software  >  OpenVMS Systems > Documentation > 731final > 6489 > hanzi

HP OpenVMS Systems Documentation

Content starts here

OpenVMS �û��ֲ�


ǰҳ Ŀ¼ ����

  1. ���� CONTEXT ��ʼ��Ϊһ����ֵ��������Ž����� F$PID �������һ�����̱�ʶ�����б���
  2. ����д����ʾ�ı��⡣
  3. ����ȡ�õ�һ�����̱�ʶ (PID) ���������ǰ����ȱ�����ȫ���û���Ȩ����ô�ͷ��ص�ǰ���̵� PID ���������ǰ����������Ȩ����ô�ͷ������б��еĵ�һ�� PID ���������ǰ������ȫ���û���Ȩ���ͷ���ϵͳ�б��еĵ�һ�� PID �������������˳�����������һ�� PID ����ֱ���������һ�� PID ��������һ���ϣ�����һ���մ���Ȼ����̷�֧��ĩ�ˡ�
  4. ����ʹ�� F$GETJPI �ʷ��������ÿ�� PID ����ӳ���ļ�˵����F$PARSE ������ F$GETJPI �������ص�˵���г�ȡ�ļ�����
  5. ����ʹ�� F$GETJPI �������ÿ�� PID �����ն�����F$EXTRACT ������ȡ F$GETJPI(PID,"MODE") ���ص� MODE ˵����ǰ 3 ���ַ�ȷ�����̵����͡��ٴ�ʹ�� F$GETJPI ����ȷ�������Ƿ����ӽ��̡�
  6. ����Ϊ���ص�ÿ�� PID ��ʹ�� F$GETJPI �ʷ���������û��� ��������������״̬���������ȼ��ͽ��̻����ȼ���F$FAO �ʷ�������ʽ�������Ϣ������Ļ��ʾ��

ִ�� SYS.COM ������̵�����


$ @SYS


   PID    Username    Term    Process name   State   Pri Image
00050011  NETNONPRIV   -NET-   MAIL_14411      LEF    9/4 MAIL
00040013  STOVE        RTA6:   STOVE           LEF    9/4
00140015  MAROT        -DET-   DMFB0ACP        HIB    9/8 F11BAC
00080016  THOMPSON     -DET-   MTA0ACP         HIB   12/8 MTAAACP
00070017  JUHLES       TTF1:   JUHLES          LEF    9/4
   .
   .
   .
00040018  MARCO        TTA2:   MARCO           HIB    9/4 RTPAD
0018001A  VERN         RTA3:   VERN            LEF    9/4
0033001B  YISHA        RTA7:   YISHA           CUR    4/4
0002004A  SYSTEM       -DET-   ERRFMT          HIB   12/7 ERRFMT

������̷���ϵͳ�����н��̵���Ϣ����ǰ������ȫ���û���Ȩ��

B.5 GETPARMS.COM �������

���������̷��ش��ݸ����̵IJ�����Ŀ�����Դ���һ�����̵��� GETPARMS.COM ȷ���ж��ٲ������ݸ����ù��̡�

����: GETPARMS.COM


$ ! Procedure to count the number of parameters passed to a command
$ ! procedure.  This number is returned as the global symbol PARMCOUNT.
$ !
$ SAVE_VERIFY_IMAGE = F$ENVIRONMENT("VERIFY_IMAGE")        (1)
$ SAVE_VERIFY_PROCEDURE = F$VERIFY(0)
$ !
$ IF P1 .EQS. "?" THEN GOTO TELL                           (2)
$ !
$ ! Loop to count the number of parameters passed.  Null parameters are
$ ! counted until the last non-null parameter is passed.
$ !
$       COUNT = 0                                          (3)
$       LASTNONNULL = 0
$ LOOP:
$       IF COUNT .EQ. 8 THEN GOTO END_COUNT
$       COUNT = COUNT + 1
$       IF P'COUNT' .NES. "" THEN LASTNONNULL = COUNT
$ GOTO LOOP
$ !
$ END_COUNT:                                               (4)
$ !
$ ! Place the number of non-null parameters passed into PARMCOUNT.
$ !
$ PARMCOUNT == LASTNONNULL
$ !
$ ! Restore verification setting, if it was on, before exiting
$ !                                                             (5)
$ SAVE_VERIFY_PROCEDURE = F$VERIFY(SAVE_VERIFY_PROCEDURE,SAVE_VERIFY_IMAGE)
$ EXIT
$ !
$ TELL:                                                    (6)
$ TYPE SYS$INPUT
        This procedure counts the number of parameters passed to
        another procedure.  This procedure can be called by entering
        the following string in any procedure:

             @GETPARMS 'P1 'P2 'P3 'P4 'P5 'P6 'P7 'P8

        On  return,  the  global  symbol  PARMCOUNT
        contains the number of parameters passed to the procedure.
$ !
$ EXIT

GETPARMS.COM ���������ע��

  1. ��ͣ��У��֮ǰ�����̱��浱ǰ��ӳ��͹���У�����á�
  2. ���һ���ʺ��ַ���Ϊ�������ݵ����̣���ô���̷�֧����� TELL (ע�� 6)��
  3. ����ѭ�����������ݸ����̵IJ�����Ŀ���ڽ���ѭ��֮ǰ�������� COUNT �� LASTNONNULL ��ʼ��Ϊ 0����ѭ���ڣ�COUNT ����������ֵ 8 ���бȽϲ��ԡ���� COUNT ���� 8����ô����������������Ŀ��ÿ�δ��ݷǿղ���ʱ��LASTNONNULL ���ڲ�������Ŀ��
    IF ����ÿ��ִ��ʱ������ COUNT �в�ͬ��ֵ����һ�Σ�COUNT ֵ�� 1 �� IF ������ P1���ڶ��Σ������ P2���Դ����ơ�
  4. �����������ﵽ 8�����̷�֧�� END_COUNT������ LASTNONNULL ������󴫵ݵķǿղ����ļ��������ֵ������ȫ�ַ��� PARMCOUNT��PARMCOUNT �����Ѷ���Ϊһ��ȫ�ַ��ţ��Ա�����ֵ�����ڵ���������ԡ�
  5. �ָ�ԭʼ��У�����á�
  6. �ڱ�� TELL��TYPE ������ʾ���������������ݡ�(�������������У����������������������ļ���) TYPE ������ʾ���ʹ�� GETPARMS.COM ��ָ�

ִ�� GETPARMS.COM ������̵�����

���� SORTFILES.COM ��Ҫ�û����������ǿղ�����SORTFILES.COM ���̿��԰���������:


$ @GETPARMS 'P1' 'P2' 'P3' 'P4' 'P5' 'P6' 'P7' 'P8'
$ IF PARMCOUNT .NE. 3 THEN GOTO NOT_ENOUGH
   .
   .
   .
$NOT_ENOUGH:
$ WRITE SYS$OUTPUT -
"Three non-null parameters required.  Type SORTFILES HELP for info."
$ EXIT T

���� SORTFILES.COM ���Ե�������:


$ @SORTFILES DEF 4
Three non-null parameters required. Type SORTFILE HELP for info.

Ҫǡ���ص���������� --- �����ݸ� SORTFILES �IJ���Ҫԭ�����ݸ� GETPARMS ���� --- ���� P1 �� P8 �������뵥�����ڡ�

��� GETPARMS �ķ���ֵ���� 3����ô SORTFILES ���һ��������Ϣ���˳���

B.6 EDITALL.COM �������

���������̵��� EDT �༭�����ظ��ر༭һ���ͬ���ļ����͵��ļ����������˵�����ʹ�ôʷ������Ӱ�������г�ȡ�ļ�������Ҳ˵�������������Ϊ�����õij������¶����������ķ�����

����: EDITALL.COM


$ ! Procedure to edit all files in a directory with a
$ ! specified file type. Use P1 to indicate the file type.
$ !
$ ON CONTROL_Y THEN GOTO DONE           ! Ctrl/Y action    (1)
$ ON ERROR THEN GOTO DONE
$ !
$ ! Check for file type parameter.  If one was entered, continue;
$ ! otherwise, prompt for a parameter.
$ !
$ IF P1 .NES. "" THEN GOTO OKAY                            (2)
$ INQUIRE P1 "Enter file type of files to edit"
$ !
$ ! List all files with the specified file type and write the DIRECTORY
$ ! output to a file named DIRECT.OUT
$ !
$ OKAY:
$ DIRECTORY/VERSIONS=1/COLUMNS=1 -                         (3)
         /NODATE/NOSIZE -
         /NOHEADING/NOTRAILING -
         /OUTPUT=DIRECT.OUT *.'P1'
$ IF .NOT. $STATUS THEN GOTO ERROR_SEC                     (4)
$ !
$ OPEN/READ/ERROR=ERROR_SEC DIRFILE DIRECT.OUT             (5)
$ !
$ ! Loop to read directory file
$ !
$ NEWLINE:                                                 (6)
$        READ/END=DONE DIRFILE NAME
$        DEFINE/USER_MODE SYS$INPUT SYS$COMMAND:   ! Redefine SYS$INPUT
$        EDIT 'NAME'                               ! Edit the file
$        GOTO NEWLINE
$ !
$ DONE:                                                    (7)
$        CLOSE DIRFILE/ERROR=NOTOPEN               ! Close the file
$ NOTOPEN:
$        DELETE DIRECT.OUT;*                       ! Delete temp file
$ EXIT
$ !
$ ERROR_SEC:
$        WRITE SYS$OUTPUT "Error:  ",F$MESSAGE($STATUS)
$        DELETE DIRECT.OUT;*
$ EXIT

EDITALL.COM ���������ע��

  1. ON ���������������̵������������ִ����������ڼ���κ�ʱ���� Ctrl/Y�����̾ͷ�֧����� DONE��ͬ������������κγ��������س�������ô���̾ͷ�֧����� DONE��
  2. ���̼������Ƿ����롣���û�У����̾���ʾ�����ļ����͡�
  3. DIRECTORY �����г��� P1 ָ�����ļ����͵������ļ����������д�뵽�ļ� DIRECT.OUT��/VERSIONS=1 �޶�������ֻ�г�ÿ���ļ�����߰汾��/NOHEADING �� /NOTRAILING �޶���������������������л�Ŀ¼��Ҫ��/COLUMNS=1 �޶���ȷ��ÿ����¼����һ���ļ�����
  4. ͨ������ $STATUS ��ֵ��IF ������ DIRECTORY ����ķ���ֵ����� DIRECTORY ����û�гɹ���ɣ���ô $STATUS ��ż��ֵ�����ҹ��̷�֧����� ERROR_SEC��
  5. OPEN �����Ŀ¼����ļ�����Ϊ�������߼��� DIRFILE��
  6. READ ����� DIRECTORY ���������ȡһ�У���д����� NAME��������ȡÿ��֮�󣬹���ʹ�� DEFINE ����ѱ༭�Ի��ڵ������� (SYS$INPUT) ���¶��嵽�նˡ�Ȼ�������ñ༭����ָ��������Ϊ�ļ�˵�������༭�Ի������ʱ��������ͳ����ȡ������̵���һ�У����ҷ�֧����� NEWLINE�������̱༭��Ŀ¼��ָ���ļ����͵������ļ�֮������֧����� DONE��
  7. ��� DONE �� READ ����� /END �޶��ʵ�Ŀ���ţ����� ON CONTROL_Y �� ON ERROR ������Ŀ�����ڹ��̵Ŀ�ʼ���á����������ϣ�����ִ�б�Ҫ�����������
    CLOSE ����ر� DIRECTORY ���������ļ���/ERROR �޶��� �ѱ��ָ�����ļ�����һ�С�/ERROR �����ʹ�ý�ȡ�����Ŀ¼�ļ�û�д򿪶���ʾ���κγ�����Ϣ�����磬�����Ŀ¼�ļ���֮ǰ���� Ctrl/Y����ô�������������Ρ�
    ����ĵڶ�����ɾ����ʱĿ¼�ļ���

ִ�� EDITALL.COM ������̵�����


$  @EDITALL DAT
*  .
   .
   .
%DELETE-I-FILDEL, device:[directory]DIRECT.OUT;1 deleted (x blocks)

���� EDITALL ����ʱ��P1 ָ��Ϊ .DAT�����̽���һ��Ŀ¼���г���Ĭ��Ŀ¼�����ļ������� .DAT �������ļ������ҵ��ñ༭����༭ÿһ��������ɱ༭��� һ�����ļ����� .DAT ���ļ�֮�󣬹���ɾ����ʱ�ļ� DIRECT.OUT�������ն�����ʾ֪ͨ��Ϣ��

B.7 MAILEDIT.COM �������

������������ Mail ���ó����е����ı��༭����

����: MAILEDIT.COM


$ ! Command procedure to invoke an editor for Mail.
$ !
$ ! Inputs:
$ !
$ ! P1 = Input file name.
$ ! P2 = Output file name.
$ !
$ ! If MAIL$EDIT is undefined, Mail will invoke the user's selected
$ ! callable editor set by the mail SET EDITOR command.
$ !
$ ! If MAIL$EDIT is defined to be a command procedure, Mail will create
$ ! a subprocess to edit the mail, but any SET EDITOR command in Mail
$ ! will override the definition of MAIL$EDIT for the remainder of that
$ ! Mail session.
$ !
$ ! Note that this procedure is run in the context of a subprocess.
$ ! LOGIN.COM is not executed.  However, all process logical names
$ ! and DCL global symbols are copied.  In particular, note that the
$ ! user's individual definition of the symbol EDIT is used if there
$ ! is one. Otherwise, the system default editor is used.
$ !
$ ! The default directory is the same as the parent process
$ !
$ DEFINE /USER SYS$INPUT 'F$TRNLNM("SYS$OUTPUT")'     (1)
$ IF P1 .EQS. "" THEN GOTO NOINPUT       (2)
$ EDIT /OUTPUT='P2' 'P1'       (3)
$ EXIT
$NOINPUT:
$ EDIT 'P2'         (4)
$ EXIT

MAILEDIT.COM ���������ע��

  1. DEFINE ���������༭��������������նˣ����������ļ���
  2. IF �������༭��ͬ���ļ��ͱ༭ͬ���ļ���
  3. ��� EDIT ��������������ļ������ñ༭���������Ա༭�����Ե������Լ��ı༭��������:


          $ RUN XYZ_EDITOR.EXE /INPUT= 'P1' /OUTPUT='P2'
    
  4. ��� EDIT ����������ļ������ñ༭���������Ա༭�����Ե������Լ��ı༭��������:


          $ RUN XYZ_EDITOR.EXE /INPUT= 'P2' /OUTPUT='P2'
    

ִ�� MAILEDIT.COM ������̵�����


$DEFINE MAIL$EDIT MAILEDIT.COM
$MAIL
MAIL> SHOW EDITOR
Your editor is defined by the file MAILEDIT.COM.

B.8 FORTUSER.COM �������

�ṩһ��ϵͳ�����ע��������̵���������Ϊ�����������ִ�� FORTRAN ����Ľ����û������ն˻���������û�ע�ᵽһ����Լ���ʻ����ڴ� FORTUSER.COM ����Ϊע��������̣���ô����û�ֻ����ִ�� FORTUSER.COM ���ܵ�����������Ҳ˵�����ʹ�ôʷ���������ѡ�������һ����Ч����Ƚ��û���������

����: FORTUSER.COM


$ ! Procedure to create, compile, link, execute, and debug
$ ! FORTRAN programs.  Users can enter only the commands listed
$ ! in the symbol OPTION_TABLE.
$ SET NOCONTROL=Y                                          (1)
$ SAVE_VERIFY_IMAGE = F$ENVIRONMENT("VERIFY_IMAGE")
$ SAVE_VERIFY_PROCEDURE = F$VERIFY(0)
$ OPTION_TABLE = "EDIT/COMPILE/LINK/RUN/EXECUTE/DEBUG/PRINT/HELP/FILE/DONE/"  (2)
$ TYPE SYS$INPUT                                           (3)

        VMS FORTRAN Command Interpreter

        Enter name of file with which you would like to work.
$ !
$ ! Set up for initial prompt
$ !
$ PROMPT = "INIT"                                          (4)
$ GOTO HELP                      ! Print the initial help message
$ !
$ ! after the first prompting message, use the prompt: Command
$ !
$ INIT:
$ PROMPT = "GET_COMMAND"
$ GOTO FILE                      ! Get initial file name
$ !
$ ! Main command parsing routine.  The routine compares the current
$ ! command against the options in the option table.  When it finds
$ ! a match, it branches to the appropriate label.
$ !
$ GET_COMMAND:
$       ON CONTROL_Y THEN GOTO GET_COMMAND     ! Ctrl/Y resets prompt  (5)
$       SET CONTROL=Y
$       ON WARNING THEN GOTO GET_COMMAND       ! If any, reset prompt
$       INQUIRE COMMAND "Command"
$       IF COMMAND .EQS. "" THEN GOTO GET_COMMAND
$       IF F$LOCATE(COMMAND + "/", OPTION_TABLE) .EQ. F$LENGTH(OPTION_TABLE) - (6)
               THEN GOTO INVALID_COMMAND
$       GOTO 'COMMAND'
$ !
$ INVALID_COMMAND:                                         (7)
$       WRITE SYS$OUTPUT " Invalid command"
$ !
$ HELP:                                                    (8)
$       TYPE SYS$INPUT
        The commands you can enter are:
        FILE      Name of FORTRAN program in your current
                  default directory.  Subsequent commands
                  process this file.
        EDIT      Edit the program.
        COMPILE   Compile the program with FORTRAN.
        LINK      Link the program to produce an executable image.
        RUN       Run the program's executable image.
        EXECUTE   Same function as COMPILE, LINK, and RUN.
        DEBUG     Run the program under control of the debugger.
        PRINT     Queue the most recent listing file for printing.
        DONE      Return to interactive command level.
        HELP      Print this help message.

        Enter Ctrl/Y to restart this session
$ GOTO 'PROMPT'                                            (9)
$ EDIT:                                                    (10)
$       DEFINE/USER_MODE SYS$INPUT SYS$COMMAND:
$       EDIT 'FILE_NAME'.FOR
$       GOTO GET_COMMAND
$ COMPILE:
$       FORTRAN 'FILE_NAME'/LIST/OBJECT/DEBUG
$       GOTO GET_COMMAND
$ LINK:
$       LINK 'FILE_NAME'/DEBUG
$       PURGE 'FILE_NAME'.*/KEEP=2
$       GOTO GET_COMMAND
$ RUN:
$       DEFINE/USER_MODE SYS$INPUT SYS$COMMAND:
$       RUN/NODEBUG 'FILE_NAME'
$       GOTO GET_COMMAND
$ DEBUG:
$       DEFINE/USER_MODE SYS$INPUT SYS$COMMAND:
$       RUN 'FILE_NAME'
$       GOTO GET_COMMAND
$ EXECUTE:
$       FORTRAN 'FILE_NAME'/LIST/OBJECT
$       LINK/DEBUG 'FILE_NAME'
$       PURGE 'FILE_NAME'.*/KEEP=2
$       RUN/NODEBUG 'FILE_NAME'
$       GOTO GET_COMMAND
$ PRINT:
$       PRINT 'FILE_NAME'
$       GOTO GET_COMMAND
$ BADFILE:                                                 (11)
$       WRITE SYS$OUTPUT "File must be in current default directory."
$ FILE:
$       INQUIRE FILE_NAME "File name"
$       IF FILE_NAME .EQS. "" THEN GOTO FILE
$       IF F$PARSE(FILE_NAME,,,"DIRECTORY") .NES. F$DIRECTORY() -  (12)
        THEN GOTO BADFILE
$       FILE_NAME = F$PARSE(FILE_NAME,,,"NAME")
$       GOTO GET_COMMAND
$ DONE:
$ EXIT

FORTUSER.COM ���������ע��

  1. SET NOCONTROL=Y ����ȷ����������̿����µ�ע���û������ж�������̻����е��κ��������� ��
  2. ��ѡ����г������û�ִ�е����ÿ��������б�ָܷ���
  3. �������뱾����
  4. �ڹ����з����� PROMPT �������ŵ�ֵ�����������������ʱ�����������ֵ INIT��HELP �����ı���ֹ��ָ����� PROMPT �� GOTO ���������ı���һ����ʾʱ��GOTO ����¿�����ת�Ƶ���� HELP������ʾ HELP ��Ϣ�����Ϳ�����������Ȼ�󣬹���ת�ƻر�� INIT���ڴ� PROMPT ��ֵ����Ϊ "GET_COMMAND"����󣬹���ת�Ƶ���� FILE ����ļ�������󣬵���ʾ�����ı�ʱ������ת�Ƶ���� GET_COMMAND ȥ�����һ�����
  5. Ctrl/Y ������������Ϊ���ص���� GET_COMMAND�� �����Ǿ�������������������ʾ��������Ҽ�����ʾ����ʹû�������κ��ַ���Ҫ��ֹ�Ի��ڲ����ص������������������ DONE��
  6. ����ʹ�� F$LOCATE �� F$LENGTH �ʷ�����ȷ�������Ƿ��������ѡ���б��С�F$LOCATE ���������û����������������һ��б�ܡ�(���磬������� EDIT�����̾����� EDIT/��) �������û�а�������ѡ���б��У���ô����ת�Ƶ���� INVALID_COMMAND�������������Ч�ģ����̾�ת�Ƶ��ʵ��ı�š�
  7. �ڱ�� INVALID_COMMAND������д�������Ϣ����ʾ�����ı����г���Ч�����
  8. �����ı��г���Ч ������������ʾ����ı������ۺ�ʱ�û����� HELP ������κ���Ч���Ҳ��ʾ����
  9. �������ı���������GOTO ����ָ�������� PROMPT����������̵�һ�ε���ʱ���÷�����ֵ INIT���������ֵ GET_COMMAND��
  10. �б��е�ÿ����Ч��������ѡ���������Ӧ����Ŀ���������������������Ӧ�ı�š����ڴ��ն˶�ȡ������������ EDIT�����̰���һ��������������Ϊ SYS$COMMAND �� DEFINE ���
  11. �ڱ�� BADFILE ����������ʾһ����Ϣ��ָ���ļ������ڵ�ǰĿ¼�С�Ȼ�������ʾ������һ���ļ�����
  12. �ڻ���ļ���֮�󣬹��̼����û��ָ��һ����ͬ�ڵ�ǰĬ��Ŀ¼��Ŀ¼��Ȼ�󣬹���ʹ�� F$PARSE ������ȡ�ļ�����(ÿ�������ṩ�ʵ���Ĭ���ļ����͡�) ��Σ�����ת�ƻر�� GET_COMMAND ȥ���һ����������ļ������

ִ�� FORTUSER.COM ������̵�����

��������˵����ΰ�����������������Լ���������:


Username: CLASS30
Password:

            OpenVMS Version 7.1

    OpenVMS FORTRAN Command Interpreter

    Enter name of file with which you would like to work.

    The commands you can enter are:

    FILE       Name of FORTRAN program in your current
               default directory.  Subsequent commands
               process this file.
    EDIT       Edit the program.
    COMPILE    Compile the program with VAX FORTRAN.
    LINK       Link the program to produce an executable image.
    RUN        Run the program's executable image.
    EXECUTE    Same function as COMPILE, LINK and RUN.
    DEBUG      Run the program under control of the debugger.
    PRINT      Queue the most recent listing file for printing.
    DONE       Return to interactive command level.
    HELP       Print this help message.

    Enter Ctrl/Y to restart this session
File name: AVERAGE
Command: COMPILE
Command: LINK
Command: RUN
Command: FILE
File name: READFILE
Command: EDIT

���ִ������˵��һ���Ի��ڣ������û� CLASS30 ע�ᵽ�� FORTUSER ������̿��Ƶ��ʻ���FORTUSER ���������ʾ�����û�ִ�е�����Լ�һ�����������Ի��ڵ�ָ�Ȼ���û�ָ���ļ� AVERAGE������ �����Ӻ���������Ȼ���û����� FILE ���ʼ������һ���ļ���


ǰҳ ��ҳ Ŀ¼ ����