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

Sort spaces after numbers


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

New User


Joined: 14 Sep 2005
Posts: 74
Location: Atlanta, (USA)

PostPosted: Wed Nov 21, 2007 3:18 am
Reply with quote

Hi,

I have the following situation

A 20070101 20071231
A 20071101 20071130
B 20071101
B 20071101 20071130

I need the following output

A 20071101 20071130
A 20070101 20071231
B 20071101 20071130
B 20071101


Basicly need to sort on date fields but the spaces should have priroty after numbers.
Please can you let me know how to achieve it using sort.
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 Nov 21, 2007 3:27 am
Reply with quote

It's not clear what you're actually sorting on. Please show the SORT statement you're using and indicate which field or fields have the dates that should have blanks collated after the numbers
Back to top
View user's profile Send private message
muffirulz

New User


Joined: 14 Sep 2005
Posts: 74
Location: Atlanta, (USA)

PostPosted: Wed Nov 21, 2007 3:31 am
Reply with quote

Hi,

The file layout is this

ID Date1 Date2
A 20070101 20071231
B 20071101
A 20071101 20071130
B 20071101 20071130

Basicly i need to sort in on id, date2 and then date1.
There are spaces in date2 field so I want then to have least priority.

ID Date1 Date2
A 20071101 20071130
A 20070101 20071231
B 20071101 20071130
B 20071101
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 Nov 21, 2007 4:07 am
Reply with quote

Here's a DFSORT job that will do what you asked for:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
A   20070101 20071231
B   20071101
A   20071101 20071130
B   20071101 20071130
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  ALTSEQ CODE=(40FA)
  OPTION NOCHALT
  SORT FIELDS=(1,1,CH,A,14,8,AQ,A,5,8,CH,A)
/*
Back to top
View user's profile Send private message
muffirulz

New User


Joined: 14 Sep 2005
Posts: 74
Location: Atlanta, (USA)

PostPosted: Wed Nov 21, 2007 9:12 pm
Reply with quote

Thanks Frank..

It worked perfect...
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 How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Generate random number from range of ... COBOL Programming 3
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
Search our Forums:

Back to Top