Home      Mainframe Forum      Mainfarme Tutorials      IBM Manuals      Mainframe Interview Questions      Mainframe Books      IT News     SiteMap     Downloads


     
 
MAINFRAME - TIP OF THE DAY : Q. If there is a situation, where we need to code more than 255 steps in a JOB? A. We need to split jcl into two jcls , at the end of the first jcl check the condition code and initiate the second jcl.

Google
 
Web mainframegurukul.com

Welcome to the mainframegurukul forums.

You are currently viewing our mainframe forums as a guest which gives you limited access to view most discussions, articles. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support at admin@mainframegurukul.com


test datase empty

 
Post new topic   Reply to topic    mainframegurukul.com Forum Index -> JCL
  View previous topic :: View next topic  
Author Message
nick.mamone
Member


Joined: 14 Nov 2006
Posts: 3

PostPosted: Wed Nov 15, 2006 4:08 pm    Post subject: test datase empty Reply with quote

Hello i'm a new user, i'm italian and don't speak english very well, so excuse me for error. Embarassed

I must test if a dataset is empty and in this instace setting the return code greater zero.
Is possible do this with a proc ibm and without a specific program?

Thanks, and excuse me for english.

Wink
Back to top
View user's profile Send private message

Kalicharan
Moderator


Joined: 08 Feb 2006
Posts: 31

PostPosted: Wed Nov 15, 2006 5:46 pm    Post subject: Reply with quote

Hi,

You can get this using ICETOOL or FILEAID or IDCAMS....

Using IDCAMS here is the solution

//STEP01 EXEC PGM=IDCAMS
//IN DD DSN=DATASET <--- Dataset to be checked
//SYSPRINT DD SYSOUT=*
//SYSIN DD DATA
PRINT INFILE(IN) COUNT(1)
/*

This will give RC=0 if file has at least 1 record, otherwise RC=4.


Thanks
Kalicharan
Back to top
View user's profile Send private message Send e-mail
nick.mamone
Member


Joined: 14 Nov 2006
Posts: 3

PostPosted: Wed Nov 15, 2006 5:48 pm    Post subject: Reply with quote

thanks!!!!! Very Happy Very Happy Very Happy Very Happy Very Happy
Back to top
View user's profile Send private message
Madhusudana Reddy Mandli
Member


Joined: 15 Nov 2006
Posts: 3

PostPosted: Wed Nov 15, 2006 7:35 pm    Post subject: Reply with quote

Kali,

Can you give me how to do this using the FILEAID

Thanks in Advance
Back to top
View user's profile Send private message
Leo
Member


Joined: 14 Nov 2006
Posts: 13
Location: HYBD

PostPosted: Fri Nov 17, 2006 4:27 pm    Post subject: Reply with quote

You can check the same using sort .

Code:

//STEP100 EXEC PGM=SORT,PARM='NULLOUT=RC4'
//SYSOUT   DD SYSOUT=*
//SORTIN   DD DSN= Input file name goes here, 
//            DISP=SHR
//SORTOUT  DD DUMMY
//SYSIN    DD DSN=&CTLCARD(SORTCOPY), --> SORT FIELDS=COPY
//            DISP=SHR


This will give a return code of 4 if the file is empty , you can check for the return code of this step down the line in the job . hope this was helpful

Thanks
Leo
Back to top
View user's profile Send private message
Madhusudana Reddy Mandli
Member


Joined: 15 Nov 2006
Posts: 3

PostPosted: Fri Nov 17, 2006 4:39 pm    Post subject: Thanks Reply with quote

Hi Leo,

Thanks a lot.

It looks like a good solution.


Thanks,
Madhu
Back to top
View user's profile Send private message
Frank Yaeger
Moderator


Joined: 18 Feb 2006
Posts: 511
Location: San Jose, CA

PostPosted: Fri Nov 17, 2006 9:50 pm    Post subject: Reply with quote

Note that Leo's job will only work for z/OS DFSORT V1R5, not for DFSORT R14. Here's a DFSORT/ICETOOL job that will work for both:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN DD DSN=...  input file
//TOOLIN DD *
COUNT FROM(IN) EMPTY RC4
/*


For more information, see the "Set RC=12 or RC=4 if file is empty, has more than n records, etc" Smart DFSORT Trick at:

http://www.ibm.com/servers/storage/support/software/sort/mvs/tricks/
_________________
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
justaprogrammer
Member


Joined: 18 Jul 2006
Posts: 6

PostPosted: Wed Nov 22, 2006 6:42 pm    Post subject: Reply with quote

You can also use IDCAMS for checking this.

Code:
//FILEMPTY   EXEC   PGM=IDCAMS
//FILEB         DD      DUMMY
//SYSPRINT   DD     SYSOUT=*
//SYSIN         DD    *
    REPRO IDS(input file) OFILE(FILEB) COUNT(1)
/*


This will give a RC = 12 if the file is empty.

You can also use
Code:

PRINT IDS(input file) COUNT(1)

which will give RC=4 when the file is empty.
_________________
Thanks
justaprogrammer
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    mainframegurukul.com Forum Index -> 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

Related topics
 Topics   Replies   Author   Views   Last Post 
No new posts EZtrv+ - Is there a way to suppress ez-code from printing... 4 seagreg 3918 Wed Feb 04, 2009 10:47 am
md_shamsu View latest post
No new posts CAST function 2 bolastuff1975 4571 Fri Oct 26, 2007 5:06 pm
bolastuff1975 View latest post
No new posts thanks 0 chintu 2186 Wed Oct 24, 2007 7:06 pm
chintu View latest post
No new posts Reg DFSORT utility. 3 ursvmg 10824 Wed Jan 17, 2007 3:17 am
Frank Yaeger View latest post
No new posts Xpeditor use in batch process 2 nanda_cse 7516 Sun Oct 08, 2006 6:57 pm
nanda_cse View latest post
 



This widget requires Flash Player 9 or better








Go to top of the page
 

Online ABEND Reference ||  JCL References ||  COBOL References ||  VSAM References ||  Tutorials by Drona Series ||  SQL tutorial ||  BOOKS  ||  DB2 INTERVIEW QUESTIONS ||  COBOL INTERVIEW QUESTIONS  ||  JCL INTERVIEW QUESTIONS ||  JCL2 INTERVIEW QUESTIONS ||  VSAM INTERVIEW QUESTIONS ||  CICS INTERVIEW QUESTIONS  ||  Online tutorials ||  Online ABEND Reference ||  JCL References ||  COBOL References ||  VSAM References ||  Tutorials by Drona Series ||  SQL tutorial ||  BOOKS  ||  SiteMap  ||  Expeditor Tutorial  ||  FILE-AID Tutorial  ||  Changeman Tutorial  ||  COBOL   ||  DB2   ||  JCL  ||  CICS  ||  VSAM  ||  DB2 Interview Questions ( 110 )   || Simple JCL Tutorials  || JCL Tutorial from MainframeGurukul.com   || Simple JCL Tutorial - Chapter1 ;|| Mainframe Forum - Tutorials  || Mainframe Tutorials

Drona Educational Forums - Mainframe Cobol DB2 CICS Board
Powered by phpBB