|
View previous topic :: View next topic
|
| Author |
Message |
RedDevil711
New User
.jpg)
Joined: 04 Jun 2010 Posts: 25 Location: Pune
|
|
|
|
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
SORT FIELDS=COPY
INCLUDE COND=(46,3,FS,EQ,NUM)
Please guide me on this  |
|
| Back to top |
|
 |
dbzTHEdinosauer
Global Moderator

Joined: 20 Oct 2006 Posts: 6965 Location: porcelain throne
|
|
|
|
| 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 |
|
 |
RedDevil711
New User
.jpg)
Joined: 04 Jun 2010 Posts: 25 Location: Pune
|
|
|
|
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 |
|
 |
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1217 Location: Dublin, Ireland
|
|
|
|
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 |
|
 |
superk
Global Moderator

Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
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 |
|
 |
enrico-sorichetti
Superior Member

Joined: 14 Mar 2007 Posts: 10903 Location: italy
|
|
|
|
| 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  |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|