Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Making a job abend if a dataset is not empty.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
murali922

New User


Joined: 25 Jul 2005
Posts: 92
Location: India

PostPosted: Mon Feb 19, 2007 3:03 pm    Post subject: Making a job abend if a dataset is not empty.
Reply with quote

Code:
//step1   EXEC PGM=ISRSUPC,                                           
//            PARM=(DELTAL,LINECMP,                                   
//            '',                                                     
//            '')                                                     
//NEWDD    DD  DSN=<new dataset>,
//             DISP=SHR                                               
//OLDDD    DD  DSN=<old dataset>,
//             DISP=SHR                                               
//OUTDD    DD  DSN=&&TEMP,                                             
//             DISP=(,PASS),                                           
//             DSORG=PS,                                               
//             RECFM=FB,                                               
//             LRECL=80,                                               
//             BLKSIZE=0,                                             
//             UNIT=SYSDA,                                             
//             AVGREC=K,                                               
//             SPACE=(1,(1,1),RLSE)                                   
//*                                                                   
//step2   EXEC PGM=SORT
//SORTIN   DD  DSN=&&TEMP,DISP=(OLD,DELETE)                           
//SORTOFA  DD  DSN=<dataset with inserts>,
//             DISP=SHR                                               
//SORTOFB  DD  DSN=<dataset with deletes>,
//             DISP=SHR                                               
//SYSOUT   DD  SYSOUT=*                                               
//SYSIN    dd *
OPTION COPY                       
OUTFIL FILES=A,OUTREC(6,80),     
      INCLUDE=(2,3,CH,EQ,C'I -') 
OUTFIL FILES=B,OUTREC(6,80),     
      INCLUDE=(2,3,CH,EQ,C'D -') 
