SiouxCityElvis
Programmer
How do I take a hard coded directory from working storage and concatenate the name of a file on that directory in order to use it in my SELECT statement for specifying where and what file to write my data to?
I keep getting a COBOL I/O error 30, UNIX Error 13 on my OPEN file statement:/home/fname/lname/results/TEST.txt
Here's the pieces of code involved:
SELECT FILE-RECORD ASSIGN TO OUTPUT, FILE-NAME
ORGANIZATION IS LINE SEQUENTIAL.
FD OUT-FILE-RECORD.
01 OUT-FILE-REC.
03 FILE-NAME PIC X(40)
.....
.....
Then, I have a WS variable with hardcoded value for specifying directory:
WS-DIR PIC X(32) VALUE "/home/fname/lname/results/".
WS-TEMP-FILE PIC X(8).
Later, in Procedure, I UNSTRING the Pipe rec value into my OUT-FILE-RECORD variables.
UNSTRING PIPE-REC DELIMITED BY "^"
INTO
WS-TEMP-FILE
FILE-FNAME
etc...
...
END-UNSTRING.
STRING WS-DIR DELIMITED BY SIZE
WS-TEMP-FILE DELIMITED BY SIZE
INTO WS-RFMT-FILE-NAME
END-STRING.
MOVE WS-RFMT-FILE-NAME TO FILE-NAME.
But, I get the error indicated above when I do the
OPEN OUTPUT OUT-FILE-RECORD statement.
This makes no since to me as the error indicates:
/home/fname/lname/results/TEST.txt
so, obviously, the concatenation is happening, but for some reason, it does not like to OPEN(create) that file with that path. The path is valid/exists, but it won't create the file.
Please help if you have any suggestions.
Thanks.
-David
I keep getting a COBOL I/O error 30, UNIX Error 13 on my OPEN file statement:/home/fname/lname/results/TEST.txt
Here's the pieces of code involved:
SELECT FILE-RECORD ASSIGN TO OUTPUT, FILE-NAME
ORGANIZATION IS LINE SEQUENTIAL.
FD OUT-FILE-RECORD.
01 OUT-FILE-REC.
03 FILE-NAME PIC X(40)
.....
.....
Then, I have a WS variable with hardcoded value for specifying directory:
WS-DIR PIC X(32) VALUE "/home/fname/lname/results/".
WS-TEMP-FILE PIC X(8).
Later, in Procedure, I UNSTRING the Pipe rec value into my OUT-FILE-RECORD variables.
UNSTRING PIPE-REC DELIMITED BY "^"
INTO
WS-TEMP-FILE
FILE-FNAME
etc...
...
END-UNSTRING.
STRING WS-DIR DELIMITED BY SIZE
WS-TEMP-FILE DELIMITED BY SIZE
INTO WS-RFMT-FILE-NAME
END-STRING.
MOVE WS-RFMT-FILE-NAME TO FILE-NAME.
But, I get the error indicated above when I do the
OPEN OUTPUT OUT-FILE-RECORD statement.
This makes no since to me as the error indicates:
/home/fname/lname/results/TEST.txt
so, obviously, the concatenation is happening, but for some reason, it does not like to OPEN(create) that file with that path. The path is valid/exists, but it won't create the file.
Please help if you have any suggestions.
Thanks.
-David