GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Mainframe
Go To First  |  Previous Question  |  Next Question 
 Mainframe  |  Question 21 of 55    Print  
How to test the given dataset is empty (or) not through jcl in mainframes?

  
Total Answers and Comments: 8 Last Update: October 12, 2009     Asked by: ANIL 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
June 20, 2006 05:52:54   #1  
vamshi        

How to test the given dataset is empty (or) not th...

//**********************************************************************
//* *
//* CHECK IF FILE IS EMPTY *
//* *
//**********************************************************************
//SCHKEMP EXEC PGM IDCAMS
// COND (4 LT)
//SYSIN DD *
REPRO IFILE(IT01) OFILE(OT11) COUNT(1)
//IT01 DD DSN dsnname
// DISP OLD
//OT11 DD DUMMY
// DCB (RECFM VB LRECL 2034)
// IF SCHKEMP.RC 4 THEN

//FILE1 DD *
THE FILE IS EMPTY
/*

//SYSPRINT DD SYSOUT *
//SYSABEND DD SYSOUT X
// HOLD YES
//*


 
Is this answer useful? Yes | No
August 16, 2006 05:50:44   #2  
RUPA . S        

RE: How to test the given dataset is empty (or) not th...
try to open the dataset in cobol in input mode u cant ioen the file if it is empty u will get a non zero file status
 
Is this answer useful? Yes | No
November 12, 2006 02:26:34   #3  
krushnat        

RE: How to test the given dataset is empty (or) not th...

Hi

i want to know to check the newly added record in dataset in vb.net


 
Is this answer useful? Yes | No
November 24, 2006 05:23:19   #4  
Sridhar        

RE: How to test the given dataset is empty (or) not th...
Use simple Sort utility JCL and try to copy the data (SORT FIELDS COPY) form the file which you want to test to an output file. in Sysout of the job run you can see the record counts of input and output files. This gives the count of the data which you want to test.
 
Is this answer useful? Yes | No
March 15, 2007 07:49:47   #5  
Smitha Brindavan        

RE: How to test the given dataset is empty (or) not th...

Return codes can be set to 12 if the dataset is empty and 0 if not empty using ICETOOL. Subsequent processing can follow based on the return code in the ICETOOL step as required.

In this below example Return code of STEP1 will be set to 12 if dataset USERNAME.FILE1 is empty. STEP2 will run if return code is 0 i.e if dataset is not empty.

//STEP1 EXEC PGM ICETOOL
//TOOLMSG DD SYSOUT *
//DFSMSG DD SYSOUT *
//INFILE DD DSN USERNAME.FILE1 DISP SHR
//TOOLIN DD *
COUNT FROM(INFILE) EMPTY
/*
//IF STEP1.RC 0 THEN
//STEP2 EXEC PGM *****
...
//ENDIF


 
Is this answer useful? Yes | No
January 07, 2008 08:11:48   #6  
sumanreddy999 Member Since: April 2006   Contribution: 1    

RE: How to test the given dataset is empty (or) not through jcl in mainframes?
//********************************************************************
//* CHECK FOR EMPTY Dataset . *
//********************************************************************
//*
//CHKEMP EXEC PGM IDCAMS TIME 800 REGION 150K
//*
//INPUT1 DD DSN DSNNAME DISP SHR
//OUTPUT1 DD DUMMY
// DCB (RECFM FB LRECL 700 BLKSIZE 0)
//*
//SYSIN DD *
REPRO -
INFILE (INPUT1) -
OUTFILE (OUTPUT1) -
SKIP(01)
/*
//SYSOUT DD SYSOUT *
//SYSPRINT DD SYSOUT *
//SYSUDUMP DD SYSOUT *
//CEEDUMP DD SYSOUT *
//SYSOUD DD SYSOUT *
//*
//******************************************************************
//* CHECKS FOR RETURN CODE CHECKEMP
//******************************************************************
// IF (CHKEMP.RC EQ 12) THEN
//FILE1 DD *
THE FILE IS NOT EMPTY
/*
//******************************************************************
// IF (CHKEMP.RC NE 12) THEN
//FILE1 DD *
THE FILE IS EMPTY
/*

 
Is this answer useful? Yes | No
February 17, 2008 10:30:20   #7  
therealdeal Member Since: February 2008   Contribution: 1    

RE: How to test the given dataset is empty (or) not through jcl in mainframes?
You can check whether a dataset has any values of empty without writing a jcl too..Just go to the job where it is present... Type "tso cb" in the command and keep in the mouse arrow on the dataset and press enter you can see the contents of the dataset...
 
Is this answer useful? Yes | No
October 10, 2009 03:36:12   #8  
jvsamycts Member Since: October 2009   Contribution: 2    

RE: How to test the given dataset is empty (or) not through jcl in mainframes?
Simply you can use the below sort card

SORT FIELDS COPY
OUTFIL FILES 1 NULLOFL RC4

SORTIN - Dataset to be tested for Empty
SORTOF1 - Output file..... it can be temp file...

While executing this Sort step it will return RC 4 when the input file is empty.

 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape