Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Name Pipe(Problem using MKNOD) 1

Status
Not open for further replies.

SiouxCityElvis

Programmer
Jun 6, 2003
228
US
I am running on AIX with RMCOBOL 85.
I went to the Liant website to get an example on how to use a name pipe. Eventually I will want to send data back and forth between my cobol programs and the Java programmer's programs.

But, I used an example from the Liant website to gain a grasp of how the name pipe works.

The first set of instructions were to:

/etc/mknod pipefile -p

but I always get a error message at my Unix prompt after attempting to create the pipefile that states:

Usage: mknod Name {b|c} Major Minor
mknod Name p

I did look up this on keyword search, but the existing thread does not answer my problem specifically.

Does anyone out there running on AIX get this problem as I do?

Thanks.
-David
 
I think you need to do:
Code:
mknod Name p

You don't need a hyphen on the 'p' (at least not on Linux).

If that works, I think I need to submit a defect report. [blush]

Tom Morrison
 
Okay, thanks.
Now, what Tom proposed using works, but as far as getting my "web server" to shutdown, no luck.

Here's what my application that reads the named pipe does:
FILE SECTION.
FD COMMAND-FILE.
01 COMMAND-LINE PIC X(8).
88 IS-SHUTDOWN VALUE "SHUTDOWN".

WORKING-STORAGE.

TEST-INPUT-PIPE.

OPEN INPUT COMMAND-FILE
READ COMMAND-FILE
NOT AT END
IF IS-SHUTDOWN
GO TO END-IT(closes all files, etc)
ELSE
DISPLAY "NOT SHUTDOWN"
END-IF
END-READ

OPEN INPUT PIPE-FILE.
READ PIPE-FILE
AT END
DISPLAY "AT END OF PIPE?" LINE 1 POSITION 1
NOT AT END
...do processing...
...
END-READ.
CLOSE PIPE-FILE.
GO TO TEST-INPUT-PIPE.

I've got this to work. I've tested that the "do processing" part occurs, by running two different "request" cobol applications against this "webserver" app.

The problem I have is when I go into the SHUTDOWN File and manually change the sequential file record in there from "RUN OFAC" to "SHUTDOWN", the IS-SHUTDOWN test doesn't catch it.

Is there a better way to interrupt my "server" here?
Thanks.
-David

 
A combination of two problems, suggested corrections in red:
Code:
  OPEN INPUT COMMAND-FILE  
  READ COMMAND-FILE
    NOT AT END
     IF IS-SHUTDOWN
       GO TO END-IT(closes all files, etc)
     ELSE
       DISPLAY "NOT SHUTDOWN"
    END-IF
Code:
    AT END
       do something
Code:
   END-READ
Code:
  CLOSE COMMAND-FILE
Code:
  OPEN INPUT PIPE-FILE.

Since you never close COMMAND-FILE, it never returns to the beginning of file, so unless the "SHUTDOWN" was there on the very first read you will never see it.



Tom Morrison
 
Also, unless you put in the call to C$DELAY (which you may have omitted from your sample code), this will hog the CPU.

Tom Morrison
 
Tom and others:

Actually I do have the CLOSE COMMAND-FILE there, I just forgot to put that above in my code snippet. Sorry about that.

I understand what you are saying about making sure to open and close on every iteration of my loop - in order to ensure I'm back at the beginning of the file.

That is what seems baffling to me - it does ensure that when I run two requests against it - 1 with a search query, and another with a different search query, the pipe is read each time. I've tested that and that part works great. After it reads the 2nd request, processes its query, etc. it will sit out there waiting for any more requests to come in. That works great as I've mentioned I've been able to have it process two separate requests.
The problem is, on each iteration, it should be checking that SHUTDOWN, but it will not catch it - I go to the SHUTDOWN sequential file and type in "SHUTDOWN" but to no avail.
-David
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top