View previous topic :: View next topic |
Author |
Message |
Mani Nagarajan Beginner
Joined: 02 Aug 2017 Posts: 1 Topics: 1 Location: Dallas US
|
Posted: Thu Oct 05, 2017 11:26 am Post subject: Abend job & display error when file is empty |
|
|
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 |
|
|
Nic Clouston Advanced
Joined: 01 Feb 2007 Posts: 1075 Topics: 7 Location: At Home
|
Posted: Thu Oct 05, 2017 5:53 pm Post subject: |
|
|
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 |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12359 Topics: 75 Location: San Jose
|
Posted: Sun Oct 08, 2017 5:20 am Post subject: |
|
|
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 |
|
|
|
|