MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Abend job & display error when file is empty

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
Mani Nagarajan
Beginner


Joined: 02 Aug 2017
Posts: 1
Topics: 1
Location: Dallas US

PostPosted: Thu Oct 05, 2017 11:26 am    Post subject: Abend job & display error when file is empty Reply with quote

Hi,

I need to abend and display a file full of messages (More lines of data that is stored in a flat file) on console when the input file is empty. Is there a way to do this in JCL ?

Thanks
Back to top
View user's profile Send private message
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Thu Oct 05, 2017 5:53 pm    Post subject: Reply with quote

Nope. JCL is a mechanism that allows you to tell the operating system that you want to execut a program (or programs) and the resources required to do so.

You can write a program to do what you want - possibly even use your sort product or IDCAMS to read the data set (not a file) and set a return code appropriately and then you can have a second program conditionally executed to write the messages. However, it is generally a bad idea to write messages to the console - they could easily be lost amongst the myriad of system messages.
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12357
Topics: 75
Location: San Jose

PostPosted: Sun Oct 08, 2017 5:20 am    Post subject: Reply with quote

Mani Nagarajan,

Use the following JCL to print the messages when the file is empty

Code:

//*********************************************   
//*  SETS RC=0000 IF DATASET HAS RECORDS      *   
//*  SETS RC=0004 IF DATASET IS EMPTY         *   
//*  SETS RC=0012 IF DATASET DOES NOT EXIST   *   
//*********************************************   
//STEP0100 EXEC PGM=IDCAMS                         
//SYSPRINT DD SYSOUT=*                             
//MSG      DD DISP=SHR,DSN=YOUR MSGS FILE                             
//OUT      DD SYSOUT=*   
//SYSIN    DD  *                                   
  PRINT IDS('YOUR.INPUT.FILE.FOR.EMPTY.CHECK') CHARACTER COUNT(1)
  IF LASTCC = 4 THEN DO                           
     REPRO INFILE(MSG) OUTFILE(OUT)                                               
     END                                           
//*   


add your shop standard abend step checking for return code of 4

Btw why do you want the flood the console with all these messages?
_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL) All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group