简体   繁体   中英

SBMJOB programs within Do they have access to qtemp

When submitting an excextfun program, do program calls within this have access to the same qtemp library. My problem: When I call the function interactively , I get data in report, when I submit the job , I get no data in report. All the extraction is done to qtemp library. The qtemp overrides are done within the excextfun program, and then other programs within this extract the data.

Thank you in advance for all help.

Just to expand on what James wrote ...

If JobA submits a call to program excextfun, the program will be running in a different job (JobB). As James said, JobB has its own QTEMP library. If excextfun calls other programs, they will run in JobB and they will have the same QTEMP as the submitted call.

The report may be getting created successfully in JobB.

But if the report is being created in QTEMP for JobB, then it will not be available to the original program running in JobA. So if you want to submit this call, you could still do some of the work in QTEMP, but the final report would have to go to some permanent library.

As others have said, each job gets its own QTEMP. So, to be able to submit a job that reports on some data extracted to QTEMP, the extract program must be submitted and run in the same job as the report program. I usually would do this in the following manner:

Create a self submitting CLP that controls the entire process. This CLP has an interactive and a batch portion selected by the type in RTVJOBA. In the interactive portion of the CLP you would prompt for any required reporting parameters, and submit the CLP to execute the report. In the batch portion of the CLP, you would call the extract program, and then the report program.

Here is a simple CLP template that does this:

PGM        PARM(&PARMS)

DCL        VAR(&PARMS) TYPE(*CHAR) LEN(5) /* This needs to be +
             replaced with appropriate parameters */

DCL        VAR(&INTER) TYPE(*CHAR) LEN(1)

RTVJOBA    TYPE(&INTER)

/* Interactive part */
IF         COND(&INTER *EQ '1') THEN(DO)
   CALL       PGM(PROMPT) PARM(&PARMS)
   SBMJOB     CMD(CALL PGM(REPORTCL) PARM(&PARMS))
   GOTO       CMDLBL(OUT)
ENDDO

/* Batch part */
CALL       PGM(EXTRACT) PARM(&PARMS)
CALL       PGM(REPORT) PARM(&PARMS)

OUT:
ENDPGM 

Note, there are no command definitions here, and if you have any long individual parameters, or use a single long parameter, you have to deal with the fact that SBMJOB does not know about parameter length of the program it is submitting, and thus defaults the the longer of the length of any character parameter value with blanks trimmed from the right, and 32 characters. For numeric parameters, it defaults to 15,5. There are ways to deal with that as well, but that is a different question.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM