Hello everyone there.
I'm having problems creating one routine and I can't realize where the hell the error is. I presume it's related with some order or basic sintaxs stuff. I wonder whether some of you can evangelize me and let me find the answer.
This are the parameters for the routine:
Kstar
PathArchivoOrigen
CantidadCampos
PathArchivoDestino
This is the error message I'm getting:
REPEAT" unexpected, Was expecting: Array Name, Variable name,
New variable name, ';', Statement label, "ABORT", "ABORTE", "ABORTM",
"BEGIN", "BREAK", "CALL", "CHAIN", "CLEAR", "CLEARCOM", and so on....
This is the routine code:
PathOrigen = PathArchivoOrigen
RegistroDestino = ''
NoCumple = 0
OpenSeq PathOrigen To VariableFileOrigen Then
Loop
While ReadSeq RecordString From VariableFileOrigen
If Field(RecordString, ",", 6) = Kstar then
ValOption = Field(RecordString, ",", 5)
ValFrom = Field(RecordString, ",", 6)
ValTo = Field(RecordString, ",", 7)
Exit
End Else
ValOption = 'NN'
End
Repeat
CloseSeq VariableFileOrigen
OpenSeq PathOrigen To VariableFileOrigen then
PathDestino = PathArchivoDestino :ValOption
Loop
While ReadSeq RecordString From VariableFileOrigen
ValToActual = Field(RecordString, ",", 6)
ValFromActual = Field(RecordString, ",",7)
For CampoActual = 1 to CantidadCampos
RegistroDestino = RegistroDestino :",":Field(RecordString, ",", CampoActual)
Next CampoActual
OpenSeq PathDestino To VariableFileDestino Then
Begin Case
Case ValOption = 'EQ'
If ValFromActual = ValFrom
then WriteSeq RegistroDestino To VariableFileDestino
else NoCumple = NoCumple + 1
Case ValOption = 'NE'
If ValFromActual <> ValFrom
then WriteSeq RegistroDestino To VariableFileDestino
else NoCumple = NoCumple + 1
Case ValOption = 'BT'
If ValFromActual > ValFrom AND ValToActual < ValTo
then WriteSeq RegistroDestino To VariableFileDestino
else NoCumple = NoCumple + 1
Case ValOption = 'LE'
If ValFromActual <= ValFrom
then WriteSeq RegistroDestino To VariableFileDestino
else NoCumple = NoCumple + 1
Case ValOption = 'GT'
If ValFromActual > ValFrom
then WriteSeq RegistroDestino To VariableFileDestino
else NoCumple = NoCumple + 1
Case ValOption = 'GE'
If ValFromActual >= ValFrom
then WriteSeq RegistroDestino To VariableFileDestino
else NoCumple = NoCumple + 1
Case ValOption = 'LT'
If ValFromActual < ValFrom
then WriteSeq RegistroDestino To VariableFileDestino
else NoCumple = NoCumple + 1
End Case
Repeat
CloseSeq VariableFileOrigen
CloseSeq VariableFileDestino
Ans = NoCumple
-*-*-*-**-*
If anyone can solve this, he is earning my eternal respect!
Thanks a lot!
Alejandro Tavella
Question for DataStage Experts
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom
God bless KD
KIM DUKE RULES!!!!!!!!!!!!!!!!!
I want everybody in this prestigious forum to bless this amazing DS Guru!
Thanks a lot Kim!
It was that End stuff.
As regards the other question,I've got a routine that receives some parameter called Kstar, then looks for that value in the sequencial file, and when it finds that record, it gets the value from other three fields (ValTo, ValFrom and ValOption). Then you have to search the whole file and depending on the value of ValOption you write or not that record in a target file. There are other issues that don't let you do that in a transformer, so the advice from Lord Kim was fantastic.
Have a nice time and thanks a lot!
So, it goes like this!
PathOrigen = PathArchivoOrigen
RegistroDestino = ''
NoCumple = 0
OpenSeq PathOrigen To VariableFileOrigen Then
Loop
While ReadSeq RecordString From VariableFileOrigen
If Field(RecordString, ",", 6) = Kstar then
ValOption = Field(RecordString, ",", 5)
ValFrom = Field(RecordString, ",", 6)
ValTo = Field(RecordString, ",", 7)
Exit
End Else
ValOption = 'NN'
End
Repeat
End
CloseSeq VariableFileOrigen
OpenSeq PathOrigen To VariableFileOrigen then
PathDestino = PathArchivoDestino :ValOption
Loop
While ReadSeq RecordString From VariableFileOrigen
ValToActual = Field(RecordString, ",", 6)
ValFromActual = Field(RecordString, ",",7)
For CampoActual = 1 to CantidadCampos
RegistroDestino = RegistroDestino :",":Field(RecordString, ",", CampoActual)
Next CampoActual
OpenSeq PathDestino To VariableFileDestino Then
Begin Case
Case ValOption = 'EQ'
If ValFromActual = ValFrom
then WriteSeq RegistroDestino To VariableFileDestino
else NoCumple = NoCumple + 1
Case ValOption = 'NE'
If ValFromActual <> ValFrom
then WriteSeq RegistroDestino To VariableFileDestino
else NoCumple = NoCumple + 1
Case ValOption = 'BT'
If ValFromActual > ValFrom AND ValToActual < ValTo
then WriteSeq RegistroDestino To VariableFileDestino
else NoCumple = NoCumple + 1
Case ValOption = 'LE'
If ValFromActual <= ValFrom
then WriteSeq RegistroDestino To VariableFileDestino
else NoCumple = NoCumple + 1
Case ValOption = 'GT'
If ValFromActual > ValFrom
then WriteSeq RegistroDestino To VariableFileDestino
else NoCumple = NoCumple + 1
Case ValOption = 'GE'
If ValFromActual >= ValFrom
then WriteSeq RegistroDestino To VariableFileDestino
else NoCumple = NoCumple + 1
Case ValOption = 'LT'
If ValFromActual < ValFrom
then WriteSeq RegistroDestino To VariableFileDestino
else NoCumple = NoCumple + 1
End Case
End
Repeat
End
WEOFSeq VariableFileDestino
CloseSeq VariableFileOrigen
CloseSeq VariableFileDestino
Ans = NoCumple
I want everybody in this prestigious forum to bless this amazing DS Guru!
Thanks a lot Kim!
It was that End stuff.
As regards the other question,I've got a routine that receives some parameter called Kstar, then looks for that value in the sequencial file, and when it finds that record, it gets the value from other three fields (ValTo, ValFrom and ValOption). Then you have to search the whole file and depending on the value of ValOption you write or not that record in a target file. There are other issues that don't let you do that in a transformer, so the advice from Lord Kim was fantastic.
Have a nice time and thanks a lot!
So, it goes like this!
PathOrigen = PathArchivoOrigen
RegistroDestino = ''
NoCumple = 0
OpenSeq PathOrigen To VariableFileOrigen Then
Loop
While ReadSeq RecordString From VariableFileOrigen
If Field(RecordString, ",", 6) = Kstar then
ValOption = Field(RecordString, ",", 5)
ValFrom = Field(RecordString, ",", 6)
ValTo = Field(RecordString, ",", 7)
Exit
End Else
ValOption = 'NN'
End
Repeat
End
CloseSeq VariableFileOrigen
OpenSeq PathOrigen To VariableFileOrigen then
PathDestino = PathArchivoDestino :ValOption
Loop
While ReadSeq RecordString From VariableFileOrigen
ValToActual = Field(RecordString, ",", 6)
ValFromActual = Field(RecordString, ",",7)
For CampoActual = 1 to CantidadCampos
RegistroDestino = RegistroDestino :",":Field(RecordString, ",", CampoActual)
Next CampoActual
OpenSeq PathDestino To VariableFileDestino Then
Begin Case
Case ValOption = 'EQ'
If ValFromActual = ValFrom
then WriteSeq RegistroDestino To VariableFileDestino
else NoCumple = NoCumple + 1
Case ValOption = 'NE'
If ValFromActual <> ValFrom
then WriteSeq RegistroDestino To VariableFileDestino
else NoCumple = NoCumple + 1
Case ValOption = 'BT'
If ValFromActual > ValFrom AND ValToActual < ValTo
then WriteSeq RegistroDestino To VariableFileDestino
else NoCumple = NoCumple + 1
Case ValOption = 'LE'
If ValFromActual <= ValFrom
then WriteSeq RegistroDestino To VariableFileDestino
else NoCumple = NoCumple + 1
Case ValOption = 'GT'
If ValFromActual > ValFrom
then WriteSeq RegistroDestino To VariableFileDestino
else NoCumple = NoCumple + 1
Case ValOption = 'GE'
If ValFromActual >= ValFrom
then WriteSeq RegistroDestino To VariableFileDestino
else NoCumple = NoCumple + 1
Case ValOption = 'LT'
If ValFromActual < ValFrom
then WriteSeq RegistroDestino To VariableFileDestino
else NoCumple = NoCumple + 1
End Case
End
Repeat
End
WEOFSeq VariableFileDestino
CloseSeq VariableFileOrigen
CloseSeq VariableFileDestino
Ans = NoCumple