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

How to sort the even number of records from file using jcl


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

New User


Joined: 05 Sep 2004
Posts: 21

PostPosted: Sun Sep 05, 2004 4:45 pm
Reply with quote

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
View user's profile Send private message
Ramya A

Active User


Joined: 26 Jul 2004
Posts: 104

PostPosted: Sat Sep 11, 2004 12:23 pm
Reply with quote

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
View user's profile Send private message
badal

New User


Joined: 05 Sep 2004
Posts: 21

PostPosted: Sun Jun 05, 2005 9:58 pm
Reply with quote

Hi,
thanks for replay.
badal.[/b]
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Mon Jun 06, 2005 1:32 am
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Mon Jun 06, 2005 9:45 pm
Reply with quote

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
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 FTP VB File from Mainframe retaining ... JCL & VSAM 1
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top