If your totarget immediately follows the fromtarget, they're triggering on
the same record.  You need to bypass feeding the first record to the
totarget.

Simplest case, you don't want keep the separator records:

...
'|fromtarget locate /file/',
'|drop 1',
'|totarget locate /file/",
...

If you want to keep the separator,

...
'|fromtarget locate /file/',
'|a:take 1',
'|b:Fanin',
...
'?a:|totarget locate /file/',
'|b:'
...

For recursion you'd want a sipping rexx stage:

Signal on error
i = 0
Do forever
  'Peekto'  /* check another record */
  i = i + 1
  'Callpipe *:|Fromtarget locate /file/|a:take 1|b:fanin|> file'i 'data
a?a:|totarget locate /file/|b:'
  End
--
Mike Harding
z/VM System Support
/sp


CMSTSO Pipelines Discussion List <[email protected]> wrote on
10/06/2015 10:16:57 AM:

> From: Rick Barlow <[email protected]>
> To: [email protected]
> Date: 10/06/2015 10:17 AM
> Subject: Split a file into multiple files based on a string in the data
> Sent by: CMSTSO Pipelines Discussion List <[email protected]>
>
> I want to take a single file and split it into multiple files based on a
> string in the data. I don't know how many parts are in the original file.
> The string is not necessarily at the beginning of a record.
> Example:
>
> This is file 1
> rec1
> rec2
> This is the beginning of file 2
> f2rec1
> f2rec2
> f2rec3
> f2rec3
> This is file 3
> f3rec1
> f3rec2
> I want to end up with 3 files. I know I can use fromtarget locate /file/.
I
> haven't been able to find a way to go totarget locate /file/ because it
> does not select anything. I also haven't been able to come up with a way
to
> do this recursively. I know that I am probably overlooking something
> relatively obvious. Any suggestions would be appreciated.
>
> Rick Barlow
> Nationwide Insurance
>

Reply via email to