HP3000-L Archives

October 1997, Week 3

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Glenn Cole <[log in to unmask]>
Reply To:
Date:
Thu, 16 Oct 1997 16:57:01 -0700
Content-Type:
text/plain
Parts/Attachments:
Re: (67 lines)
Roger Smith wrote:
> We have purchased Netbase (demo period) from Quest Software.  Netbase
> creates a MSG file for changes to one of our datasets.  We have another
> program that is supposed to read the MSG file and pass the information
> to an Oracle database on the HP9000. I understand that both programs
> should read and write to the MSG file (until physically terminated).
> Netbase does this OK, but the script reading the MSG file reads through
> the file one time and then pauses.  This is OK.  However, the next time
> that Netbase writes to the MSG file, the script terminates without doing
> another read.

Then [log in to unmask] followed with:
> We wrote such a job, one that would read a message file and take action on
> the records that were written to it. Same problem occurred, the command
> script would work the first time, then terminate. The solution was to
> create a third process that kept the message file open for writing (and did
> nothing else). This allowed the first write process to open and close the
> message file as needed.

Certainly, that would work.

If Roger's script is home-grown, then calling FCONTROL mode 45 will work
as well. Don't worry if FOPEN was is not called explicitly. If the program
is in COBOL, you can use something like:

        OPEN INPUT  MSG-FILE

        CALL INTRINSIC "FCONTROL" USING \MSG-FILE\
                                        45
                                        1.

(You'll likely want to create imaginative names to eliminate the
"magic numbers" in your code. :)

From the Intrinsics manual:

        "[This] permits a reader to wait on an empty [message] file
         that is not currently opened by any writer, or a writer to
         wait on a full file that has no reader."

Of course, since this reader program now has no signal to end (it will
never hit EOF), you'll need to come up with something on your own.
After all, you don't want to abort it when it's in the middle of a
transaction. And how do you know if it is or not?

One idea is to check for "magic" values from the message file. For
example, if it sees "**EXIT" then it can quit. "**STATUS" may display
a count of how many transactions it has done in the entire run, and
how many since you last asked. (Printing the date/time stamp is handy
as well.) Since it is easy to read the $STDLIST of an active job these
days (remember, it wasn't always so!), this lets you see how things are
going.

You can use a set of command files to write these "magic" commands to
the message file. Fcopy can work, but it's a pretty big program to
launch just for this. Echo works well; you just have to specify that
you're writing to an existing file, e.g.,

        file mymsg, old; dev=disc
        echo **EXIT     > *mymsg

FWIW.

--Glenn Cole
  Software al dente, Inc.
  [log in to unmask]

ATOM RSS1 RSS2