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:
Reply To:
Date:
Fri, 17 Oct 1997 08:28:49 PST8
Content-Type:
text/plain
Parts/Attachments:
text/plain (82 lines)
Here is a third way of reading the message file.  This section of 'code'
comes from one of our production jobs:

  ...
  ...
setvar _done false
while not _done do
  setvar mpexfinfoany 1
  setvar hpautocont   true
  setjcw cserror 1
  input _text <*msg  >*msg
  echo @ !hptimef : ![rtrim(_text)] :
  setvar _codes RTRIM(STR(_text,28,4))
  setvar _pfile RTRIM(STR(_text,33,36))
  setvar _done _codes = "!tlm_stop_cmnd"
  if not _done then
  ...
  ...

In the 'input' statement above the CI opens the message file for I/O.

Regards

Paul H. Christidis

endwhile


______________________________ Reply Separator _________________________________
Subject: Re: Reading a MSG file.
Author:  Jeff Vance <[log in to unmask]> at CCGATE
Date:    10/16/97 08:09 PM


...
> >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.

There have already been a couple of good suggestions.  FWIW: the CI
opens and closes the file (any file) each time IO redirection is used.
This means how you write your script may have an impact.  There are two
common ways to read a MSG file from the CI:

1) redirect the INPUT command, eg:

   while FINFO('*MSGfile',eof') <> 0 do
      INPUT var_buffer <*MSGfile
      ...
   endwhile


2) redirect the script doing the reading, eg:

  PARM ... entry=main
  if '!entry' = 'main' then
     ...
     # execute this script (hpfile) with input redirected from MSG file
     xeq !HPFILE entry=readit <*MSGfile
     ...
  elseif '!entry' = 'readit' then
     # input redirected from MSGfile
     while FINFO('*MSGfile','eof') <> 0
        INPUT var_buffer
        ...
     endwhile
   endif

Note: I didn't test these script fragments so I'm not positive about the
FINFO line.

If you are reading an N record MSG file the first approach opens and closes
the file N times.  The second method opens/closes it once.

regards,
Jeff Vance, CSY

--

ATOM RSS1 RSS2