On Monday, October 15, 2012 3:25:49 PM UTC-5, Emile wrote:
> Why can you not you use CHGCURDIR DIR(/OTHERDIRTHANUSRPRF) in a CL you
>
> submit ?
>
>
>
> Please tell us more about the program you submit etc.
>
I'll do more than that, I'll post the code! See below, then see my comments after the code post.
>
> news:8166a47a-e034-4f2b...@googlegroups.com...
>
> I really need to make a process I start with SBMJOB have a different IFS
>
> path than the one that is specified in the user profile. If I SBMJOB with a
>
> user profile it always uses the IFS path in the user profile. I was hoping
>
> that in a CL I could override that some way.
>
>
>
> Possible, or no?
Here is my CL source.
PGM PARM(&ENG_PROG &PATH &PORT &NUMCHLD &JOBNAME &JOBD &USR)
DCL VAR(&ENG_PROG) TYPE(*CHAR) LEN(20)
DCL VAR(&PATH) TYPE(*CHAR) LEN(1000)
DCL VAR(&PORT) TYPE(*UINT)
DCL VAR(&NUMCHLD) TYPE(*UINT)
DCL VAR(&JOBNAME) TYPE(*CHAR) LEN(10)
DCL VAR(&JOBD) TYPE(*CHAR) LEN(20)
DCL VAR(&USR) TYPE(*CHAR) LEN(10)
DCL VAR(&MY_PORT) TYPE(*CHAR) LEN(10)
DCL VAR(&MY_NUMCHLD) TYPE(*CHAR) LEN(10)
DCL VAR(&JOBLIB) TYPE(*CHAR) STG(*DEFINED) +
LEN(10) DEFVAR(&JOBD 11)
DCL VAR(&JOBDESC) TYPE(*CHAR) STG(*DEFINED) +
LEN(10) DEFVAR(&JOBD 1)
DCL VAR(&ENGLIB) TYPE(*CHAR) STG(*DEFINED) +
LEN(10) DEFVAR(&ENG_PROG 11)
DCL VAR(&ENGNAME) TYPE(*CHAR) STG(*DEFINED) +
LEN(10) DEFVAR(&ENG_PROG 1)
DCL VAR(&ERRORSTR) TYPE(*CHAR) LEN(1000)
CHGVAR VAR(&MY_PORT) VALUE(&PORT)
CHGVAR VAR(&MY_NUMCHLD) VALUE(&NUMCHLD)
/* Strip leading zeroes off of the port #. You can */
/* leave them in, but I wanted them gone. Besides, */
/* I learned something this way. */
TESTZERO: IF COND(%SST(&MY_PORT 1 1) *EQ '0' *AND +
%SST(&MY_PORT 2 1) *NE ' ') THEN(DO)
CHGVAR VAR(&MY_PORT) VALUE(%SST(&MY_PORT 2 9))
GOTO CMDLBL(TESTZERO)
ENDDO
/* Now do the same for the number of children parameter. */
TESTZERO2: IF COND(%SST(&MY_NUMCHLD 1 1) *EQ '0' *AND +
%SST(&MY_NUMCHLD 2 1) *NE ' ') THEN(DO)
CHGVAR VAR(&MY_NUMCHLD) VALUE(%SST(&MY_NUMCHLD 2 9))
GOTO CMDLBL(TESTZERO2)
ENDDO
/* SNDPGMMSG MSG('engine ' *cat &ENG_PROG) */
/* SNDPGMMSG MSG('engine library ' *cat &ENGLIB) */
/* SNDPGMMSG MSG('engine name ' *cat &ENGNAME) */
/* SNDPGMMSG MSG('path ' *cat &path) */
/* SNDPGMMSG MSG('port ' *CAT &MY_PORT) */
/* SNDPGMMSG MSG('num ' *cat &MY_NUMCHLD) */
/* SNDPGMMSG MSG('jobd ' *cat &JOBD) */
/* SNDPGMMSG MSG('joblib ' *cat &JOBLIB) */
/* SNDPGMMSG MSG('jobdesc ' *cat &JOBDESC) */
/* Check to see that our program name and library actually */
/* exist. We're catching the library and program name */
/* component. */
CHKOBJ OBJ(&ENGLIB/&ENGNAME) OBJTYPE(*PGM)
MONMSG MSGID(CPF9810) EXEC(DO)
CHGVAR VAR(&ERRORSTR) VALUE('Library ' *CAT +
&ENGLIB *TCAT ' is not found. Engine not started.')
SNDPGMMSG MSG(&ERRORSTR)
RETURN
ENDDO
MONMSG MSGID(CPF9801) EXEC(DO)
CHGVAR VAR(&ERRORSTR) VALUE('Program ' *CAT +
&ENGNAME *TCAT ' is not found. Engine not started.')
SNDPGMMSG MSG(&ERRORSTR)
RETURN
ENDDO
/* Change to our working directory. Bolt if it */
/* doesn't exist. */
CHGCURDIR DIR(&PATH)
MONMSG MSGID(CPFA0A9) EXEC(DO)
CHGVAR VAR(&ERRORSTR) VALUE('Directory ' *CAT +
&PATH *TCAT ' is not found. Engine not started.')
SNDPGMMSG MSG(&ERRORSTR)
RETURN
ENDDO
/* The checks we have have passed so far, so try and start */
/* an engine with the correct number of children helpers. */
SBMJOB CMD(CALL PGM(&ENGLIB/&ENGNAME) PARM('--port' +
&MY_PORT '--children' &MY_NUMCHLD)) +
JOB(&JOBNAME) JOBD(&JOBLIB/&JOBDESC) +
USER(&USR) CURLIB(QGPL) INLLIBL(*JOBD) +
CPYENVVAR(*YES)
ENDPGM
I've already tested this. It won't work. When the SMBJOB runs, it is going to use the default directory of the user profile represented by the CL variable &USR, and ignore the CHGCURDIR as submitted in the CL variable &PATH. I guess it's doing this because it's starting a job in its own 'space', if you will, leaving the current job's space. I know this because after the SBMJOB runs, the PGM starts creating its log files in that user profile IFS path, not the one I CHGCURDIR to.
My next thing to try is to not SBMJOB a CALL to a program, but a CALL to a CL. In the CL you would do.
CHGCURDIR DIR(&PATH)
CALL PGM(...) PARM(...)
Sounds like it will work, I just need to find some time to try it out.