/*


The above JCl compares 2 files. 1 file being the base file. And the other one being the new one. Creates one file with all new insertions.
Creates another file with all deletions.

I should not have any deletions normally. Hence I need to abend the job, if there are any records in the dataset which holds deleted
records.

I know I have an option to count the number of records in a dataset and then if the count is more than 0, make it abend. But dont know
the syntax..

Can someone let me know who I should write the next step, so that if there are any records in the <dataset with deletes> the job would abend.
Back to top
View user's profile Send private message

dineshness

New User


Joined: 25 Dec 2006
Posts: 63
Location: Perambalur

PostPosted: Mon Feb 19, 2007 11:43 pm    Post subject: Re: Making a job abend if a dataset is not empty.
Reply with quote

You can use the following SORT card to Set the RC12,

COUNT FROM(SORTIN) HIGHER(0) USING(CTL1)
//CTL1CNTL DD *
INCLUDE COND = (2,3,CH,EQ,C'D -')
/*

Dinesh.
Back to top
View user's profile Send private message
Steve Coalbran

New User


Joined: 01 Feb 2007
Posts: 85
Location: Stockholm, Sweden

PostPosted: Tue Feb 20, 2007 1:18 am    Post subject: Re: Making a job abend if a dataset is not empty.
Reply with quote

Maybe true, and I am definitely no Frank Yaeger, but if I try and apply this to a SORT JCL I have handy, there is something definitely missing...
Code:

//ICEMAN   EXEC PGM=ICEMAN                 
//SYSOUT   DD SYSOUT=*                     
//SORTIN   DD *                           
//OUT1     DD SYSOUT=*                     
//SYSIN    DD    *                         
  COUNT FROM(SORTIN) HIGHER(0) USING(CTL1)
//CTL1CNTL DD *                           
  INCLUDE COND = (2,3,CH,EQ,C'D -')       
/*                                         

what's is it?...
Code:

 SDSF OUTPUT DISPLAY SE16661I JOB04191  DSID   104 LINE 1       COLUMNS 02- 81 
 COMMAND INPUT ===>                                            SCROLL ===> CSR 
ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R5 - 20:34 ON MON FEB
            COUNT FROM(SORTIN) HIGHER(0) USING(CTL1)                           
            ?                                                                   
ICE005A 0 STATEMENT DEFINER ERROR                                               
ICE010A 0 NO SORT OR MERGE CONTROL STATEMENT                                   
ICE751I 0 C5-K05352 C6-Q95214 E7-K90000                                         
ICE052I 3 END OF DFSORT                                                         
******************************** BOTTOM OF DATA ********************************

PS: Using bbCode on the reply would aid the non-psychic.
Back to top
View user's profile Send private message
dineshness

New User


Joined: 25 Dec 2006
Posts: 63
Location: Perambalur

PostPosted: Tue Feb 20, 2007 1:33 am    Post subject: Re: Making a job abend if a dataset is not empty.
Reply with quote

Me too neither... icon_smile.gif .

But, from the JCL can you really give SORTIN as * ?, Please try with a dataset name with some records.

And, you dont have to include the OUT1 DD entry.

Delimit the SYSIN before CTL1CNTL with /*.

I dont really have a system with which i can try the code.
My reply was purely intuitive....as it should have worked icon_biggrin.gif.

Dinesh.
Back to top
View user's profile Send private message
dineshness

New User


Joined: 25 Dec 2006
Posts: 63
Location: Perambalur

PostPosted: Tue Feb 20, 2007 1:38 am    Post subject: Re: Making a job abend if a dataset is not empty.
Reply with quote

Quote:
But, from the JCL can you really give SORTIN as * ?, Please try with a dataset name with some records.


I mean code some instream data records or mention a dataset name having records.

Dinesh.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Tue Feb 20, 2007 2:13 am    Post subject: Re: Making a job abend if a dataset is not empty.
Reply with quote

murali922 wrote:
Can someone let me know who I should write the next step, so that if there are any records in the <dataset with deletes> the job would abend.
Have you looked at Smart DFSORT Tricks and the chapter entitled Set RC=12 or RC=4 if file is empty, has more than n records, etc?
I'm not sure, but you might be able to incorporate the technique in the sort that does the splitting.
Back to top
View user's profile Send private message
murali922

New User


Joined: 25 Jul 2005
Posts: 92
Location: India

PostPosted: Tue Feb 20, 2007 5:37 pm    Post subject: Re: Making a job abend if a dataset is not empty.
Reply with quote

Super Cool. It worked and the doc was superb icon_smile.gif

Thanks a lot icon_smile.gif

Murali.
Back to top
View user's profile Send private message
murali922

New User


Joined: 25 Jul 2005
Posts: 92
Location: India

PostPosted: Tue Feb 20, 2007 5:40 pm    Post subject: Re: Making a job abend if a dataset is not empty.
Reply with quote

Super Cool. The document was very useful icon_biggrin.gif

Thanks a lot...
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Tue Feb 20, 2007 6:24 pm    Post subject: Re: Making a job abend if a dataset is not empty.
Reply with quote

murali922 wrote:
Super Cool. It worked and the doc was superb icon_smile.gif
That is good to hear.
Did you manage to combine the function or have another step?
Could you post your solution?
Back to top
View user's profile Send private message
murali922

New User


Joined: 25 Jul 2005
Posts: 92
Location: India

PostPosted: Tue Feb 20, 2007 6:34 pm    Post subject:
Reply with quote

I added another step icon_smile.gif

Code:
PS050    EXEC PGM=ICETOOL                             
TOOLMSG  DD  SYSOUT=*                                 
DFSMSG   DD  SYSOUT=*                                 
INDD     DD  DSN=<data set name>,
             DISP=SHR                                 
TOOLIN   DD  *
  COUNT FROM(INDD) NOTEMPTY
/*                                                     
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4649
Location: Raleigh, NC, USA

PostPosted: Tue Feb 20, 2007 6:36 pm    Post subject: Re: Making a job abend if a dataset is not empty.
Reply with quote

Here's the question I have:

Do you use the DFSORT option as shown, but still have the follow-up job step that causes the abend to occur? Or, do you just incorporate both processes into a single user-written program?
Back to top
View user's profile Send private message
murali922

New User


Joined: 25 Jul 2005
Posts: 92
Location: India

PostPosted: Tue Feb 20, 2007 6:53 pm    Post subject:
Reply with quote

PS040 is a step which creates the SORTED file (INDD).
PS040 uses the following sort card :-

OPTION COPY
OUTFIL FILES=A,OUTREC(6,80),
INCLUDE=(2,3,CH,EQ,C'I -')
OUTFIL FILES=B,OUTREC(6,80),
INCLUDE=(2,3,CH,EQ,C'D -')

PS050 is the step which looks like what I have posted above.
PS050 uses the following as TOOLIN :-

COUNT FROM(INDD) NOTEMPTY
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Browse dataset cvnlynn CLIST & REXX 4 Tue Jul 18, 2017 3:52 am
No new posts C03 ABEND sjiraga PL/I & Assembler 1 Thu Jun 01, 2017 4:51 pm
No new posts Fileaid 2 commands instream work. In ... descann Compuware & Other Tools 2 Tue May 16, 2017 3:31 pm
No new posts To find out size allocated to a seque... ashek15 JCL & VSAM 15 Thu Apr 27, 2017 9:42 am
No new posts LISTCAT on a dataset with symbolic pa... shreya19 JCL & VSAM 5 Fri Apr 07, 2017 5:43 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us