IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Making a job abend if a dataset is not empty.


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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
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: 89
Location: Stockholm, Sweden

PostPosted: Tue Feb 20, 2007 1:18 am
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
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
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: 3156
Location: Tucson AZ

PostPosted: Tue Feb 20, 2007 2:13 am
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
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
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: 3156
Location: Tucson AZ

PostPosted: Tue Feb 20, 2007 6:24 pm
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
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

Global Moderator


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

PostPosted: Tue Feb 20, 2007 6:36 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts ISAM and abend S03B JCL & VSAM 10
No new posts Allocated cylinders of a dataset DB2 12
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
Search our Forums:

Back to Top