SiouxCityElvis
Programmer
I have a COBOL program that acts as a server in which it reads a pipe file for requests.
It calls other programs depending on what type of request it is.
I'm working on handling the request, kicking off another cobol program to process the request.
What I need to do, is
OPEN INPUT PIPE-FILE ASSIGN TO "NAMEDPIPE"
ORGANIZATION IS LINE SEQUENTIAL.
Later in my procedure code I have a loop that handles the requests.
PERFORM UNTIL
...
OPEN INPUT PIPE-FILE
READ PIPE-FILE-REC NEXT RECORD
AT END
....Go to end subroutine ...
NOT AT END
IF REQUEST-TYPE = "O"
CLOSE PIPE-FILE
CALL "OTHERPGM.COB" USING .....
...
...
DISPLAY "ARE WE BACK YET FROM CALLED PGM??"
LINE 10 POSITION 1
END-IF
END-PERFORM
Then, in my OTHERPGM.COB
I try to Open the Pipe file for OUTPUT! For some reason, it does not like it. Here's what happens...
PROCEDURE DIVISION.
...
...
..processing code for query request form calling program
DISPLAY "HERE YET???" LINE 10 POSITION 1.
ACCEPT WS-PROMPT LINE 11 POSITION 1.
OPEN OUTPUT PIPE-FILE.
DISPLAY "WRITING TO PIPE-FILE" LINE 12 POSITION 1.
ACCEPT WS-PROMPT LINE 13 POSITION 1.
WRITE OUT-REC FROM WS-OUT-REC.
CLOSE PIPE-FILE.
The "WRITING TO PIPE-FILE" never gets displayed, as all my other DISPLAY statements do.
For some reason, it hangs on the OPEN OUTPUT PIPE-FILE statement and does not proceed past that. I have proven this by debugging in both the calling program and the called program.
Is there a reason why I wouldn't be able to use the same pipefile(named pipe) in my Called program that I am already using in my Calling program? The Server program opens it for read(since named pipes are like sequential files and can not be opened in I-O like index files, right?). The called program, OTHERPGM.COB opens the pipe file for output. I make sure to close the pipe file in the server program, before calling OTHERPGM and opening it again, so I have no conflicts there that I am aware of.
Please help if you have any suggestions. This makes no since to me. The only guess I have at it based on my little experience with Pipe files opened for INPUT, is that my OPEN OUTPUT PIPE-FILE statement is actually behaving as if it were opened for INPUT, and since there is nothing in the pipe file at that point, it hangs and waits on that statement until something is put in there. That happened to me before with OPEN INPUT PIPE-FILE before and that makes sense. But since I am doing an OPEN OUTPUT, it makes no sense. I want to write to that file-it shouldn't hang there!
Thanks.
-David
It calls other programs depending on what type of request it is.
I'm working on handling the request, kicking off another cobol program to process the request.
What I need to do, is
OPEN INPUT PIPE-FILE ASSIGN TO "NAMEDPIPE"
ORGANIZATION IS LINE SEQUENTIAL.
Later in my procedure code I have a loop that handles the requests.
PERFORM UNTIL
...
OPEN INPUT PIPE-FILE
READ PIPE-FILE-REC NEXT RECORD
AT END
....Go to end subroutine ...
NOT AT END
IF REQUEST-TYPE = "O"
CLOSE PIPE-FILE
CALL "OTHERPGM.COB" USING .....
...
...
DISPLAY "ARE WE BACK YET FROM CALLED PGM??"
LINE 10 POSITION 1
END-IF
END-PERFORM
Then, in my OTHERPGM.COB
I try to Open the Pipe file for OUTPUT! For some reason, it does not like it. Here's what happens...
PROCEDURE DIVISION.
...
...
..processing code for query request form calling program
DISPLAY "HERE YET???" LINE 10 POSITION 1.
ACCEPT WS-PROMPT LINE 11 POSITION 1.
OPEN OUTPUT PIPE-FILE.
DISPLAY "WRITING TO PIPE-FILE" LINE 12 POSITION 1.
ACCEPT WS-PROMPT LINE 13 POSITION 1.
WRITE OUT-REC FROM WS-OUT-REC.
CLOSE PIPE-FILE.
The "WRITING TO PIPE-FILE" never gets displayed, as all my other DISPLAY statements do.
For some reason, it hangs on the OPEN OUTPUT PIPE-FILE statement and does not proceed past that. I have proven this by debugging in both the calling program and the called program.
Is there a reason why I wouldn't be able to use the same pipefile(named pipe) in my Called program that I am already using in my Calling program? The Server program opens it for read(since named pipes are like sequential files and can not be opened in I-O like index files, right?). The called program, OTHERPGM.COB opens the pipe file for output. I make sure to close the pipe file in the server program, before calling OTHERPGM and opening it again, so I have no conflicts there that I am aware of.
Please help if you have any suggestions. This makes no since to me. The only guess I have at it based on my little experience with Pipe files opened for INPUT, is that my OPEN OUTPUT PIPE-FILE statement is actually behaving as if it were opened for INPUT, and since there is nothing in the pipe file at that point, it hangs and waits on that statement until something is put in there. That happened to me before with OPEN INPUT PIPE-FILE before and that makes sense. But since I am doing an OPEN OUTPUT, it makes no sense. I want to write to that file-it shouldn't hang there!
Thanks.
-David