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

SORT to include numeric data only


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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: 6966
Location: porcelain throne

PostPosted: Thu Jul 01, 2010 5:47 pm
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
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

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Thu Jul 01, 2010 6:29 pm
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

Global Moderator


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

PostPosted: Thu Jul 01, 2010 6:37 pm
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu Jul 01, 2010 6:51 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to save SYSLOG as text data via P... All Other Mainframe Topics 1
No new posts Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts Store the data for fixed length COBOL Programming 1
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
Search our Forums:

Back to Top