SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
User Defined statement can not get ipnumber fr

 
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite View previous topic
View next topic
User Defined statement can not get ipnumber fr
Author Message
Johann Horsmeijer



Joined: 12 May 2003
Posts: 30

Post User Defined statement can not get ipnumber from i Reply with quote


I use a user defined statement to read sections from a inifile.
when te section from the ini file is mod_18_test1=10.0.0.1 it should return
the ipnumber in the return datatype string. this gives us a type mismatch.

since a string could be anything it really should not matter if I put a ipnumber
in the string.

I solved it now by making the the ini statement ip10.0.0.1 wich returns
the string ip10.0.0.1 wich can then be converted to 10.0.0.1 by removing "ip" from
the string.

//
// ***** Declaratie.

Dim strErrorLog, String, "" // Parameter standaard Batchlog

Dim strDefaultIniFile, String, "D:\\BatchRoot\\ini\\Batch.ini" // Standaard ini directory

Dim strErrorMessage, String, "" // Error message

Dim strFileParm, String, "" // Parameter behorende bij Key

Dim strNewCum, String, "" // Tijdelijke string cum-waarde FileParm

Dim strNewFileParm, String, "" // Aangepaste FileParm

Dim strSubject, String, "" // Mail subject

Dim numLength, Number, 0 // Length of string

Dim numPosBackslash, Number, 0 // Positie Backslash in strFileParm

Dim numReturn, Number, 0 // Variabele numerieke return warde

Dim numStartFileParm, Number, 1 // Start zoeken in strFileParm

Dim numTemp, Number, 0 // Tijdelijke num

Dim blnFileExits, Boolean, False // True indien ini-bestand bestaat

Dim blnLoopFileParm, Boolean, False // False indien geen nieuwe \ in FileParm

Dim blnNoValue, Boolean, False // Waarde in Ini gevonden? standaard is Ja

Dim blnReturn, Boolean, False // Variabele return boolean

//
// Programma
//

// Controleer de naam van het opgegeven ini-bestand.

// Indien gelijk aan 1, wijzig deze dan in het default ini-bestand.

ChooseCase strIniFile EndChoose_strIniFile

Case 1

Set strIniFile strDefaultIniFile

EndChoose_strIniFile:

// Controleer of ini bestand bestaat

FileExists strIniFile blnFileExits

if blnFileExits BestandAanwezig Fout_GeenBestand

BestandAanwezig:

IniFileGetKey strIniFile, strSection, strKey, strFileParm

length strFileParm, numLength

isEqual numLength, 0, blnNoValue

ifthen blnNoValue, Fout_GeenWaarde, GevuldeWaarde

GevuldeWaarde:

IsEqual strFileParm "leeg" blnReturn

Not blnReturn blnReturn

IfThen blnReturn CheckOnBackSlash

Set strFileParm ""

Goto ReturnFileParm

CheckOnBackSlash:

Length strFileParm numLength

LoopUntil blnLoopFileParm EndLoop_blnLoopFileParm

Pos strFileParm, "\\", numStartFileParm numPosBackslash

NotEqual numPosBackslash, 0 blnReturn

If blnReturn Backslash NoBackslash

BackSlash:

Subtract numPosBackslash, numStartFileParm numTemp

Mid strFileParm, numStartFileParm, numTemp strNewCum

Concatex strNewFileParm, strNewCum, "\\\\" strNewFileParm

Add numPosBackslash, 1 numStartFileParm

Goto End_If

NoBackSlash:

Subtract numLength, numStartFileParm numTemp

Add numTemp, 1 numTemp

Mid strFileParm, numStartFileParm, numTemp strNewCum

Concatex strNewFileParm, strNewCum, strNewFileParm

Set blnLoopFileParm True

End_If:

EndLoop_blnLoopFileParm:

Set strFileParm strNewFileParm

ReturnFileParm:

Goto End

Fout_GeenWaarde:

Concatex " Batch Error: Key not found in ini-file", strSubject

Concatex " Error: Key ", strKey, " niet aanwezig in ini-bestand ", strIniFile, strErrorMessage

goto ERROR_Routine

Fout_GeenBestand:

Concatex " Error: Opgegeven ini-bestand ", strIniFile, " is niet gevonden", strErrorMessage

goto ERROR_Routine

ERROR_Routine:

// Indien strLogFile gevuld, schrijf naar strLogFile

Length strLogFile, numReturn

IsEqual numReturn, 0, blnReturn

IfThen blnReturn WriteToStandardLog

ALG_WriteToDetailLog( strLogFile, strErrorMessage, 1, False )

Goto MailMessage

WriteToStandardLog:

IniFileGetKey strDefaultIniFile, "Algemeen", "DefaultErrorFile", strErrorLog

ALG_WriteToDetailLog( strErrorLog, strErrorMessage, 0, True )

MailMessage:
// ALG_MailRoutine( "1", "Productie", "Mail_ErrorRecipient", strSubject, strErrorMessage, "", strLogFile )
// ALG_MailRoutine( "1", "SchaduwProductie", "Mail_ErrorRecipient", strSubject, strErrorMessage, "", strLogFile )
// ALG_MailRoutine( "1", "Acceptatie", "Mail_ErrorRecipient", strSubject, strErrorMessage, "", strLogFile )
// ALG_MailRoutine( "1", "Test", "Mail_ErrorRecipient", strSubject, strErrorMessage, "", strLogFile )

set strFileParm, "Error"

End:

Return strFileParm


Mon Aug 09, 2004 5:20 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7969

Post Re: User Defined statement can not get ipnumber fr Reply with quote

