Page 1 of 1

also want to include som records

PostPosted: Wed Dec 03, 2014 1:00 pm
by GoranAndersson
I have a file where the recorde look like this
i use ICETOOL
The file is format VB
i also want to include only the files who has the number 0146 in the 6 kolumn.
I try a lot but it dont work


I|98|300012723|9814334|55|9F37|0|0|M|5CC7161B||
I|98|300012723|9814334|55|9F41|0|0|M|00000011||
I|98|3012723|9814334|55|9F53|0|0|M|52||
I|98|300012735|9814334|48|0023|0|0|POI|||
I|98|300735|9814334|48|0146|0|0|001901840000000000245978000000000180|||
I|98|300012735|9814334|48|0148|0|0|8402|||

As you see the columns is separeted with |
I sorted this file in kolumn3

INREC PARSE=(%=(ENDBEFR=C'|'),
%=(ENDBEFR=C'|'),
%03=(ENDBEFR=C'|',FIXLEN=10)),
BUILD=(1,4,5:%03,15:5)
SORT FIELDS=(5,10,UFF,A)
OUTREC BUILD=(1,4,15)

Göran Andersson

Re: also want to include som records

PostPosted: Wed Dec 03, 2014 2:00 pm
by BillyBoyo
You'll need six PARSE fields (five can be dummies, like you have the two so far) to get to the 0146. You then need to temporarily extend your record by that field and select on it if you only want those records written, then you'll need OUTFIL with INCLUDE=. If you don't need the data SORTed, then don't SORT. BUILD=(1,4,%parse-field,5) to store the field, 1,4,15) to get rid of it onces used, in OUTFIL.

Re: also want to include som records

PostPosted: Wed Dec 03, 2014 2:29 pm
by GoranAndersson
I think i try rhis but it dont work

INREC PARSE=(%=(ENDBEFR=C'|'),
%=(ENDBEFR=C'|'),
%03=(ENDBEFR=C'|',FIXLEN=10),
%=(ENDBEFR=C'|'),
%=(ENDBEFR=C'|'),
%06=(ENDBEFR=C'|',FIXLEN=04)),
BUILD=(1,4,5:%03,15:%06,19:5)
SORT FIELDS=(5,10,UFF,A)
OUTFIL FNAMES=B797501,
INCLUDE=(15,4,CH,EQ,C'0146')
OUTREC FIELDS=(1,4,19)

Ineed the sort the prblem is that 6 koliumn whith the value 0146 dont be in a fix position

Re: also want to include som records

PostPosted: Wed Dec 03, 2014 3:03 pm
by BillyBoyo
 INREC PARSE=(%=(ENDBEFR=C'|'),
      %=(ENDBEFR=C'|'),
      %03=(ENDBEFR=C'|',FIXLEN=10),
      %=(ENDBEFR=C'|'),
      %=(ENDBEFR=C'|'),
      %06=(ENDBEFR=C'|',FIXLEN=05)),
      BUILD=(1,4,%03,%06,5)
      SORT FIELDS=(5,10,UFF,A)
      OUTFIL FNAMES=B797501,
      INCLUDE=(15,5,CH,EQ,C'0146 '),
       BUILD=(1,4,20)


That's first a simplification. I've made the length of number six field five bytes, just to show how to avoid false hits.

Then a correction. You had OUTREC FIELDS= (use BUILD=) after the OUTFIL. It doesn't matter the order you put them in, SORT is going to process them in its standard order, OUTREC before OUTFIL. So try now.

Re: also want to include som records

PostPosted: Wed Dec 03, 2014 4:58 pm
by GoranAndersson
Magic, it works thx
you take fixlen =05 the kolumn its only 4

Many thanks

Göran Andersson