Re: How to control in an JCL that a file is empty or not exist ?



Or write little program (skeleton ASM)

OPEN
LR R3,4
GET
LR R3,0 OR ...
EOF EQU *
RETURN w/R3 as return code in R15

can also be done in Cobol in same manner and probably all other languages

IBM Mainframe Discussion List <IBM-MAIN@xxxxxxxxxxx> wrote on 07/14/2011
09:22:05 AM:

From: Greg Shirey <WGShirey@xxxxxxxxxxxxx>
To: IBM-MAIN@xxxxxxxxxxx
Date: 07/14/2011 09:31 AM
Subject: Re: How to control in an JCL that a file is empty or not exist
?
Sent by: IBM Mainframe Discussion List <IBM-MAIN@xxxxxxxxxxx>

As mentioned, LISTC will test for whether a file exists; ICETOOL
provides a method to test if a file is empty.

From "Smart DFSORT tricks" (ftp.software.ibm.com/storage/dfsort/mvs/
sorttrck.pdf)

For example, in the following ICETOOL job, the EMPTY operand of
COUNT is used to stop STEP2 from being executed if the IN data set
is empty. ICETOOL sets RC=8 (because the RC8 operand is specified)
if the IN data set is empty, or RC=0 if the IN data set is not
empty. ICETOOL only reads one record to determine if the data set is
empty or not empty, regardless of how many records there are in the data
set.

//STEP1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=...
//TOOLIN DD *
* SET RC=8 IF THE 'IN' DATA SET IS EMPTY, OR
* SET RC=0 IF THE 'IN' DATA SET IS NOT EMPTY
COUNT FROM(IN) EMPTY RC8
/*
// IF STEP1.RC = 0 THEN
//*** STEP2 WILL RUN IF 'IN' IS NOT EMPTY
//*** STEP2 WILL NOT RUN IF 'IN' IS EMPTY
//STEP2 EXEC ...
...
// ENDIF


HTH,
Greg Shirey
Ben E. Keith Company


-----Original Message-----
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@xxxxxxxxxxx] On
Behalf Of Hilario G.
Sent: Thursday, July 14, 2011 7:40 AM
To: IBM-MAIN@xxxxxxxxxxx
Subject: How to control in an JCL that a file is empty or not exist ?

Hello folks,

I have several batch processes that contain empty files or files
that do not exist.

I need to control the execution of certain programs based on the
existence of these files (including files created empty).

I try to used IDCAMS but didn't work in my tests.

Thank you very much everyone.


-----------------------------------------
The information contained in this communication (including any
attachments hereto) is confidential and is intended solely for the
personal and confidential use of the individual or entity to whom
it is addressed. If the reader of this message is not the intended
recipient or an agent responsible for delivering it to the intended
recipient, you are hereby notified that you have received this
communication in error and that any review, dissemination, copying,
or unauthorized use of this information, or the taking of any
action in reliance on the contents of this information is strictly
prohibited. If you have received this communication in error,
please notify us immediately by e-mail, and delete the original
message. Thank you

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to listserv@xxxxxxxxxxx with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html
.



Relevant Pages

  • Re: IEBGENER is BROKEN
    ... A DD * with no lines is _not_ the same as DD DUMMY. ... There are differences in allocation, ... Treat all empty data sets alike. ... an empty instream data set, and an empty DASD data set, ...
    (bit.listserv.ibm-main)
  • Re: IEBGENER is BROKEN
    ... ran with SYSIN being a DD *, but with no control cards. ... A DD * with no lines is _not_ the same as DD DUMMY. ... Treat all empty data sets alike. ... an empty instream data set, and an empty DASD data set, ...
    (bit.listserv.ibm-main)
  • Re: IEBGENER is BROKEN
    ... OPEN SYSIN; QSAM GET until you come to the end; then ... Treat all empty data sets alike. ... an empty instream data set, and an empty DASD data set, ... has no other way to signify EOF to the program. ...
    (bit.listserv.ibm-main)
  • Re: How to control in an JCL that a file is empty or not exist ?
    ... How to control in an JCL that a file is empty or not exist ... COUNT is used to stop STEP2 from being executed if the IN data set ... The information contained in this communication (including any ... CONFIDENTIALITY/EMAIL NOTICE: The material in this transmission contains ...
    (bit.listserv.ibm-main)
  • Re: IEBGENER is BROKEN
    ... But (open message to designers): ... Treat all empty data sets alike. ... an empty instream data set, and an empty DASD data set, ... To me this signified EOF and unless there is a specific check in the program for a /* (not sure what JES send to the program other than ...
    (bit.listserv.ibm-main)