View previous topic :: View next topic
|
Author |
Message |
ranganathanv
New User
Joined: 24 Aug 2007 Posts: 4 Location: bangalore
|
|
|
|
Please let me know how to split a file using SORT into Multiple files based on key field.
In this case the key field is Month. For ex
01 XXX
02 YYY
03 ZZZ
04 AAA
This has to split into 4 files. The next month the key fields change to
02 XXX
03 YYY
04 ZZZ
05 AAA
So the Key field values are dynamic but it would contain only 4 values |
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
ranganathan,
Your requirement is not clear. Provide more info with examples. |
|
Back to top |
|
|
ranganathanv
New User
Joined: 24 Aug 2007 Posts: 4 Location: bangalore
|
|
|
|
THE PARENT FILE CONTAINS FOLLOWING RECORDS FOR THIS MONTH
06 XXX
07 YYY
08 NNN
09 MMM
WHERE 06, 07 , 08, 09 ARE THE KEYS
OUTPUT FILES SHOULD CONTAIN
FILE 1:
06 XXX
FILE 2
07 YYY
FILE 3:
08 NNN
FILE 4:
08 MMM
THE NEXT MONTH DATE IN PARENT FILE CHANGES TO
07 YYY
08 NNN
09 MMM
10 PPP
OUTPUT FILES SHOULD CONTAIN
FILE 1:
07 YYY
FILE 2
08 NNN
FILE 3:
09 MMM
FILE 4:
10 PPP |
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
ranganathan,
Does your IP file contain only MONTH part? If not, what is the date format (like ddmmyy/mmddyyyy etc...).
Also post your file attribs. |
|
Back to top |
|
|
ranganathanv
New User
Joined: 24 Aug 2007 Posts: 4 Location: bangalore
|
|
|
|
The IP file contains only the Month part. Ex: 06
File attributes
RECFM=FB
LRECL=1768 |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Quote: |
Please let me know how to split a file using SORT into Multiple files
... the Key field values are dynamic but it would contain only 4 values |
Here's a DFSORT job that will do what you asked for:
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (4 records)
//OUT1 DD DSN=... output file (first record)
//OUT2 DD DSN=... output file (second record)
//OUT3 DD DSN=... output file (third record)
//OUT4 DD DSN=... output file (fourth record)
//SYSIN DD *
OPTION COPY
OUTFIL FNAMES=(OUT1,OUT2,OUT3,OUT4),SPLIT
/*
|
|
|
Back to top |
|
|
|