Jump to content
The ibi Community has moved to a new platform: Please Sign In and choose Forgot Password to continue

I have this and it works in the code below: -SET &RM = ...


robert fuschetto

Recommended Posts

I have this and it works in the code below:

-SET &RM = IF &DATEM EQ 01 THEN -118 ELSE -119;

I need to make it more complicated and I get this error:

ERROR AT OR NEAR LINE 51 IN PROCEDURE _ADHOCRQFOCEXEC * (FOC266) IF THEN ELSE SYNTAX ERROR

What do I have wrong I do not even have 51 linesthe error is s a result of the SET statement though

-SET &RM = IF &DATEM GE 01 THEN -118 ELSE

IF &DATEM GE 02 THEN -119 ELSE

IF &DATEM GE 03 THEN -120 ELSE

IF &DATEM GE 04 THEN -121 ELSE

IF &DATEM GE 05 THEN -122 ELSE

IF &DATEM GE 06 THEN -123 ELSE

IF &DATEM GE 07 THEN -112 ELSE

IF &DATEM GE 08 THEN -113 ELSE

IF &DATEM GE 09 THEN -114 ELSE

IF &DATEM GE 10 THEN -115 ELSE

IF &DATEM GE 11 THEN -116 ELSE -117;

TABLE FILE TBLMSTR_CALENDARPERIOD

BY TBLMSTR_CALENDARPERIOD.TBLMSTR_CALENDARPERIOD.PERIODTEXT

BY TBLMSTR_CALENDARPERIOD.TBLMSTR_CALENDARPERIOD.ROLLINGMONTHS

WHERE TBLMSTR_CALENDARPERIOD.TBLMSTR_CALENDARPERIOD.ROLLINGMONTHS LE &RM;

ON TABLE SET PAGE-NUM NOLEAD

ON TABLE SET ASNAMES ON

ON TABLE NOTOTAL

ON TABLE PCHOLD FORMAT HTML

ON TABLE SET HTMLEMBEDIMG ON

ON TABLE SET HTMLCSS ON

ON TABLE SET STYLE *

INCLUDE = IBFS:/EDA/EDASERVE/_EDAHOME/ETC/warm.sty,

$

ENDSTYLE

END

Thanks!!!

Link to comment
Share on other sites

You need to have the - on each new line of the -SET statement.

-SET &RM = IF &DATEM GE '01' THEN -118 ELSE

-IF &DATEM GE '02' THEN -119 ELSE

-IF &DATEM GE '03' THEN -120 ELSE

-IF &DATEM GE '04' THEN -121 ELSE

-IF &DATEM GE '05' THEN -122 ELSE

-IF &DATEM GE '06' THEN -123 ELSE

-IF &DATEM GE '07' THEN -112 ELSE

-IF &DATEM GE '08' THEN -113 ELSE

-IF &DATEM GE '09' THEN -114 ELSE

-IF &DATEM GE '10' THEN -115 ELSE

-IF &DATEM GE '11' THEN -116 ELSE -117;

 

It seems like it would always set a value of &RM = -118.

Link to comment
Share on other sites

robertf:

 

&DATEM

 

 

Is this numeric or alphanumeric The way I read this is that it is numeric and you are comparing it to an alphanumeric and that cannot be done. If alpha, add quotes around it, not sure if quotes are being passed in. Also, you may want to change GE to EQ. If you can run with SQL trace or add an echo statement, you can see the output to see how its being evaluated.

Link to comment
Share on other sites

Like pealing an onion.

Remember, that when an if / then / else is satisfied, it exits and passes to the semi-colon, skipping the rest of the evaluations.

So, peal from the top, or peal from the bottom.

-SET &RM = IF &DATEM LE 01 THEN -118 ELSE

-IF &DATEM LE 02 THEN -119 ELSE

-IF &DATEM LE 03 THEN -120 ELSE

-IF &DATEM LE 04 THEN -121 ELSE

-IF &DATEM LE 05 THEN -122 ELSE

-IF &DATEM LE 06 THEN -123 ELSE

-IF &DATEM LE 07 THEN -112 ELSE

-IF &DATEM LE 08 THEN -113 ELSE

-IF &DATEM LE 09 THEN -114 ELSE

-IF &DATEM LE 10 THEN -115 ELSE

-IF &DATEM LE 11 THEN -116 ELSE -117;

Run it with -SET &ECHO=ALL at the top will help you evaluate if you need quotes or no quotes for the equality test.

(sometimes its hard to type focus code in this forum becuase it gets treated like html, or hits some autoformatting. add a space between the the dash and IF, like - IF .

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...