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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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