Hi all, for &VARIABLE12 even if the value is other than 'A' on &OP_DSP its always giving 'AUSTRALIA QLY'.not going to other GOTO, why? can any one help me out.
here in my code: -IF &VARIABLE12 EQ 'A' THEN GOTO DSP_A; -IF &VARIABLE12 EQ 'B' THEN GOTO DSP_B; -IF &VARIABLE12 EQ 'C' THEN GOTO DSP_C; -IF &VARIABLE12 EQ 'D' THEN GOTO DSP_D; -TYPE VARIABLE12 &VARIABLE12
-LBL_ENDThis message has been edited. Last edited by: Kerry,
webfocus 7.6.9 windows XP Excel
September 03, 2009, 01:04 PM
Prash1983
I think you might need to add an ELSE for the values other than A,B,C,D. What's happening here is that if the values are not A,B,C or D; the code lets you to the next statement where value "AUSTRALIA QLY' is set.
After all the IFs, try this: -IF &VARIABLE12 EQ 'D' THEN GOTO DSP_D ELSE GOTO LBL_END
or you can put any other logic(setting any default value) in the ELSE, as per your requirements.
webFOCUS 7.6.x, z/OS(Mainframes), Excel and HTML
September 03, 2009, 01:05 PM
Donald
I notice that you have a -TYPE &VARIABLE12, is there any variables other than 'A' getting displayed when you run the report?
I NEVER use a -IF that does not have some sort of ELSE. That assures that EVERY possible value is accounted for and handled in some way.
To accomplish your -SETs, Jack's got the best way using a DECODE. To accomplish you branching for some other purpose, try:
-IF &VARIABLE12 EQ 'A' THEN GOTO DSP_A ELSE
- IF &VARIABLE12 EQ 'B' THEN GOTO DSP_B ELSE
- IF &VARIABLE12 EQ 'C' THEN GOTO DSP_C ELSE
- IF &VARIABLE12 EQ 'D' THEN GOTO DSP_D ELSE
- GOTO LBL_END;
Regards,
Darin
In FOCUS since 1991 WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex WF Client: 77 on Linux w/Tomcat
September 04, 2009, 05:54 AM
Baillecl
Hi all, I think you should not write -GOTO LBL_END; but -GOTO LBL_END No ';' in a -GOTO Statement But, as so many, since -IF statement requires a ';', you come to think that -GOTO is on the same logic That's why Old Focusians always let a space before ';' -GOTO LBL_END ; is not the best way to write, but it works. It doesn't search for a Label -LBL_END; but for the Proper Label -LBL_END
Same Remark with -SET : ';' compulsory and -DEFAULT(s): No ';' but ',' allows different variables to be Defaulted on a single line Cordially and Focusely PS : This Rule is so old, that, perhaps, it's not longer true. NotWithstanding, untill I die, I'll never write -GOTO WAY_OUT; ( As I'll never begin a Focus Statement in Position 1, which I let to the '-' of DM => So I see, at first sight if I'm playing with Focus or with DM... Which is rather important to know. And which DS hides ... But, Do I like DS ? Anyway DS doesn't care much about my loving or not ...)
Focus Mainframe 7.6.11 Dev Studio 7.6.11 and !!! PC Focus, Focus for OS/2, FFW Six, MSO
September 04, 2009, 08:53 AM
PBrightwell
If you are displaying the value in your -TYPE statement then you haven't matched any of the conditions or your GOTO would have bypassed it. Have you followed j.gross's advice and checked the length? Also it is case sensitive, is your value 'A' or 'a'?
Pat WF 7.6.8, AIX, AS400, NT AS400 FOCUS, AIX FOCUS, Oracle, DB2, JDE, Lotus Notes
September 04, 2009, 09:37 AM
GinnyJakes
Baillecl,
Keep on writing. I enjoy your posts though I don't always understand them.
At any rate, your GOTO comments are correct. However, in Darin's example his -GOTO is part of the ELSE in an IF statement and as such should be followed by the semicolon.
Misunderstood, once more ... Should I love that ? I was not refering to Darin's example, but to the first message by rp. That's typical of my (too often) being misunderstood. I should have specified that. But an old Fool / Focusian (*) like me just cannot not know, inside his guts, the difference between -IF and -GOTO syntax Anyway, thanks for the kindness of the message Cordially and Focusely (*) As you prefer. Not mutually exclusive.
Focus Mainframe 7.6.11 Dev Studio 7.6.11 and !!! PC Focus, Focus for OS/2, FFW Six, MSO
September 17, 2009, 11:46 AM
Hua
-IF 'MAP' EQ 'MAP' THEN GOTO MAP
- ELSE IF 'MAP' EQ 'DETAIL' THEN GOTO DETAIL
- ELSE GOTO PERIOD;
0 ERROR AT OR NEAR LINE 76 IN PROCEDURE ADHOCRQ FOCEXEC *
(FOC305) SPECIFIED LABEL NOT FOUND: PERIOD
I thought this might be spelling error, so I tried the GUI DM to pick up the label; it might be the semi-colon played the trick on me, tried switch the conditions around and still didn't work.
I tried the simple goto and it recognize the label and gave me the report I wanted. So it got to be something wrong with my if-else structure. Please help.
-GOTO PERIOD <== this one works
-IF '&LEVEL' EQ 'MAP' THEN GOTO MAP
- ELSE IF '&LEVEL' EQ 'DETAIL' THEN GOTO DETAIL
- ELSE GOTO PERIOD; <== this one doesn't work
-IF '&FDIV' NE 'ALL' THEN GOTO PERIOD <== this one doesn't work
- ELSE GOTO &LEVEL;
Thanks,
Hua
Developer Studio 7.6.11 AS400 - V5R4 HTML,PDF,XLS
September 17, 2009, 11:53 AM
GinnyJakes
Hua, take the quotes off the amper variable. This works:
-IF &LEVEL EQ 'MAP' THEN GOTO MAP
- ELSE IF &LEVEL EQ 'DETAIL' THEN GOTO DETAIL
- ELSE GOTO PERIOD;
-MAP
-TYPE IN MAP
-EXIT
-DETAIL
-TYPE IN DETAIL
-EXIT
-PERIOD
-TYPE IN PERIOD
-EXIT