HP 3000 Manuals

IPC Files [ HP Transact Reference Manual ] MPE/iX 5.0 Documentation


HP Transact Reference Manual

IPC Files 

If your Transact program is using IPC (message) files, it is important to
remember that one program can open a message file only for either reading
or writing, not for both.  Therefore, if two processes are reading and
writing to each other, two message files are needed.

The following example shows two programs, both accessing the same IPC
file called MSG1.  The first program uses the file for read only, and the
second for write only.  This message file was built outside of Transact
with the MPE BUILD command, for example:

          BUILD MSG1;MSG

The read program uses the GET statement instead of the FILE(READ)
statement, so that STATUS can be used to control error handling.  If
automatic error handling is used (such as no STATUS option), the program
aborts when it gets to the end of file.

     READ PROGRAM

          SYSTEM MSGR,FILE=MSG1(READ(OLD));

          DEFINE(ITEM) E X(256);

          LIST E,INIT;

          LOOP1:
          GET(SERIAL) MSG1,LIST=(E),STATUS;
          IF STATUS=-1 THEN
            DO
            END;       << END PROGRAM >>
            DOEND;
          DISPLAY;
          GO TO LOOP1;

     WRITE PROGRAM

          SYSTEM MSGW,FILE=MSG1(WRITE(OLD));

          DEFINE(ITEM) E X(256);

          LIST E,INIT;

          LOOP1:
          DATA E;
          FILE(WRITE) MSG1,LIST=(E);
          DISPLAY;
          GO TO LOOP1;



MPE/iX 5.0 Documentation