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
 

 

copy file to another if input file record count GT 250000

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: copy file to another if input file record count GT 250000
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    Post subject:
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: 1703
Location: Australia

PostPosted: Mon May 10, 2010 8:21 am    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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: 1703
Location: Australia

PostPosted: Mon May 10, 2010 4:53 pm    Post subject:
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    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Mon May 10, 2010 5:25 pm    Post subject: Reply to: copy file to another if input file record count GT
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: 1703
Location: Australia

PostPosted: Mon May 10, 2010 5:36 pm    Post subject:
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

Site Director


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

PostPosted: Mon May 10, 2010 7:53 pm    Post subject: Reply to: copy file to another if input file record count GT
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    Post subject:
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    Post subject:
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    Post subject:
Reply with quote

javalal,

Is this an addition to this requirement you posted earlier?

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

Active User


Joined: 27 Apr 2005
Posts: 236
Location: Cincinnati OH USA

PostPosted: Tue May 11, 2010 2:52 am    Post subject:
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    Post subject:
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: 1703
Location: Australia

PostPosted: Tue May 11, 2010 12:05 pm    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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

http://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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 5 Fri Dec 02, 2016 9:47 am
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 8 Thu Dec 01, 2016 8:28 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm


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