09-22-2016 04:21 AM
Buongiorno, vorrei creare un file semaforo a seguito dell'esecuzione di un job.
Questo job come risultato finale esporta un file csv giorno per giorno e mi serve che un file semaforo(vuoto) verifichi che questo csv creato non sia vuoto.
C'è un modo? Grazie!
09-22-2016 04:29 AM
You might get more feedback if you posted your question in English.
If do have an inkling that I might be able provide some help regarding semaphore files and their use, especially on UNIX platforms.
09-22-2016 05:08 AM
Thank you Kurt. So I translate in english my question:
Every day there is a scheduled job (in Unix machine) that export , in a specific location, a csv file that contains some information.
After the job produce that csv file, I need that the job produce also a semaphore file (the format is not important, but its name must contain the word OK) wich inform that the csv file is not empty.
How can I do this? What code I can write in the job? Thank you!
09-22-2016 05:17 AM
09-22-2016 08:42 AM
Thank you Kurt, but I think that in this way the procedure only create a file with the 'OK' information, but there is no kind of control on the csv file that the job creates before the SEM file. How can I implement this control (that help the user to understand that the csv file is not empty)?
09-22-2016 10:16 AM
You can add number of observations exported to the CSV file.
To answer the question - how to do it - please display your code for exporting:
is it by proc export or by data step or by sql ?
09-23-2016 01:33 AM
If you just want to check for a certain number of records processed in an export, you can do that:
* necessary, because the following data step will have no iteration at all if dataset indataset is empty; data _null_; file "outfile" /* options */; set indataset /* options */ end=done; put /* variables */ ; if done then call symput('nrecords',strip(put(_n_,best.))); run; %macro write_sem; %if "&nrecords" ne "0" %then %do; data _null_; file "semfile"; put 'OK'; run; %end; %mend; %write_sem;