problem in transversing the file
Posted: Wed Feb 14, 2007 5:34 am
Hi all,
I have requirement like this
I have the DSParam file in the projects folder of the datastage.
I have to get the parametervalue for a particular parameter.
I am struck with transversing the file.
The file looks like
It contains many line arranged irregularly.
and the last it has parametersyntax like this
"paramname"\1\"paramvalue
i am attaching a sample file that i am reading
***************
[functions]
Abs\1\Absolute value of any numeric expression\Mathematical\int32\int32:number\abs
.
.
[serveronly-functions]
Ascii\1\EBCDIC to ASCII string conversion\Conversion\\:string
[parallelonly-functions]
AlNum\1\Return whether the given string consists of alphanumeric characters\String\int8\anystring:string\is_alnum,u_is_alnum
.
.
.
[EnvVarDefns]
ARCHIVE_DIR\User Defined\-1\String\\0\Project\ARCHIVE_DIR\
.
.
..
[EnvVarValues]
"ARCHIVE_DIR"\1\"archive"
"xxxx"\1\"zzzz"
*******
i have traversed to the line where it is equal to " [EnvVarValues]"
After that i have to traverse further and check if the param name is "xxx"
ihave to get the its value that is ZZZ
I am struct up after getting the line as "[EnvVarValues]" how to move further
i have attached the code for looping that i have used
*********
OpenSeq ParamFile To ParamFileVar
On Error
Msg = 'Error opening parameters file, ' : SQuote(ParamFile ): ', status = ' : Status()
Call DSLogFatal(Msg, TransformName )
Abort
End
Else
Msg = 'Cannot open parameters file, ' : SQuote(ParamFile ): ', status = ' : Status()
Call DSLogFatal(Msg, TransformName )
Abort
End
Loop
While ReadSeq Line From ParamFileVar
If Trim(Line)="[EnvVarValues]" Then
Field( Trim(Line),"/",1,1)= ParamName
ParamValue = Field(Trim(Line),"/",1,2)
Repeat
********
Advice me on this
I have requirement like this
I have the DSParam file in the projects folder of the datastage.
I have to get the parametervalue for a particular parameter.
I am struck with transversing the file.
The file looks like
It contains many line arranged irregularly.
and the last it has parametersyntax like this
"paramname"\1\"paramvalue
i am attaching a sample file that i am reading
***************
[functions]
Abs\1\Absolute value of any numeric expression\Mathematical\int32\int32:number\abs
.
.
[serveronly-functions]
Ascii\1\EBCDIC to ASCII string conversion\Conversion\\:string
[parallelonly-functions]
AlNum\1\Return whether the given string consists of alphanumeric characters\String\int8\anystring:string\is_alnum,u_is_alnum
.
.
.
[EnvVarDefns]
ARCHIVE_DIR\User Defined\-1\String\\0\Project\ARCHIVE_DIR\
.
.
..
[EnvVarValues]
"ARCHIVE_DIR"\1\"archive"
"xxxx"\1\"zzzz"
*******
i have traversed to the line where it is equal to " [EnvVarValues]"
After that i have to traverse further and check if the param name is "xxx"
ihave to get the its value that is ZZZ
I am struct up after getting the line as "[EnvVarValues]" how to move further
i have attached the code for looping that i have used
*********
OpenSeq ParamFile To ParamFileVar
On Error
Msg = 'Error opening parameters file, ' : SQuote(ParamFile ): ', status = ' : Status()
Call DSLogFatal(Msg, TransformName )
Abort
End
Else
Msg = 'Cannot open parameters file, ' : SQuote(ParamFile ): ', status = ' : Status()
Call DSLogFatal(Msg, TransformName )
Abort
End
Loop
While ReadSeq Line From ParamFileVar
If Trim(Line)="[EnvVarValues]" Then
Field( Trim(Line),"/",1,1)= ParamName
ParamValue = Field(Trim(Line),"/",1,2)
Repeat
********
Advice me on this