This problem is caused by automatic data type conversion. When the script engine finds only digits and dots in a value it assumes it is dealing with a number, which is not in this case. Data-type conversion rules will be relaxed in version 3.4.21 and later, that should help to avoid this and similar issues.

: I use a user defined statement to read sections from a inifile.
: when te section from the ini file is mod_18_test1=10.0.0.1 it should return
: the ipnumber in the return datatype string. this gives us a type mismatch.

: since a string could be anything it really should not matter if I put a
: ipnumber
: in the string.

: I solved it now by making the the ini statement ip10.0.0.1 wich returns
: the string ip10.0.0.1 wich can then be converted to 10.0.0.1 by removing
: "ip" from
: the string.

: //
: // ***** Declaratie.

: Dim strErrorLog, String, "" // Parameter standaard Batchlog

: Dim strDefaultIniFile, String, "D:\\BatchRoot\\ini\\Batch.ini" //
: Standaard ini directory

: Dim strErrorMessage, String, "" // Error message

: Dim strFileParm, String, "" // Parameter behorende bij Key

: Dim strNewCum, String, "" // Tijdelijke string cum-waarde FileParm

: Dim strNewFileParm, String, "" // Aangepaste FileParm

: Dim strSubject, String, "" // Mail subject

: Dim numLength, Number, 0 // Length of string

: Dim numPosBackslash, Number, 0 // Positie Backslash in strFileParm

: Dim numReturn, Number, 0 // Variabele numerieke return warde

: Dim numStartFileParm, Number, 1 // Start zoeken in strFileParm

: Dim numTemp, Number, 0 // Tijdelijke num

: Dim blnFileExits, Boolean, False // True indien ini-bestand bestaat

: Dim blnLoopFileParm, Boolean, False // False indien geen nieuwe \ in FileParm

: Dim blnNoValue, Boolean, False // Waarde in Ini gevonden? standaard is Ja

: Dim blnReturn, Boolean, False // Variabele return boolean

: //
: // Programma
: //

: // Controleer de naam van het opgegeven ini-bestand.

: // Indien gelijk aan 1, wijzig deze dan in het default ini-bestand.

: ChooseCase strIniFile EndChoose_strIniFile

: Case 1

: Set strIniFile strDefaultIniFile

: EndChoose_strIniFile: // Controleer of ini bestand bestaat

: FileExists strIniFile blnFileExits

: if blnFileExits BestandAanwezig Fout_GeenBestand

: BestandAanwezig: IniFileGetKey strIniFile, strSection, strKey, strFileParm

: length strFileParm, numLength

: isEqual numLength, 0, blnNoValue

: ifthen blnNoValue, Fout_GeenWaarde, GevuldeWaarde

: GevuldeWaarde: IsEqual strFileParm "leeg" blnReturn

: Not blnReturn blnReturn

: IfThen blnReturn CheckOnBackSlash

: Set strFileParm ""

: Goto ReturnFileParm

: CheckOnBackSlash: Length strFileParm numLength

: LoopUntil blnLoopFileParm EndLoop_blnLoopFileParm

: Pos strFileParm, "\\", numStartFileParm numPosBackslash

: NotEqual numPosBackslash, 0 blnReturn

: If blnReturn Backslash NoBackslash

: BackSlash: Subtract numPosBackslash, numStartFileParm numTemp

: Mid strFileParm, numStartFileParm, numTemp strNewCum

: Concatex strNewFileParm, strNewCum, "\\\\" strNewFileParm

: Add numPosBackslash, 1 numStartFileParm

: Goto End_If

: NoBackSlash: Subtract numLength, numStartFileParm numTemp

: Add numTemp, 1 numTemp

: Mid strFileParm, numStartFileParm, numTemp strNewCum

: Concatex strNewFileParm, strNewCum, strNewFileParm

: Set blnLoopFileParm True

: End_If: EndLoop_blnLoopFileParm: Set strFileParm strNewFileParm

: ReturnFileParm: Goto End

: Fout_GeenWaarde: Concatex " Batch Error: Key not found in
: ini-file", strSubject

: Concatex " Error: Key ", strKey, " niet aanwezig in
: ini-bestand ", strIniFile, strErrorMessage

: goto ERROR_Routine

: Fout_GeenBestand: Concatex " Error: Opgegeven ini-bestand ",
: strIniFile, " is niet gevonden", strErrorMessage

: goto ERROR_Routine

: ERROR_Routine: // Indien strLogFile gevuld, schrijf naar strLogFile

: Length strLogFile, numReturn

: IsEqual numReturn, 0, blnReturn

: IfThen blnReturn WriteToStandardLog

: ALG_WriteToDetailLog( strLogFile, strErrorMessage, 1, False )

: Goto MailMessage

: WriteToStandardLog: IniFileGetKey strDefaultIniFile, "Algemeen",
: "DefaultErrorFile", strErrorLog

: ALG_WriteToDetailLog( strErrorLog, strErrorMessage, 0, True )

: MailMessage: // ALG_MailRoutine( "1", "Productie",
: "Mail_ErrorRecipient", strSubject, strErrorMessage,
: "", strLogFile )
: // ALG_MailRoutine( "1", "SchaduwProductie",
: "Mail_ErrorRecipient", strSubject, strErrorMessage,
: "", strLogFile )
: // ALG_MailRoutine( "1", "Acceptatie",
: "Mail_ErrorRecipient", strSubject, strErrorMessage,
: "", strLogFile )
: // ALG_MailRoutine( "1", "Test",
: "Mail_ErrorRecipient", strSubject, strErrorMessage,
: "", strLogFile )

: set strFileParm, "Error"

: End: Return strFileParm

Mon Aug 09, 2004 10:04 am View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.