Strange REPEAT behaviour

Infosphere's Quality Product

Moderators: chulett, rschirm

Post Reply
U
Participant
Posts: 230
Joined: Tue Apr 17, 2007 8:23 pm
Location: Singapore

Strange REPEAT behaviour

Post by U »

We are trying to create PAL code to remove comments from email addresses such as ROBERT(BOB).KATTER@NP.ORG.AU

Here is the code fragment involved.

Code: Select all

;---------------------------------------------------------------------------------
; Remove Comments
;---------------------------------------------------------------------------------

*\( | ** | \)
CONCAT " " temp
CONCAT [1] temp
COPY_S [2] guts
CONCAT guts temp
CONCAT [3] temp
CONCAT temp {Comment}
RETYPE [1] 0
RETYPE [2] 0
RETYPE [3] 0
REPEAT
With only one comment, as above, the code works well.
The residual is "ROBERT.KATTER@NP.ORG.AU" and Comment contains "(BOB)".

However, when the source data has more than one comment, there is duplication in the Comment field.
For example, from source "ROBERT(BOB).KATTER@NP.GOV.AU(FNQ)" the Comment field contains "(BOB) (BOB) (FNQ)".

From source "ROBERT(BOB).KATTER(THE HAT)@(FEDERAL)NP.ORG.AU(FNQ)" the Comment field contains "(BOB) (BOB) (THE HAT) (BOB) (THE HAT) (FEDERAL) (BOB) (THE HAT) (FEDERAL) (FNQ)".

What might be going on here? It appears that the RETYPE to null class actions are not being heeded, and the entire input is being scanned each time.

We have established that it is not permissible to use the form 0*\( | ** | \)

Thank you for your time.
stuartjvnorton
Participant
Posts: 527
Joined: Thu Apr 19, 2007 1:25 am
Location: Melbourne

Post by stuartjvnorton »

You're not clearing out temp each time you hit a comment.

Try

COPY "" temp

prior to the initial

CONCAT " " temp
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Stuart beat me to it. You need to clear the temp variable.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
U
Participant
Posts: 230
Joined: Tue Apr 17, 2007 8:23 pm
Location: Singapore

Post by U »

Thank you for your replies. As usual you were right "on the money".
Post Reply