On Thu, Feb 11, 2016 at 9:06 AM, Vince Getgood <[email protected]> wrote:

> Hi all,
> I've discovered some very odd behaviour when running a DFHSM command in
> the same batch job as a DFSORT step, and I'm completely baffled by what's
> happening.
>
> We're running z/OS 2.2, although it also happens on 1.3 and 1.10.
>
> I've written a piece of JCL that issues some DFHSM commands, runs a REXX
> to format the output, then a SORT to sort the formatted output.  The job
> fails every time.
>
> I've re-coded the job a number of times, and run the steps individually,
> and it seems the job *only* fails when the SORT step is included.
>
> Rather than post the whole job, I've discovered I can re-create the
> failure with a really simple example.
>
> Consider the following JCL: -
>
> <code>
> //HSMLIST  EXEC PGM=IKJEFT1A
> //SYSTSPRT  DD  SYSOUT=*
> //SYSTSIN   DD  *
>   HSENDCMD WAIT LIST PVOL OUTDATASET('MAINT.TEMP.LIST')
> </code>
>
> This works as expected.  If 'MAINT.TEMP.LIST' doesn't exist, it gets
> created.  If it does, the responses from the LIST PVOL command are appended
> to the end of the dataset.  All good so far.
>
> I create a new empty dataset, 'MAINT.TEMP.TEMP', based on
> 'MAINT.TEMP.LIST'.  I then delete 'MAINT.TEMP.LIST', and run the following
> JCL:-
>
> <code>
> //HSMLIST  EXEC PGM=IKJEFT1A
> //SYSTSPRT  DD  SYSOUT=*
> //SYSTSIN   DD  *
>   HSENDCMD WAIT LIST PVOL OUTDATASET('MAINT.TEMP.LIST')
> /*
> //SORTIT   EXEC PGM=SORT
> //SYSOUT    DD  SYSOUT=*
> //SORTIN    DD  DISP=SHR,DSN=MAINT.TEMP.LIST
> //SORTOUT   DD  DISP=MOD,DSN=MAINT.TEMP.TEMP
> //SYSIN     DD  *
>  SORT FIELDS=COPY
> /*
> </code>
>
> The job *fails* with a JCL error.  I get the following message to my
> terminal: -
>
> ARC0141I ERROR ALLOCATING OUTPUT DATA SET
>
> The joblog for the SORT step shows:-
>
> ​​
> IEFA107I xxxxxxxx SORTIT SORTIN - DATA SET MAINT.TEMP.LIST NOT FOUND
>
> Can anyone shed any light on what's happening here?
>
> Thanks in advance.
>

​The HSENDCMD sends a command to the DFHSM address space​, passing it the
DSN of MAINT.TEMP.LIST. DFHSM then tries to allocate this DSN with a DISP
of either NEW or OLD, depending. But the job has the DSN enqueued SHR due
to the DISP=SHR in the SORTIT step. So the allocate in DFHSM fails,
resulting in the ARC0141I message. The job then continues. And then gets
the IEFA107I message because MAINT.TEMP.LIST does not exist.

My suggested solution is to change the SORTIT step to use IDCAMS, something
like:

//COPYIT EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SORTOUT DD DISP=MOD,DSN=MAINT.TEMP.TEMP
//SYSIN DD *
 REPRO INDATASET(MAINT.TEMP.LIST) -
    OUTFILE(SORTOUT)
/*

This should work because the COPYIT step, replacing the SORTIT step, does a
dynamic allocation of the MAINT.TEMP.LIST. Thus the DSN does not get
enqueued by the job (don't use it in later steps!!!!). Thus DFHSM will
succeed in allocating it. Since you coded WAIT on the HSENDCMD, that step
will not finish until DFHSM completes it action and deallocates
MAINT.TEMP.LIST. This should allow the COPYIT step to be able to
dynamically allocate it successfully. And Bob's your uncle.


-- 
The man has the intellect of a lobotomized turtle.

Maranatha! <><
John McKown

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to