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

Sort the fields leaving the sign integer


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

New User


Joined: 14 Jun 2005
Posts: 16
Location: India

PostPosted: Wed Dec 21, 2005 6:46 pm
Reply with quote

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

DFSORT Developer


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

PostPosted: Wed Dec 21, 2005 10:08 pm
Reply with quote

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

New User


Joined: 14 Jun 2005
Posts: 16
Location: India

PostPosted: Thu Dec 22, 2005 5:38 pm
Reply with quote

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

DFSORT Developer


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

PostPosted: Thu Dec 22, 2005 10:38 pm
Reply with quote

Kumar,

As shown in the table at:

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:

Use [URL] BBCode for External Links
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 Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
Search our Forums:

Back to Top