|
|
| Author |
Message |
pkmainframe
New User
Joined: 14 Jun 2005 Posts: 19 Location: India
|
|
|
|
Hi
Is there a way we can sort the fields leaving the sign integer. Example i would like to sort the data -1000,200, 500 when i do the asending order sort i should get 200,500,1000 leaving the negative sign! is there a way to solve this using sort.
Thanks for your time. |
|
| Back to top |
|
 |
References
|
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4684 Location: San Jose, CA
|
|
|
|
| You can do that with DFSORT, but exactly how depends on what your input fields actually look like and what you want the output to look like. Please show an example of your input records and what you want the output records to look like. What is the starting position and length of the field you want to sort on? What is the RECFM and LRECL of your input file? |
|
| Back to top |
|
 |
pkmainframe
New User
Joined: 14 Jun 2005 Posts: 19 Location: India
|
|
|
|
Hi Frank,
My input file looks like one below:
=COLS> ----+----1----+----2----+----3----+----4----
****** ***************************** Top of Data **
000001 -10000
000002 200
000003 -800
000004 -1200
****** **************************** Bottom of Data
I need the output like one below:
=COLS> ----+----1----+----2----+----3----+----4----+
****** ***************************** Top of Data ***
000001 200
000002 800
000003 1200
000004 10000
****** **************************** Bottom of Data ***
LRECL is 80 and recfm is FB, can we do this if we have a packed decimal field variable of length S9(8)v9(2) or s9(8). let me know how my sort statement should look like.
let me know if you need any more information. and once again thanks for yor time
Kumar |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4684 Location: San Jose, CA
|
|
|
|
Kumar,
As shown in the table at:
http://www.ibm.com/servers/storage/support/software/sort/mvs/professor_sort/srtmacfm.html
S9(8) is an 8-byte ZD field and S9(8)v9(2) is a 6-byte PD field.
To do what you want for an 8-byte ZD field starting in position 1, you can use this DFSORT job:
| Code: |
//ZD EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file
//SORTOUT DD DSN=... output file
//SYSIN DD *
INREC IFTHEN=(WHEN=(1,8,ZD,LT,+0),
OVERLAY=(1:1,8,ZD,MUL,-1,TO=ZD,LENGTH=8))
SORT FIELDS=(1,8,ZD,A)
/*
|
To do what you want for a 6-byte PD field starting in position 1, you can use this DFSORT job:
| Code: |
//PD EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file
//SORTOUT DD DSN=... output file
//SYSIN DD *
INREC IFTHEN=(WHEN=(1,6,PD,LT,+0),
OVERLAY=(1:1,6,PD,MUL,-1,TO=PD,LENGTH=6))
SORT FIELDS=(1,6,PD,A)
/*
|
You'll need z/OS DFSORT V1R5 PTF UQ95214 or DFSORT R14 PTF UQ95213 (Dec, 2004) in order to use DFSORT's IFTHEN and OVERLAY functions. Only DFSORT has these functions, so if you don't have DFSORT, you won't be able to use them. If you do have DFSORT, but you don't have the Dec, 2004 PTF, ask your System Programmer to install it (it's free). For complete details on all of the new DFSORT and ICETOOL functions available with the Dec, 2004 PTF, see:
www.ibm.com/servers/storage/support/software/sort/mvs/pdug/ |
|
| Back to top |
|
 |
|
|
|