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

copy file to another if input file record count GT 250000


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
javalal

New User


Joined: 03 Oct 2007
Posts: 12
Location: Chennai,India

PostPosted: Sun May 09, 2010 11:23 pm
Reply with quote

Hi,

I have the below requirement.

I need to copy the content of one dataset into another data set by omiting few records based on the key value and also if the input file's record count greater than 250000. if the count is less than 250000, i need to abend the job and should not copy the file.
LRECL=5448, SORTKEY = (2,11,CH,A).
omit condition:
if key is 30000134024
30000140654
30000142062
30000142550
I need the sample JCL in DFSORT/ICETOOL to do this.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Mon May 10, 2010 8:16 am
Reply with quote

What is the condition for omitting records?
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Mon May 10, 2010 8:21 am
Reply with quote

Hi Sambhaji,

isn't this what the O/P wants
Quote:
omit condition:
if key is 30000134024
30000140654
30000142062
30000142550
or am I missing something ?

Gerry
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Mon May 10, 2010 8:58 am
Reply with quote

gcicchet wrote:
Hi Sambhaji,

isn't this what the O/P wants
Quote:
omit condition:
if key is 30000134024
30000140654
30000142062
30000142550
or am I missing something ?

Gerry

Ohhh Yeah, You right Gerry.... needs some more stretch on my eyes... It usually happens after weekend.. icon_sad.gif
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Mon May 10, 2010 12:58 pm
Reply with quote

Actually you can use just
Code:

//S1    EXEC  PGM=SORT                                             
//SORTIN DD DSN=...your input file here                           
//SORTOUT DD  DSN=....,DISP=(NEW,PASS)
//SYSOUT  DD  SYSOUT=*                                             
//SYSIN    DD  *                                                   
  SORT FIELDS=(8449,8,ZD,D)                                       
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(8449:SEQNUM,8,ZD))             
  OUTFIL INCLUDE=(8449,8,ZD,GE,250000),                           
  NULLOFL=RC16                                                     

Now based on RC of this step you can execute one more SORT STEP to omit records with your condition.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Mon May 10, 2010 1:19 pm
Reply with quote

This is simpler solution using ICETOOL.
Code:

//S1    EXEC  PGM=ICETOOL               
//SYSOUT    DD  SYSOUT=*               
//DFSMSG    DD  SYSOUT=*               
//TOOLMSG   DD  SYSOUT=*               
//IN  DD    DSN=...your input file here                                       
//TOOLIN   DD    *                     
  COUNT FROM(IN) LOWER(250000) RC4     
