Frank Swarbrick at IBM Mainframe Discussion List <IBM-MAIN@bama.ua.edu>
wrote on 04/19/2012 10:22:56 AM:
> I know of the NULLOUT and NULLOFL options to specify return code
> setting if there are no records to be written to the output file.
> I'm wondering if there is any option I can specify so that the
> SORTOUT file will not even be opened if there are no records to be
> written to it.  Basically, I want to leave the "old" records that
> were in SORTOUT alone if there is nothing new to go in to it for this
run.
>
> At this point the best thing I can think of is to run SORT twice;
> the first time copying one record to a dummy file with NULLOUT=RC4
> set.  Then skipping step 2, the actual copy into the real SORTOUT,
> if the RC from step 1 is not 0.
>
> If there is a program other than SORT (IDCAMS?) that I can use to
> accomplish this, that's fine as well.  No actual sorting is being
> done; just a straight copy.

Frank,

You could use a DFSORT ICETOOL job with COUNT and COPY like this:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN DD DSN=...  input file
//OUT DD DSN=...  output file
//TOOLIN DD *
MODE STOP
COUNT FROM(IN) EMPTY RC12
COPY FROM(IN) TO(OUT)
/*

If IN is emtpy, the COUNT operator will set RC=12 and
the COPY operator will NOT be executed so OUT will not be
opened.  The step will give back cc=12.  COUNT does not
require an output data set.

If IN is not empty, the COUNT operator will set RC=0 and
the COPY operator will be executed so OUT will be
opened and IN will be copied to it.  The step will give
back cc=0

Note that MODE STOP is the default so you don't have to
specify it, but I put it in for doc purposes.

Frank Yaeger - DFSORT Development Team (IBM) - yae...@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration

 => DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: INFO IBM-MAIN

Reply via email to