Routine Code
Moderators: chulett, rschirm, roy
Routine Code
Hello:
I am quite new to writing a routine on a Server 7.5.
My job calls for club. Say the club's represent Fiction (f).
In my transform job properties I have defined the following parameters:
Parameter name.....Prompt.....................Type........Default Value
Club......................Enter Club name........String...........f
In Routine CODE - I have written a routine that say's the following:
If Club = 'c' THEN COUNTRY_CDE = '2' else '0'
In Arguments Tab - have the Argument Name as Club
But I get ERRORS while compiling the routine. They are:
Compiling: Source = 'DSU_BP/DSU.AddressRtn', Object = 'DSU_BP.O/DSU.AddressRtn'
0003 If Club = 'c' THEN COUNTRY_CDE = '2' else '0'
^
String Constant unexpected, Was expecting: Array Name,
Variable name,New variable name, ';', Statement label, "ABORT", "ABORTE", "ABORTM",
"BEGIN", "BREAK", "CALL", "CHAIN", "CLEAR", ......"SETIT", "SEND",
"UPRINT", "AUXMAP"
1 Errors detected, No Object Code Produced.
Thanks in advance.
DS_MJ
I am quite new to writing a routine on a Server 7.5.
My job calls for club. Say the club's represent Fiction (f).
In my transform job properties I have defined the following parameters:
Parameter name.....Prompt.....................Type........Default Value
Club......................Enter Club name........String...........f
In Routine CODE - I have written a routine that say's the following:
If Club = 'c' THEN COUNTRY_CDE = '2' else '0'
In Arguments Tab - have the Argument Name as Club
But I get ERRORS while compiling the routine. They are:
Compiling: Source = 'DSU_BP/DSU.AddressRtn', Object = 'DSU_BP.O/DSU.AddressRtn'
0003 If Club = 'c' THEN COUNTRY_CDE = '2' else '0'
^
String Constant unexpected, Was expecting: Array Name,
Variable name,New variable name, ';', Statement label, "ABORT", "ABORTE", "ABORTM",
"BEGIN", "BREAK", "CALL", "CHAIN", "CLEAR", ......"SETIT", "SEND",
"UPRINT", "AUXMAP"
1 Errors detected, No Object Code Produced.
Thanks in advance.
DS_MJ
You must return your answer in a variable called 'Ans'.
Code: Select all
If Club = 'c' THEN Ans = '2' else Ans= '0'
Kenneth Bland
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Re: Routine Code
Your syntax is invalid... else what is zero?DS_MJ wrote:If Club = 'c' THEN COUNTRY_CDE = '2' else '0'
Plus you need to set the value of Ans as that is what is returned when you call the routine. Are you doing that somewhere?
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
However, this syntax is valid:
Some people prefer to use parentheses to indicate that a conditional expression, rather than a conditional statement, has been used.
Code: Select all
Ans = If Club = 'c' THEN COUNTRY_CDE = '2' else '0'
Code: Select all
Ans = (If Club = 'c' THEN COUNTRY_CDE = '2' else '0')
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Ok, just because this is bugging me and I really want to understand this Wurlod Nugget o' Fun... how does it return a '2'?
I can see how it returns the '0' on the other side the 'else' but it actually sets a variable called COUNTRY_CDE to '2', not 'Ans' when the expression is true - hence the puzzlement on my part. I guess the simplest way to play with this would be in a routine of my own making and see what comes out the other end.
I can see how it returns the '0' on the other side the 'else' but it actually sets a variable called COUNTRY_CDE to '2', not 'Ans' when the expression is true - hence the puzzlement on my part. I guess the simplest way to play with this would be in a routine of my own making and see what comes out the other end.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Not sure if you have a question here or not... but I'd suggest sticking with the syntax that works.
Code: Select all
If Club = 'c' THEN Ans = '2' else Ans ='0'
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod wrote:The expression (If Club = 'c' THEN COUNTRY_CDE = '2' else '0') can only return "2" or "0".
Ray's statement is wrong. He should not have the "COUNTRY_CDE = '2'", just " the '2' portion. Craig has been trying to point this out.
Kenneth Bland
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
The perils of inattentive copy/paste programming! SHould have been:
The expression (If Club = 'c' THEN '2' else '0') can only return "2" or "0".
Good catch Ken.
The expression (If Club = 'c' THEN '2' else '0') can only return "2" or "0".
Good catch Ken.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 36
- Joined: Wed Feb 16, 2005 5:20 pm
- Location: IL
Re: Routine Code
If Club = 'c' THEN Ans = '2' else Ans ='0'
bcoz the argument in routine is Ans so its better to use Ans not to confuse and to not to do errors.
Any way nice work by all the participants
bcoz the argument in routine is Ans so its better to use Ans not to confuse and to not to do errors.
Any way nice work by all the participants