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

Has anyone used a TABLE request to set a global variable in ...


Debra Waybright

Recommended Posts

The code gets executed with every request whether the user needs &&DATA_AS_OF_DATE or not. Try to minimize the overhead of setting the global variable.

 

 

If it meets your requirements, you could use global variables value from a previous request in the same session. Check for its value to avoid HOLD and -READFILE.

-IF &&GGDATE.EXISTS THEN NOTF;

 

TABLE FILE GGSALES

SUM MAX.DATE AS 'GGDATE'

ON TABLE SET ASNAMES ON

ON TABLE HOLD AS GGDATE

END

-RUN

-DEFAULTH &GGDATE = ' ';

-READFILE GGDATE

-TYPE READFILE executed.

-SET &&GGDATE = &GGDATE;

 

-NOTF

-TYPE &|&|GGDATE = &&GGDATE

 

 

If &&DATA_AS_OF_DATE has the same value for everyone throughout the day, you could create the hold file once per day with ReportCaster. Then just do the -READFILE of the already existing HOLD file.

Link to comment
Share on other sites

Has anyone used a TABLE request to set a global variable in the edasprof.prf

Im thinking about doing something like this, but wondered what pitfalls I might encounter

SET HOLDLIST = PRINTONLY

SET ASNAMES = ON

TABLE FILE ETL_PROCESS_LOG

SUM MAX.DATA_DATE AS DATA_AS_OF_DATE

WHERE PROCESS_NAME EQ schedule_DAILY_LOAD

WHERE PROCESS_EVENT_NAME EQ End

ON TABLE HOLD AS HOLD_MAX_DATE

END

-RUN

-READFILE HOLD_MAX_DATE

-DEFAULTH &DATA_AS_OF_DATE=;

-SET &&DATA_DATE = EDIT(&DATA_AS_OF_DATE, 99/99/9999);

Thanks in advance for sharing your knowledge and experience!

Deb

Link to comment
Share on other sites

Hey guys, I have a similar requirement to conditionally enable OPSYSCMD in a user profile.

I tried to have a Launch fex to SET this &&DEPLOY value but that did not work or take effect in the profile. Logically it should have enabled DOS commands and enabled OPSYSCMD but it gives me the standard SYS COMMANDS DISABLED error

-*This is the launch fex

-SET &&DEPLOY=Y

EX mainfex.fex

-* This is my mainfex

DOS DIR

-* This is the user profile

SET OPSYSCMD=OFF

-IF &&DEPLOY EQ N THEN GOTO SKIP_DOS;

SET OPSYSCMD = ON

-SKIP_DOS

Link to comment
Share on other sites

Im changing it a bit, in user profile but still not quite there. Not sure why its giving me such a hard time to conditionally. What am I missing

Please share your thoughts!

-DEFAULTH &&OPSYALLOW =N ;

-SET &P = IF &&OPSYALLOW EQ Y THEN ON ELSE OFF ;`

SET OPSYSCMD = &P

Link to comment
Share on other sites

pawan.vuppala:

 

I dont understand your commend about backward quote, seems fine to me.

 

 

See the character at the end of the line:

 

image.png1051251 27.6 KB

 

If that was actually in your code, it would cause a problem.

The most recent code you posted doesnt have that extra character so maybe it is not an issue. Your code looks like it would work, however be aware, I dont think you need the case for:

SET OPSYSCMD = ON

 

because if it is already ON then you can just leave it ON. If it is already OFF, then you cant turn it back on.

So you can simply code it as:

-DEFAULT &OPSYALLOW = 'N';

 

-IF &OPSYALLOW EQ 'Y' THEN GOTO EndSET;

 

SET OPSYSCMD = OFF

 

-EndSET

 

SET OPSYSCMD

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...