View previous topic :: View next topic
|
Author |
Message |
ykishore
New User
Joined: 12 Aug 2005 Posts: 53 Location: USA
|
|
|
|
Hi
here is my requirement.
i've a Sequential file which has DATE field. and format of the date field is:MM/DD/YYYY. for eg:08/26/2005. but my requirement is i want to sort the data based on the date(Year part) filed. can you guys please provide me the JCL for the same??? and i want to sort it on Descending order.
For Eg:
08/26/2005
08/10/2004
01/12/2005
10/10/2003
output :
---------
08/26/2005
01/12/2005
08/10/2004
10/10/2003 |
|
Back to top |
|
|
suganthyprabha
New User
Joined: 28 Jul 2005 Posts: 58
|
|
|
|
Hi Ykishore,
You can code like this.
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file
//SORTOUT DD DSN=... output file
//SYSIN DD *
* Sort mm/dd/yyyy on yyyy, mm and dd.
SORT FIELDS=(7,4,CH,D,1,2,CH,D,4,2,CH,D)
/*
|
Thanks and Regards,
Suganthy. |
|
Back to top |
|
|
Rupesh.Kothari
Member of the Month
Joined: 27 Apr 2005 Posts: 463
|
|
|
|
Hi
Try this code code
//SORTTST JOB (ACCT#),'SORT ',NOTIFY=&SYSUID,CLASS=T,MSGCLASS=X
//STEP01 EXEC PGM=SORT
//SORTIN DD DSN=Inputdatase name,DISP=SHR
//SORTOUT DD DSN=Out put dataset name,DISP=SHR
//SYSIN DD *
SORT FIELDS=(7,4,CH,D)
/*
//* where year part start from 7 the column
//SYSOUT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
Regards
Rupesh |
|
Back to top |
|
|
radhakrishnan82
Active User
Joined: 31 Mar 2005 Posts: 435 Location: chennai, India
|
|
Back to top |
|
|
MGIndaco
Active User
Joined: 10 Mar 2005 Posts: 432 Location: Milan, Italy
|
|
|
|
Which is the difference between the method above and
the use of inrec as(in term of performance):
Code: |
INREC OVERLAY=(81:7,4,1,2,4,2)
SORT FIELDS=(81,8,D),FORMAT=CH
OUTREC FIELDS=(1,80) |
? |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
In general, the job with just the SORT statement will be more efficient than the job with the INREC, SORT and OUTREC statement because INREC and OUTREC require extra data movement. |
|
Back to top |
|
|
MGIndaco
Active User
Joined: 10 Mar 2005 Posts: 432 Location: Milan, Italy
|
|
|
|
So, it's better to sort 3 separate keys instead of creating one contiguous key to sort with INREC?
Thanks a lot. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
In general, yes (there are always exceptions). That's especially true for large keys because adding a copy of the keys at the end of the record with INREC will increase the amount of data being sorted. For example if you have a 500-byte record with 3 100-byte keys and you copy those keys at the end, you've now increased the size of the records to sort from 500 bytes to 800 bytes which is a significant increase in the amount of data being sorted. |
|
Back to top |
|
|
ykishore
New User
Joined: 12 Aug 2005 Posts: 53 Location: USA
|
|
|
|
Hi all
Thanx alot!!!! |
|
Back to top |
|
|
|