|
View previous topic :: View next topic
|
| Author |
Message |
atik
New User
Joined: 29 Jul 2005 Posts: 20
|
|
|
|
| I want to use SORT utility and OMIT some records depending on the condition and have those omitted records in one sequential file for usage in the future. Normally if we omit records, is there any method to have those records in a file. In what way we can do this? |
|
| Back to top |
|
 |
raghavendraun
New User

Joined: 29 Apr 2005 Posts: 9
|
|
|
|
Hi atik,
I think u can achive ur objective in two steps. In First step get only omitted records in one file, In Second step output file with some records omitted.
//STEP10 EXEC PGM=SORT
//SORTIN DD DSN=YOUR INPUT FILE,DISP=SHR
//SORTOUT DD DSN=OUTPUT FILE CONTAINING ONLY OMITTED RECs
//SYSIN DD *
INCLUDE COND=()
/*
//STEP20 EXEC PGM=SORT
//SORTIN DD DSN=YOUR INPUT FILE,DISP=SHR
//SORTOUT DD DSN=YOUR OUTPUT FILE WITH SOME RECs OMITTED
//SYSIN DD *
OMIT COND=()
/*
Is there any other methods, options or any errors in the above JCL guys please suggest.
Thanks,
Raghavendra U N |
|
| Back to top |
|
 |
shivashunmugam Muthu
Active User

Joined: 22 Jul 2005 Posts: 114 Location: Chennai
|
|
|
|
Add one more sort step with INCLUDE cond....for those OMITed fields..as U cant in same SORT step...
INCLUDE & OMIT are mutually exclusive |
|
| Back to top |
|
 |
raghavendraun
New User

Joined: 29 Apr 2005 Posts: 9
|
|
|
|
Hi shivashunmugam,
As you mentioned is correct, we can get the OMITed records by mentioning INCLUDE in both steps but, if for example u r giving
Condition as 'EQ' in first step just replace 'EQ' as 'NE' in second.
Here is another example Which will give me the same result using only single Step.
If u r using INCLUDE for file 2 as well use reverse logic, which is used for file 1.
| Code: |
//STEP10 EXEC PGM=SORT
//SORTIN DD DSN=YOUR INPUT FILE,DISP=SHR
//SORTOF1 DD DSN=OUTPUT FILE CONTAINING ONLY OMITTED RECs
// DISP=(NEW,CATLG,DELETE),
// UNIT=WORK,SPACE=(TRK,(100,10),RLSE),
// DCB=*.STEP10.SORTIN
//SORTOF2 DD DSN=OUTPUT FILE CONTAINING ONLY OMITTED RECs
// DISP=(NEW,CATLG,DELETE),
// UNIT=WORK,SPACE=(TRK,(100,10),RLSE),
// DCB=*.STEP10.SORTIN
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL FILES=1,INCLUDE=(...)
OUTFIL FILES=2,OMIT=(...)
/*
|
Guys correct me if I am wrong.
Thanks,
Raghavendra U N |
|
| Back to top |
|
 |
Prandip
New User
Joined: 04 Mar 2005 Posts: 84 Location: In my tiny cubicle ...
|
|
|
|
I think it would be easier to just use the SAVE option to keep all of the omitted records:
| Code: |
//STEP0001 EXEC PGM=SORT
//SORTIN DD DISP=SHR,DSN=INPUT
//SORTOF1 DD DSN=NON.OMITTED.RECORDS,DISP=(,CATLG,DELETE),...
//SORTOF2 DD DSN=OMITTED.RECORDS,DISP=(,CATLG,DELETE),...
//SYSOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
OUTFIL FILES=1,OMIT=(1,8,CH,EQ,C'XXXXXXXX')
OUTFIL FILES=2,SAVE
/*
|
|
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|