I have developed a perl script that calls (and passes parameters) to a Sql script to create a report from Lawson tables. Now, I need to call this perl script from some basic Cobol program to pass parameters to the perl script (example Company, Date Range, etc). I have done this at a past job many years in the past but I am unable to get help from there. I know that we had a custom pdlib and wslib files to do this. The pdlib basically had a "Call 'system' using .....' statement", which for me is returning an error that says "sh: /---pathname-- /test.pl: not found". It seems to be looking for a shell script instead of the perl script I have specified. Has anyone done this successfully, that can help me figure this out?
I put the code below in Working Storage. WS-CMD-TYPE-1 AND WS-CMD-TYPE-2 contain the command and parms that I want. You could put perl perl.script in WS-CMD-TYPE-1 and the parameters in WS-CMD-TYPE-2.
01 WS-RETURN-SYS-CODE-N PIC 9(8) VALUE ZEROES. 01 WS-COMMAND. 03 FILLER PIC X(17) VALUE "\lawprod\gen\bin\". 03 WS-CMD-TYPE. 05 WS-CMD-TYPE-1 PIC X(20) VALUE SPACES. 05 FILLER PIC X VALUE SPACES. 05 WS-CMD-TYPE-2 PIC X(50) VALUE SPACES. 03 FILLER PIC X(2) VALUE SPACES.
This is the code in the Procedure Division that executes it. MOVE FUNCTION LOWER-CASE(PRM-PRPNNM) TO WS-CMD-TYPE-1. MOVE PRM-PRPOVB TO WS-CMD-TYPE-2. DISPLAY WS-COMMAND. CALL "system" USING WS-COMMAND GIVING WS-RETURN-SYS-CODE. MOVE WS-RETURN-SYS-CODE TO WS-RETURN-SYS-CODE-N. DISPLAY "RETURN CODE = " WS-RETURN-SYS-CODE-N. IF (WS-RETURN-SYS-CODE-N = 0) MOVE "PROCESSING SUCCESFULL" TO RPT-DATA WRITE PRINT-LINE FROM RPT-DATA AFTER ADVANCING 1 LINES ELSE MOVE "PROCESSING UNSUCCESFULL" TO RPT-DATA WRITE PRINT-LINE FROM RPT-DATA
Thanks for responding.
I am basically doing the same thing, stringing the perl script, as well as the list of parameters in a WS field (WS-COMMAND-LINE in my case), then the Call 'system' using WS-COMMAND-LINE. Should I delimit the script and the parameters with commas instead of space? In the screen-shot below: "/$(hostname)jobs" on my test box resolves to "/hrsta1jobs"; on prod it is /hrspa1jobs.
The perl script zb720.pl resides, and has openwide permissions (777), in /hrsta1jobs/pl/ directory - confirmed.
As for the error message (see 2nd screen shot), is it looking for a shell script?