Thanks guys.
I ended up using a file based on the calling shell's PID. It works but
thought there might be a more elegant solution.
----- Original Message -----
From: "Ken Wallis" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 22, 2004 10:10 PM
Subject: RE: [U2] [UD] Returning data to ksh
> Doyen Klein wrote:
>
> > You could at the start of the shell write an 'in-process flag' (simply
> > create file with a specific name).
> >
> > As the final step in the process, when completed
> > successfully, delete that file.
> > Then .....
> >
> > If [exists(file)] - you know the process failed.
>
> You could also look at it the other way round - rm -f a status file before
> you kick off the udt process, then afterwards, if the file exists and
> contains a good status code then all is well, otherwise it isn't.
Something
> a bit like this:
>
> #!/usr/bin/ksh
> # could try something clever to give you a unique temp file name here if
you
> like
> export STATFILE=/x/y/z
> rm -f $STATFILE
> udt <<!eof
> YOURCOMMANDSHERE
> WRITESTATUS
> quit
> !eof
> if [ -f $STATFILE ]
> then
> head -n 1 $STATFILE | read STAT ERRMSG
> else
> STAT=99
> ERRMSG="cannot find status file $STATFILE"
> fi
> if [ "$STAT" = "0" ]
> then
> # cool
> else
> # not cool
> echo $ERRMSG >&2
> exit $STAT
> fi
>
> And WRITESTATUS would be a cataloged program that might look like this:
>
> PROGRAM WRITESTATUS
> * maybe use the @USER... variables or your own specific named common to
keep
> track of things
> COMMON /STATCOM/ ERRSTAT, ERRMSG
> OSWRITE ERRSTAT:" ":ERRMSG TO GETENV("STATFILE") ON ERROR ABORT
> STOP
> END
>
> HTH,
>
> Ken
>
> > Ralph Melia wrote:
>
> > I'm working on a project that involves integrating our (UD 5.2 on AIX)
> > programs into a job stream via ksh scripts. And I need a way of
> > communicating back to the calling shell whether the unidata process
> > (program) completed successfully or not. The relevant part of
> > the shell would look something like:
> >
> > $UDTBIN/udt program parameters
> >
> > if [ it failed ]; then do something
> >
> >
> > I'm thinking that there must be a simple solution, but I'm
> > drawing a blank.
> -------
> u2-users mailing list
> [EMAIL PROTECTED]
> To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/