I need a variable for ....

All questions about Control-M jobs definitions
Post Reply
User avatar
moha1984
Nouveau
Nouveau
Posts: 53
Joined: 08 Aug 2010 12:00

I need a variable for ....

Post by moha1984 » 08 Jan 2011 3:17

Hi

With the beginning of each month I create folder :

:
DEC_2010_BILL_CYCLE
JAN_2010_BILL_CYCLE

:

etc

I need a variable for the beginning of each month by var option for the below path

/opt/bcycle_shared/DEC_2010_BILL_CYCLE

User avatar
moha1984
Nouveau
Nouveau
Posts: 53
Joined: 08 Aug 2010 12:00

var

Post by moha1984 » 09 Jan 2011 12:27

The main directory is : MMM_YYYY_BILL_CYCLE

$ pwd
/opt/bcycle_shared/MMM_YYYY_BILL_CYCLE


how can refleacted trough Set tap in Control-M/Desktop

User avatar
nicolas_mulot
Nouveau
Nouveau
Posts: 149
Joined: 07 Jan 2010 12:00

Post by nicolas_mulot » 12 Jan 2011 11:58

moha1984

First, the month codes (JAN, FEB etc..) you intend to use are not covered by any autoedit variable. For that reason, you must associate the month codes available in autoedit to your own codes (01=JAN, 02=FEB etc..)

Do do so, you can either rely to a %%LIBMEMSYM table, which would contain:
%%MOHAMONTH01=JAN
%%MOHAMONTH02=FEB
Etc..

I prefer to use global variables. You can define them using two methods:
The first method uses the ctmvar utility:
ctmvar –action set –var “%%\MOHAMONTH01” –VAREXPR “JAN”
ctmvar –action set –var “%%\MOHAMONTH02” –VAREXPR “FEB”
etc ..

These 12 commands would be stored in a script you can run daily.

The second method relies on a dummy job, you may run daily too, and which includes in its “steps” tab:
On stmt *
Code OK
Do set_var Name %%\MOHAMONTH01
Value JAN
Do set_var Name %%\MOHAMONTH02
Value FEB
Etc..

(don’t miss the backslash, to indicate the variable is global)

Once these values are defined, you can use them in the %%SET tab of any job, like this:

Var Name Value
%%DIR /opt/bcycle_shared/%%MOHAMONTH%%OMONTH.._%%$OYEAR._BILL_CYCLE

Today, for example, %%OMONTH will resolve in “01”, as being a system variable, then create a new variable %%MOHAMONTH01, which will resolve in “JAN” as a global variable.

Pls note the double dot after the %%OMONTH, which is necessary to isolate the following “_”, and the single dot after %%$OYEAR, for the same reason.
Don’t ask why we need two dots for the first concatenation, then a single one for the second one.

Cheers
Nicolas Mulot

Post Reply