I think what is happening is that the HSEND command is done asynchronously and therefor the dataset has not been created when the dfsort step runs.

You might code wait and that should help.

Ed

On Feb 11, 2016, at 9:06 AM, Vince Getgood 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.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to