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 to include numeric data only

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
RedDevil711

New User


Joined: 04 Jun 2010
Posts: 25
Location: Pune

PostPosted: Thu Jul 01, 2010 4:22 pm    Post subject: SORT to include numeric data only
Reply with quote

Hi ,
I have an input PS : having the following details

Code:
011D                                 M  ABC
011D                                 M  DEF
011D                                 M  124


I need to retrevie only the third record as it has numeric input at '124' but the copybook declaration for the field is characters. Can we write a sort to retreive only records consisting of numeric data at the position mentioned ?
I used the below sort but it did not serve the purpose icon_sad.gif
SORT FIELDS=COPY
INCLUDE COND=(46,3,FS,EQ,NUM)
Please guide me on this icon_sad.gif
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6967
Location: porcelain throne

PostPosted: Thu Jul 01, 2010 5:47 pm    Post subject:
Reply with quote

Quote:
I used the below sort but it did not serve the purpose


does not really help- explains nothing.

are you sure that 46 for 3 is the correct positioning?
according to your layout, it is 41 for 3.
is the file fixed or variable length?
if it is var, then it would be 45 for 3. +4 for the RDW
Back to top
View user's profile Send private message
RedDevil711

New User


Joined: 04 Jun 2010
Posts: 25
Location: Pune

PostPosted: Thu Jul 01, 2010 5:58 pm    Post subject:
Reply with quote

It is 41,3 only
i calculated incorrectly ,
Also it is a fixed length file only
I used the following combination of sort too :

SORT FIELDS=COPY
INCLUDE COND=(41,3,CH,GE,C'000',AND,41,3,CH,LE,C'999')
Back to top
View user's profile Send private message
Garry Carroll

Active Member


Joined: 08 May 2006
Posts: 994
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Thu Jul 01, 2010 6:29 pm    Post subject:
Reply with quote

I got this working with

Code:
  OPTION COPY                                         
  INCLUDE COND=(41,3,CH,GE,C'000',AND,41,3,CH,LE,C'999')


are you sure of your field alignment?

Garry.
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Thu Jul 01, 2010 6:37 pm    Post subject: Reply to: SORT to include numeric data only
Reply with quote

Well, all I can say is that:

Code:

  OPTION COPY
  INCLUDE COND=(41,3,FS,EQ,NUM)


did work for me as expected.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10255
Location: italy

PostPosted: Thu Jul 01, 2010 6:51 pm    Post subject: Reply to: SORT to include numeric data only
Reply with quote

Code:
INCLUDE COND=(41,3,CH,GE,C'000',AND,41,3,CH,LE,C'999')


with that condition something like '0AB' would pass,
remember ... '000' < '0AB' < '999'

using this approach You should check each column
(41,1,CH,GE,C'0',AND,41,1,CH,LE,C'9',AND,42,1,CH,GE,C'0',AND,42,1,CH,LE,C'9',AND,43,1,CH,GE,C'0',AND,43,1,CH,LE,C'9')

my post does not relate to the best way of solving the issue with sort,
just points out a logic flaw icon_biggrin.gif
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 How to change 'K' or 'M' use Sort vice_versa DFSORT/ICETOOL 5 Thu May 18, 2017 7:11 am
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
This topic is locked: you cannot edit posts or make replies. SORT trick needed bshkris SYNCSORT 6 Tue May 02, 2017 4:35 am


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