Parse in a vb file



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Parse in a vb file

Postby krishnaraj6eee » Wed May 17, 2017 12:22 pm

Hi,

"Please correct me wherever i'm wrong"

I'm Trying to parse an variable record where my records are having "start" keyword or "end" keyword or both.
if my record is having "start" keyword i need the data only after that keyword.
if my record is having "end" keyword i need the data only before that keyword.
if my record is having both "start" and "end" keyword i need the data in between "start" and "end".
if there is none of the keyword is present i want to skip that record.


OPTION COPY
OUTREC IFTHEN=(WHEN=INIT,
PARSE=(%01=(STARTAT=C'start',FIXLEN=80))),
IFTHEN=(WHEN=INIT,
PARSE=(%02=(ENDBEFR=c'end',FIXLEN=80)),
BUILD=(%01,%02))



This is what i tried but am getting all the records.. since i'm using option copy it is giving me all the records(?).. i don't know how to filter first then apply the parse.
edited to align the content to the correction made by the ts
krishnaraj6eee
 
Posts: 9
Joined: Tue Jan 17, 2017 1:36 pm
Has thanked: 1 time
Been thanked: 0 time

Re: Parse in a vb file

Postby krishnaraj6eee » Wed May 17, 2017 1:38 pm

sorry
if my record is having "start" keyword i need the data only before that keyword.

it is
if my record is having "end" keyword i need the data only before that keyword.
krishnaraj6eee
 
Posts: 9
Joined: Tue Jan 17, 2017 1:36 pm
Has thanked: 1 time
Been thanked: 0 time

Re: Parse in a vb file

Postby Robert Sample » Thu May 18, 2017 12:15 am

Use an INCLUDE for "start" and "end" to get rid of the records you don't want. I've done some looking at the PARSE options but haven't found any set of them that generates what you want.
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: Parse in a vb file

Postby krishnaraj6eee » Thu May 18, 2017 8:45 am

Thanks Robert.
And i failed to mention that the position of the keywords may change in every record.. It is not fixed.. I need to mention the field position for using include right?
krishnaraj6eee
 
Posts: 9
Joined: Tue Jan 17, 2017 1:36 pm
Has thanked: 1 time
Been thanked: 0 time

Re: Parse in a vb file

Postby Robert Sample » Thu May 18, 2017 9:47 pm

Not if you use SS:
 INCLUDE COND=(1,<record length>,SS,EQ,C'START',OR,  
               1,<record length>,SS,EQ,C'END')      
where you change <record length> to the appropriate value.
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: Parse in a vb file

Postby Aki88 » Fri May 19, 2017 6:28 pm

Hello,

Can you please show the representational input data and expected output for the conditions you've mentioned?

Thank you.
Aki88
 
Posts: 381
Joined: Tue Jan 28, 2014 1:52 pm
Has thanked: 33 times
Been thanked: 36 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post