View previous topic :: View next topic
|
Author |
Message |
javalal
New User
Joined: 03 Oct 2007 Posts: 12 Location: Chennai,India
|
|
|
|
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 |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
What is the condition for omitting records? |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
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 |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
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.. |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
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 |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
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 |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
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 |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Gerry, OP wants job to abend when record count is less than 250000 not when rec count is 250000 |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
... what it would be nice to know is the business logic behind the requirement |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Quote: |
if the input file's record count greater than 250000 |
Before or after the OMITs have been processed?
Isn't this fun. . .
d |
|
Back to top |
|
|
javalal
New User
Joined: 03 Oct 2007 Posts: 12 Location: Chennai,India
|
|
|
|
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 |
|
|
javalal
New User
Joined: 03 Oct 2007 Posts: 12 Location: Chennai,India
|
|
|
|
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 |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
Back to top |
|
|
dneufarth
Active User
Joined: 27 Apr 2005 Posts: 419 Location: Inside the SPEW (Southwest Ohio, USA)
|
|
|
|
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 |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
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 |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
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 |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
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 |
|
|
Alexis Sebastian
New User
Joined: 04 Mar 2010 Posts: 38 Location: DC
|
|
|
|
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 |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
Back to top |
|
|
|