BookmarkSubscribeRSS Feed
SASUser_86
Calcite | Level 5

Hello. We just completed our first Enterprise Guide project, we're currently working on scheduling via Cron. We wanted to schedule an entire process flow to ensure that our DB2 tables are picked up and run several times a day as they can be updated throughout the day. When we created the Enterprise Guide project, we dragged DB2 tables into the project instead of using an sql passthrough such as the following:

 

PROC SQL;
connect to db2 (uid="&MyMetaUser" password="&MyMetaPass" datasrc=DB2PRODA);
CREATE TABLE MYLIB.NEW_TABLE AS
SELECT * FROM CONNECTION TO DB2
(select * FROM DB2.OLD_TABLE
WHERE DEPT_ID IN ('___','____','____','____','____')
ORDER BY DEPT_ID, PRMY_LAST_NM);
QUIT;

 

What I want to know is whether we can schedule via cron if we drag DB2 tables instead of using passthrough sql? Is the passthrough sql required for cron to be able to process the entire project? Thanks!

3 REPLIES 3
Kurt_Bremser
Super User

Save your code to a .sas file on the UNIX server.

Log on as the userid intended for the batch run, via ssh or similar.

Run the newly created .sas file using the sasconf/Lev1/SASApp/BatchServer/sasbatch.sh script.

Inspect the resulting log.

 

Build a wrapper script for the sasbatch.sh that adds important options like -log etc.; this wrapper might also perform alerts if the sasbatch.sh returns with a non-zero return code.

(code the timestamp of the current time into the logfile name)

Create a script that calls this wrapper script with your programname

Add that script to your crontab

Inspect your logs regularly, or if you received an alert.

 

SASUser_86
Calcite | Level 5

@Kurt_Bremser Does this mean that it really doesn't matter whether I use a passthrough sql or drag the DB2 table into the process flow? My .sas file should run fine in either case, right?

LinusH
Tourmaline | Level 20
Is just different syntax.
The choices between the two have nothing to do with scheduling (as long you are handling the DB2 login - which is part of your system test).
I get a bit worried when seeing metauser and metapassword as names for your macro variables - SAS metadata user and passwords are many times not the same as in the database.
Data never sleeps

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1314 views
  • 0 likes
  • 3 in conversation