As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only. Moving forward, myibi is our community platform to learn, share, and collaborate. We have the same Focal Point forum categories in myibi, so you can continue to have all new conversations there. If you need access to myibi, contact us at myibi@ibi.com and provide your corporate email address, company, and name.
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,
-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,
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 :
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
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007