Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Sort the fields leaving the sign integer

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Sort the fields leaving the sign integer
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 Moderator


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

PostPosted: Wed Dec 21, 2005 10:08 pm    Post subject:
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    Post subject: Re: Sort the fields leaving the sign integer
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 Moderator


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

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

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Innovations in Your Mainframe Sort Arun Raj PC Guides & IT News 4 Wed Mar 15, 2017 10:38 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts SORT requirement sjiraga COBOL Programming 6 Thu Mar 09, 2017 9:11 pm
No new posts SORT to append Month and YEAR in MMYY... tisamf DFSORT/ICETOOL 1 Wed Mar 08, 2017 4:46 pm
No new posts DFSORT MUL FIELDS tspr52 DFSORT/ICETOOL 16 Fri Mar 03, 2017 11:53 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us