Can anyone see what is wrong with this code, it should be going to the PSYCEND and I can't seem to get it to work.
-IF (&MAJCRI EQ Y) AND (&MAJOR EQ 'Psychology') GOTO PSYCEND;
-IF (&MAJCRI EQ Y) AND (&MAJOR EQ 'Sociology' OR 'Sociology/Appl Social Relation') GOTO SOCOEND;
WHERE ( J0.SHRTCKN.SHRTCKN_TERM_CODE LE '&TERM' ) AND ( J0.SHRTCKN.SHRTCKN_SUBJ_CODE EQ &SUBJ ) AND ( J0.SHRTCKN.SHRTCKN_CRSE_NUMB GE '&CRSE' )AND (( J0.SHRTCKN.SHRTCKN_REPEAT_COURSE_IND NE 'A' OR 'E' ) OR ( J0.SHRTCKN.SHRTCKN_REPEAT_COURSE_IND IS MISSING)) AND ( J2.SHRGRDE.SHRGRDE_LEVL_CODE EQ 'UG' ) AND ( J2.SHRGRDE.SHRGRDE_GPA_IND EQ 'Y' );
-GOTO ENDWHERE
-PSYCEND
WHERE AHCourse NE 'PSY100' OR 'PSY480' OR 'PSY491' OR 'PSY496' OR 'PSY497' OR 'PSY498';
-GOTO ENDWHERE
-SOCOEND
WHERE AHCourse EQ 'SOC100' OR 'SOC201' OR 'SOC300' OR 'SOC350' OR 'SOC351' OR 'SOC400';
-GOTO ENDWHERE
-ENDWHERE
I get the following when I run it and the &ECHO=ALL
-IF (Y EQ Y) AND ('Psychology' EQ 'Psychology') GOTO PSYCEND;
-IF (Y EQ Y) AND ('Psychology' EQ 'Sociology' OR 'Sociology/Appl Social Relation') GOTO SOCOEND;
WHERE ( J0.SHRTCKN.SHRTCKN_TERM_CODE LE '201940' ) AND ( J0.SHRTCKN.SHRTCKN_SUBJ_CODE EQ 'PSY' ) AND ( J0.SHRTCKN.SHRTCKN_CRSE_NUMB GE '_FOC_NULL' )AND (( J0.SHRTCKN.SHRTCKN_REPEAT_COURSE_IND NE 'A' OR 'E' ) OR ( J0.SHRTCKN.SHRTCKN_REPEAT_COURSE_IND IS MISSING)) AND ( J2.SHRGRDE.SHRGRDE_LEVL_CODE EQ 'UG' ) AND ( J2.SHRGRDE.SHRGRDE_GPA_IND EQ 'Y' );
-GOTO ENDWHERE
-ENDWHERE
This message has been edited. Last edited by: Trudy,
WF8 Windows
January 30, 2019, 03:30 PM
BabakNYC
Would it make a difference if you say THEN GOTO PSYCEND; ?
WebFOCUS 8206, Unix, Windows
January 30, 2019, 03:33 PM
Trudy
I tried that and it didn't work, got the same results.
WF8 Windows
January 30, 2019, 03:49 PM
BabakNYC
Can you test this and see if it works? Also what version of WebFOCUS are you running?
-SET &ECHO=ALL;
-DEFAULT &MAJCRI='Y'
-DEFAULT &MAJOR= 'Psychology'
-IF (&MAJCRI EQ Y) AND (&MAJOR EQ 'Psychology') GOTO PSYCEND;
-TYPE DIDN'T WORK
-GOTO ENDWHERE
-PSYCEND
-TYPE IT WORKED
-ENDWHERE
WebFOCUS 8206, Unix, Windows
January 30, 2019, 04:08 PM
Don Garland
-SET &MAJOR = IF &MAJOR CONTAINS 'Sociology/Appl Social Relation' THEN Sociology ELSE &MAJOR;
-IF &MAJCRI EQ Y GOTO &MAJOR;
WHERE ( J0.SHRTCKN.SHRTCKN_TERM_CODE LE '&TERM' ) AND ( J0.SHRTCKN.SHRTCKN_SUBJ_CODE EQ &SUBJ ) AND ( J0.SHRTCKN.SHRTCKN_CRSE_NUMB GE '&CRSE' )AND (( J0.SHRTCKN.SHRTCKN_REPEAT_COURSE_IND NE 'A' OR 'E' ) OR ( J0.SHRTCKN.SHRTCKN_REPEAT_COURSE_IND IS MISSING)) AND ( J2.SHRGRDE.SHRGRDE_LEVL_CODE EQ 'UG' ) AND ( J2.SHRGRDE.SHRGRDE_GPA_IND EQ 'Y' );
-GOTO ENDWHERE
-Psychology
WHERE AHCourse NE 'PSY100' OR 'PSY480' OR 'PSY491' OR 'PSY496' OR 'PSY497' OR 'PSY498';
-GOTO ENDWHERE
-Sociology
WHERE AHCourse EQ 'SOC100' OR 'SOC201' OR 'SOC300' OR 'SOC350' OR 'SOC351' OR 'SOC400';
-GOTO ENDWHERE
-ENDWHERE
This message has been edited. Last edited by: Don Garland,
This seems to be an area that recurs in posts, so I thought that it would be useful to add a document link - Navigating a procedure
T
In FOCUS since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2
WebFOCUS App Studio 8.2.06 standalone on Windows 10
January 31, 2019, 05:39 AM
Wep5622
Is that your entire code?
I suspect that you may have a dialog-manager statement before, that requires a terminating semi-colon and doesn't have one. Probably a -SET or a -DEFAULT.
If that is the case, the statement continues on into your -IF line and terminates at that semi-colon.
The next -IF line is evaluated properly, but of course the condition does not evaluate true.
WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010 : Member of User Group Benelux :
January 31, 2019, 07:40 AM
GamP
In this specific case the give-away is the quotes around the translation of the &MAJOR variable in the output of the echo. Apparently the variable comes in to the procedure including the quotes. And then you compare it with a value without quotes, where, of course, it is decided that both are not equal. So either remove the quotes from the variable before comparing, or compare to a value with the extra quotes added. The latter:
-IF (&MAJCRI EQ Y) AND (&MAJOR EQ '''Psychology''') GOTO PSYCEND;
And, personally, I'd advise to keep the code as tidy as possible. In my fex this code would be:
-IF (&MAJCRI EQ 'Y') AND (&MAJOR EQ '''Psychology''') THEN GOTO PSYCEND;
GamP
- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
February 01, 2019, 01:40 PM
Trudy
GamP
Your solution was correct, thank you. I don't know how you figured it out from the echo though since both sides of the equal sign had quotes.