/*                                     
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Mon May 10, 2010 4:53 pm
Reply with quote

Hi,

just to be curious or picky, what happens if there are exactly 25000 records ?

So if the count is less than 25000 records the job should abend,
now using LOWER(25000) and there are exactly 25000 records, the return code will be 0 but 25000 is not GT than 25000.


Gerry
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Mon May 10, 2010 5:23 pm
Reply with quote

Gerry, OP wants job to abend when record count is less than 250000 not when rec count is 250000
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Mon May 10, 2010 5:25 pm
Reply with quote

... what it would be nice to know is the business logic behind the requirement icon_cool.gif
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Mon May 10, 2010 5:36 pm
Reply with quote

Hi Sambhaji,

OP also said
Quote:
I need to copy the content of one dataset into another data set by omiting few records based on the key value and also if the input file's record count greater than 250000



Gerry
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon May 10, 2010 7:53 pm
Reply with quote

Quote:
if the input file's record count greater than 250000
Before or after the OMITs have been processed?

Isn't this fun. . . icon_smile.gif

d
Back to top
View user's profile Send private message
javalal

New User


Joined: 03 Oct 2007
Posts: 12
Location: Chennai,India

PostPosted: Mon May 10, 2010 8:53 pm
Reply with quote

Hi,

My requirement is,

First i need to check whether the input file is more thatn 250000 records. if so, i need to copy the contenets to another file and OMIT few records based on the key.

IF the Input file is less than 250000 records, i need to abend the job and No need to copy the content of the input file. NO Output file need to be created.,

Hope i clear your question.
Back to top
View user's profile Send private message
javalal

New User


Joined: 03 Oct 2007
Posts: 12
Location: Chennai,India

PostPosted: Mon May 10, 2010 9:50 pm
Reply with quote

Hi,

I have executed the below code. but its copying record after the count 250000. its skips 249999 records. totally i have 321424 records in the input file. based on the condition, 249999 records were not copied.

Total Input records : 321424
Total records Matching OMIT Condition : 4
Total Records to be copied : 321420
But, Actual records Copied thru below code : 71421(which is 321424 - 4 - 249999).

please suggest me what changes need to be done in the below code.

Code:

//S1    EXEC  PGM=SORT                                             
//SORTIN DD DSN=...your input file here                           
//SORTOUT DD  DSN=....,DISP=(NEW,PASS)
//SYSOUT  DD  SYSOUT=*                                             
//SYSIN    DD  *                                                   
  SORT FIELDS=(8449,8,ZD,D)                                       
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(8449:SEQNUM,8,ZD))             
  OUTFIL INCLUDE=(8449,8,ZD,GE,250000),                           
  NULLOFL=RC16
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue May 11, 2010 1:19 am
Reply with quote

javalal,

Is this an addition to this requirement you posted earlier?

ibmmainframes.com/viewtopic.php?t=48578
Back to top
View user's profile Send private message
dneufarth

Active User


Joined: 27 Apr 2005
Posts: 419
Location: Inside the SPEW (Southwest Ohio, USA)

PostPosted: Tue May 11, 2010 2:52 am
Reply with quote

per Escapa

Quote:
Now based on RC of this step you can execute one more SORT STEP to omit records with your condition.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue May 11, 2010 10:14 am
Reply with quote

javalal wrote:
Hi,

I have executed the below code. but its copying record after the count 250000. its skips 249999 records. totally i have 321424 records in the input file. based on the condition, 249999 records were not copied.

The step was just to check the count and set RC. based on this you were suppose to add one more step to omit records.
Use below solution to get desired result.
Code:

//S1        EXEC  PGM=ICETOOL                 
//SYSOUT    DD  SYSOUT=*                       
//DFSMSG    DD  SYSOUT=*                       
//TOOLMSG   DD  SYSOUT=*                       
//OUT       DD  SYSOUT=*                       
//IN        DD    DSN=...YOUR INPUT FILE HERE 
//TOOLIN    DD    *                           
  COUNT FROM(IN) LOWER(250000) RC4             
/*                                             
//S2        EXEC  PGM=SORT,COND=(0,NE)         
//SORTIN    DD DSN=...YOUR INPUT FILE HERE     
//SORTOUT   DD DSN=...YOUR OUTPUT FILE HERE   
//SYSOUT    DD  SYSOUT=*                       
//SYSIN     DD  *                             
  OPTION COPY                                 
  OMIT COND=(1,11,CH,EQ,C'30000134024')       
/*                                             
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Tue May 11, 2010 12:05 pm
Reply with quote

Hi,

for the last time and yes I'm being picky,

less than 25000 results in numbers LE 24999

greater than 25000 results in nunbers GE 25001

So again what happens when the file has exactly 25000 records,
it doesn't fit in the less than 25000 category nor does it fit in the greater than 25000 category.

Gerry
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue May 11, 2010 12:49 pm
Reply with quote

Quote:

I need to copy the content of one dataset into another data set by omiting few records based on the key value and also if the input file's record count greater than 250000

if the count is less than 250000, i need to abend the job and should not copy the file.

Ohh.. I got it now...
Lot mess understanding requiremnt from my side
Quote:
So again what happens when the file has exactly 25000 records,
it doesn't fit in the less than 25000 category nor does it fit in the greater than 25000 category

YES, You are correct. This is the question mark.... So weird requirement...
Back to top
View user's profile Send private message
Alexis Sebastian

New User


Joined: 04 Mar 2010
Posts: 38
Location: DC

PostPosted: Tue May 11, 2010 6:52 pm
Reply with quote

Hi Sambhaji,

Is it possible to have a COPY in the same step based on the return code of the previous statement?

For ex,
Code:
 COUNT FROM(IN) LOWER(250000) RC4 

if input file contains less than 250000 records then, RC will be set as 4. Based on this RC, can we use
Code:
 COPY FROM(IN) TO(OUT)


Just curiuos to know.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue May 11, 2010 9:58 pm
Reply with quote

Alexis Sebastian,

You can use MODE STOP to skip further processing. Look at the smart DFSORT trick "Set RC=12 or RC=4 if file is empty, has more than n records, etc" which shows an example

www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000094
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 8
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts To get the count of rows for every 1 ... DB2 3
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
Search our Forums:

Back to Top