I have a COBOL program that reads a DB and strings together a pipe (|) delimited flat file. Once the file creation is complete, it calls a section to invoke a shell script to move the file from one server to another.
Something about the pipe delimiter causes the function to fail. Things to remember.
1. The shell script works great standalone if i invoke it manually after the cobol program runs. So I know the shell script is right.
2. The COBOL program will invoke the shell script IF I change the delimiter to something other than a pipe (|). So I know the commands are right.
I guess my question is, what about a pipe would blow up the CALL "SYSTEM" USING WS-COMMAND function?
PD Code:
The code above basically strings together a file, then strings together a command to invoke the shell script that ftp's that file. I have all of the WS set correctly to build this file. The error I get when this runs is below. You can see the command that the last section strings together. If I type this command in manually from a commandline, the script ftp's the file as it should. If I change the delimiter, it works from the COBOL program.
Processing ZZ660 - BCX ITEM DETAIL EXTRACT
/bin/ksh "/lawson/lawtest/apps/crp/script/FtpWrap.sh crp BCXITDT
sh: 0403-057 Syntax error at line 1 : `|' is not expected.
Something about the pipe delimiter causes the function to fail. Things to remember.
1. The shell script works great standalone if i invoke it manually after the cobol program runs. So I know the shell script is right.
2. The COBOL program will invoke the shell script IF I change the delimiter to something other than a pipe (|). So I know the commands are right.
I guess my question is, what about a pipe would blow up the CALL "SYSTEM" USING WS-COMMAND function?
PD Code:
Code:
MOVE SPACES TO WS-BCX-SEGMENT.
STRING WS-DELIM DELIMITED BY SIZE
006000 ITL-LOCATION DELIMITED BY WS-SPACE1
WS-DELIM DELIMITED BY SIZE
ITL-LOCATION DELIMITED BY WS-SPACE1
WS-DELIM DELIMITED BY SIZE
ICL-NAME DELIMITED BY WS-SPACE2
WS-DELIM DELIMITED BY SIZE
ITL-ITEM DELIMITED BY WS-SPACE1
WS-DELIM DELIMITED BY SIZE
WS-DELIM DELIMITED BY SIZE
ITE-DESCRIPTION DELIMITED BY WS-SPACE2
WS-DELIM DELIMITED BY SIZE
ITE-DESCRIPTION2 DELIMITED BY WS-SPACE2
WS-DELIM DELIMITED BY SIZE
WS-DELIM DELIMITED BY SIZE
WS-DELIM DELIMITED BY SIZE
WS-DELIM DELIMITED BY SIZE
WS-DELIM DELIMITED BY SIZE
WS-REORDER-POINT DELIMITED BY SIZE
WS-DELIM DELIMITED BY SIZE
WS-REORDER-POINT DELIMITED BY SIZE
WS-DELIM DELIMITED BY SIZE
ITL-UOM DELIMITED BY WS-SPACE1
.
.
.
INTO WS-BCX-SEGMENT.
WRITE BCX-REC FROM WS-BCX-SEGMENT.
******************************************************************
3500-RUN-SCRIPT SECTION.
******************************************************************
MOVE SPACES TO WS-SYS-COMMAND.
STRING "/bin/ksh " """" DELIMITED BY SIZE
"/" DELIMITED BY SIZE
WS-LAWDIR-LC DELIMITED BY SPACES
"/" DELIMITED BY SIZE
WS-PROD-LINE-LC DELIMITED BY SPACES
"/script/FtpWrap.sh" DELIMITED BY SIZE
" " DELIMITED BY SIZE
WS-PROD-LINE-LC DELIMITED BY SPACES
" " DELIMITED BY SIZE
WS-XMIT-FILE DELIMITED BY SPACES
" 2>/dev/null" """" DELIMITED BY SIZE
INTO WS-SYS-COMMAND.
DISPLAY WS-SYS-COMMAND.
CALL "SYSTEM" USING WS-SYS-COMMAND.
The code above basically strings together a file, then strings together a command to invoke the shell script that ftp's that file. I have all of the WS set correctly to build this file. The error I get when this runs is below. You can see the command that the last section strings together. If I type this command in manually from a commandline, the script ftp's the file as it should. If I change the delimiter, it works from the COBOL program.
Processing ZZ660 - BCX ITEM DETAIL EXTRACT
/bin/ksh "/lawson/lawtest/apps/crp/script/FtpWrap.sh crp BCXITDT
sh: 0403-057 Syntax error at line 1 : `|' is not expected.