View previous topic :: View next topic
|
Author |
Message |
badal
New User
Joined: 05 Sep 2004 Posts: 21
|
|
|
|
hai
any can one tell me ,how to sort the even number of records from file using jcl
thaknk u in advance |
|
Back to top |
|
|
Ramya A
Active User
Joined: 26 Jul 2004 Posts: 104
|
|
|
|
Let me check if my understanding is right. You need the alternate records from your input to your output. If this is right, then pls find the answer below:
Using ICEMAN, you can do the requested operation.
SPLIT is a way to split up a data set. It can be used to split the records as evenly as possible among the output data sets. SPLIT writes one record to each output data set in rotation.
Here's an example of SPLIT for an input data set with 10 records:
//SPLIT EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=Y897797.INPUT1,DISP=OLD
//OUT1 DD DSN=Y897797.SPLIT1,DISP=(NEW,CATLG),
// SPACE=(CYL,(5,5)),UNIT=SYSDA
//OUT2 DD DSN=Y897797.SPLIT2,DISP=(NEW,CATLG),
// SPACE=(CYL,(5,5)),UNIT=SYSDA
//SYSIN DD *
SORT FIELDS=(21,5,FS,A)
OUTFIL FNAMES=(OUT1,OUT2),SPLIT
/*
The first sorted record is written to the OUT1 data set, the second sorted record is written to the OUT2 data set and the third sorted record is written to the OUT1 data set, and so on in rotation.
The resulting output data sets would contain the following records:
Y897797.SPLIT1 (OUT1 DD)
sorted record 1
sorted record 3
sorted record 5
sorted record 7
sorted record 9
Y897797.SPLIT2 (OUT2 DD)
sorted record 2
sorted record 4
sorted record 6
sorted record 8
sorted record 10
Now the second file will give you the even number of records. |
|
Back to top |
|
|
badal
New User
Joined: 05 Sep 2004 Posts: 21
|
|
|
|
Hi,
thanks for replay.
badal.[/b] |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
If you just need the even sorted records (2, 4, 6, ...), you can also do it using this DFSORT job:
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file
//SORTOUT DD DSN=... output file
//SYSIN DD *
SORT FIELDS=(...)
OUTFIL STARTREC=2,SAMPLE=2
/*
|
|
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Quote: |
without ICEMAN, in DFHSORT also u can sort these problems. |
This makes no sense. ICEMAN is DFSORT. What is DFHSORT?
You asked how to sort the even numbered records. I showed you an easier way to do that with DFSORT. I don't understand the point of your post. |
|
Back to top |
|
|
|