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 

how to stop job exececution, if file has less than 100 recs

 
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
kingofmainframes
Beginner


Joined: 04 Feb 2007
Posts: 2
Topics: 2

PostPosted: Fri Feb 16, 2007 9:12 am    Post subject: how to stop job exececution, if file has less than 100 recs Reply with quote

Hi Guys,
I have a requirement to stop executing a job when the number of records in a file is less than 100. Job should end with Return code zero. Please assist.
1) Input file is a VSAM KSDS file - key first 4 bytes.
2) Job has more that 20 steps
3) Record count has to be checked in the first step.
Back to top
View user's profile Send private message
blitz2
Beginner


Joined: 23 Jan 2007
Posts: 84
Topics: 14

PostPosted: Fri Feb 16, 2007 9:21 am    Post subject: Reply with quote

If writing a Cobol program an option for you, then write a program that counts the number of records in the input file. If they are less than 100, move '1' (or some other number to RETURN-CODE). In the JCL, use condition codes to skip/ continue the rest of the steps based on the condition code. Remember to change the return code to zero in the jcl in case you decide to skip the rest of the steps.
________
buy easy vape


Last edited by blitz2 on Wed Feb 02, 2011 3:11 am; edited 1 time in total
Back to top
View user's profile Send private message
prasanth_thavva
Beginner


Joined: 14 May 2006
Posts: 40
Topics: 18

PostPosted: Mon Feb 19, 2007 3:40 am    Post subject: Reply with quote

Hi,

One way of checking in JCL is
Use PRINT and Count (100) if it is less than it will return 4 or 8 i am not sure, that way u can execute the step.

Thanks&Regards
Venkata Prasanth
Surprised
_________________
Thanks&Regards
Prasanth Thavva
Back to top
View user's profile Send private message Send e-mail
Nic Clouston
Advanced


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

PostPosted: Mon Feb 19, 2007 4:25 am    Post subject: Reply with quote

are you saying that EVERY step in the job MUST return a code of 0 or are you saying that the job must not abend? If the first then you cannot. I f the latter then the first response is as good as any - I've just done it for myself except I'm indicating an empty file and doing alternative processing.
_________________
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: 12378
Topics: 75
Location: San Jose

PostPosted: Mon Feb 19, 2007 10:03 am    Post subject: Reply with quote

Split the job into 2 jobs. Job1 will have just the 2 steps. In the first step it will check the record count and step2 it will submit the job 2(with all the other steps) or do nothing


JOB 1:

Code:

//STEP0100 EXEC PGM=SORT     
//SYSOUT   DD SYSOUT=*       
//SORTIN   DD DSN=YOUR INPUT VSAM FILE,
//            DISP=SHR
//SORTOUT  DD DSN=&T1,DISP=(,PASS),SPACE=(TRK,(1,0),RLSE)
//SYSIN    DD *                                           
  SORT FIELDS=COPY                                       
  OUTREC IFTHEN=(WHEN=INIT,                               
          BUILD=(SEQNUM,8,ZD,80:X)),                     
         IFTHEN=(WHEN=(1,8,ZD,GE,100),                     
        OVERLAY=(1:C'SUB ''',                             
                   C'your.pds.jcl(job2)''')),         
         IFTHEN=(WHEN=(1,8,ZD,LT,100),                     
        OVERLAY=(1:80X))                                 
  OUTFIL REMOVECC,NODETAIL,                               
  TRAILER1=(1,80)                                         
/*
//STEP0200 EXEC PGM=IKJEFT01       
//SYSPRINT DD SYSOUT=*             
//SYSTSPRT DD SYSOUT=*             
//SYSOUT   DD SYSOUT=*             
//SYSTSIN  DD DSN=&T1,DISP=SHR     
/*


Job2 will have all other steps which needs to be processed.

Hope this helps...

Cheers

kolusu
_________________
Kolusu
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