You are on page 1of 24

AutoEdit variables (Date and Time)

Few examples:
Below %%BB is resolved to 5PM on current system date
%%AA= %%$CALCDATE %%$DATE
%%BB= %%AA.1700

Below %%BB is resolved to 6:40 AM on next day of current system date


%%AA= %%$CALCDATE %%$ODATE +1
%%BB= %%AA.0640

AutoEdit functions
%%CALCDATEAdds or subtracts a specified number of days from a specified date.

On October 1, 2012, %%A resolves to 120930 in any of the following expressions:

%%A=%%CALCDATE %%DATE -1
%%A=%%CALCDATE 121001 -%%DAY
%%A=%%CALCDATE 120929 +1

%%$CALCDATESame as %%CALCDATE, but handles 4-digit years.

On October 1, 2012, %%A resolves to 20120930 in any of the following expressions:


%%A=%%$CALCDATE %%$DATE -1
%%A=%%$CALCDATE 20121001 -%%DAY
%%A=%%$CALCDATE 20120929 +1

%%SUBSTRExtracts a substring from a specified string.

Syntax:
%%SUBSTR variable start_position length

In the following series of expressions, %%Number resolves to TWO:


%%Nstring=ONETWOTHREE
%%Start=4
%%Number=%%SUBSTR %%Nstring %%Start 3

An example for Date & time.


%%HH %%SUBSTR %%TIME 1 2
%%MM %%SUBSTR %%TIME 3 2
%%SS %%SUBSTR %%TIME 5 2
%%PARM1 %%$OYEAR:%%OMONTH:%%ODAY%%BLANK1.%%HH..%%MM..%%SS
result is : 2012:10:01 10.58.02
Variables Substitution
AutoEdit variables can be defined using:

MFBSIJCL parameter names/values (including @parms_file)

OS environment variables

%%GLOBAL or %%LIBSYM control statements

%%SET control statement

MFBSI maintains a single variables pool. All variables are managed the same way in this pool. The
MFBSI variable pool does not contain OS environment variables, except for system scheduling dates.
See the topic on resolving original scheduling system date variables for more information.
The variables are searched in this order:

MFBSI variables pool

OS environment variables

AutoEdit system variables

Variable names are case insensitive. Variable values can have a maximum 80 character length.
Parent topic: Enabling Control-M AutoEdit Use

Date System Variables


The MFBSI system date variables for use with the Control-M AutoEdit facility are:

TIME TIMEID RDATE

DATE ODATE RJULDAY

JULDAY OJULDAY $RJULDAY

$JULDAY $OJULDAY RDAY

DAY ODAY RWDATE

WDAY OWDAY RMONTH


MONTH OMONTH RYEAR

YEAR OYEAR RWEEK

WEEK OWEEK $RCENT

$CENT $OCENT

Parent topic: Enabling Control-M AutoEdit Use

Resolving Original Scheduling (%%O and %%$O) System Date


Variables
The Control-M AutoEdit facility can define or export these OS environment variables before
executing MFBSIJCL or the script that executes MFBSIJCL.

ODATE [YYMMDD] [%%ODATE]

CENT [CC] [%%CENT]

PARMS ODATE=%%ODATE [CENT=%%CENT] may also be used in the MFBSIJCL command line to
set %%ODATE and %%CENT.
When MFBSIJCL starts execution, it retrieves ODATE and CENT OS environment variable values.
These are saved in the MFBSI symbols pool to
resolve%%ODATE, %%ODAY, %%OMONTH and %%OYEAR found in the JCL member to be
executed. Based on the values of these variables, additional Control-M AutoEdit variables are evaluated
and stored in MFBSI symbols pool:

$OYEAR [CCYY]

$ODATE [CCYYMMDD]

OWEEK [nn] where nn = 01 - 53

OWDAY [d] where d = 1 -7

OJULDAY [JJJ] where JJJ = Julian date

$OCENT [CC]

When MFBSI is used with a scheduler other than Control-M, the OS


variables ODATE, ODAY, OMONTH, OYEAR and CENT must be explicitly defined
whenever %%ODATE, %%ODAY, %%OMONTH, %%OYEAR, %%$DATE, %%$OYEAR, %%OJULDAY
, %%$OJULDAY, %%OWEEK, %%OWDAT or%%$CENT require resolution in the JCL. Control-M
resolves these system variables based on the current OS system date.
If CENT is not defined in the OS environment, the current OS system century is used.
Example
This example shows a Control-M set/export ODATE=010201 (1 Feb.) and CENT=20 (year 2001) and
variables defined in the MFBSI symbols pool at MFBSIJCLinitialization.
9 //* %%LISTVAR
10 //*
--------------------------------------------------------------------<LISTVAR
11 //* ODATE = [010201] <LISTVAR
12 //* OYEAR = [01] <LISTVAR
13 //* OMONTH = [02] <LISTVAR
14 //* ODAY = [01] <LISTVAR
15 //* $ODATE = [20010201] <LISTVAR
16 //* $OYEAR = [2001] <LISTVAR
17 //* OWEEK = [05] <LISTVAR
18 //* OWDAY = [4] (if first day of week is defined as Monday) <LISTVAR
19 //* OJULDAY = [032] <LISTVAR
20 //* $OJULDAY = [2001032] <LISTVAR
21 //* $OCENT = [20] <LISTVAR
22 //*
--------------------------------------------------------------------<LISTVAR
Parent topic: Enabling Control-M AutoEdit Use

Send feedback about this topic

%%IF, %%ELSE, and %%ENDIF


MFBSI supports a maximum of three nested %%IF levels.
This example shows %%IF, %%ELSE, and %%ENDIF variable substitution:

Statement/Expression Resolves as...

//* %%SET %%STEP=STEP1 //* %%SET %%STEP=STEP1

//* %%IF %%STEP EQ STEP1 //* %%IF STEP1 EQ STEP1


//STEP1 EXEC PGM=IEFBR14 //STEP1 EXEC PGM=IEFBR14
//* => To be executed //* => To be executed
//SYSOUT DD SYSOUT=* //SYSOUT DD SYSOUT=*
//* %%ELSE //* %%ELSE
//STEP2 EXEC PGM=IEFBR14
//* => To be excluded
//SYSOUT DD SYSOUT=*
Statement/Expression Resolves as...

//* %%ENDIF //* %%ENDIF


//* => Always executed //* => Always executed
//STEP3 EXEC PGM=IEFBR14 //STEP3 EXEC PGM=IEFBR14
//* => Always executed //* => Always executed
//SYSOUT DD SYSOUT=* //SYSOUT DD SYSOUT=*

//* %%IF %%STEP NE STEP1 //* %%IF STEP1 NE STEP1


//STEP1 EXEC
PGM=IEFBR14,PARM='%%DATE'
//* => To be excluded
//SYSOUT DD SYSOUT=*
//* %%ELSE
//* %%ELSE
//STEP2 EXEC
//STEP2 EXEC PGM=IEFBR14,PARM='110716'
PGM=IEFBR14,PARM='%%ODATE'
//* => To be executed
//* => To be executed
//SYSOUT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//* %%ENDIF
//* %%ENDIF
//* => Always executed
//* => Always executed
//STEP3 EXEC
//STEP3 EXEC PGM=IEFBR14,PARM='110716'
PGM=IEFBR14,PARM='%%RDATE'
//SYSOUT DD SYSOUT=*
//SYSOUT DD SYSOUT=*

//* %%SET %%STEP=STEP2 //* %%SET %%STEP=STEP2

//* %%IF %%STEP EQ STEP1 //* %%IF STEP2 EQ STEP1


//* %%ELSE //* %%ELSE
//STEP1 EXEC PGM=IEFBR14 //STEP1 EXEC PGM=IEFBR14
//* => To be executed //* => To be executed
//SYSOUT DD SYSOUT=* //SYSOUT DD SYSOUT=*
//* %%ENDIF //* %%ENDIF
//STEP2 EXEC PGM=IEFBR14 //STEP2 EXEC PGM=IEFBR14
//* => Always executed //* => Always executed
//SYSOUT DD SYSOUT=* //SYSOUT DD SYSOUT=*

Parent topic: Enabling Control-M AutoEdit Use


%%SET
The valid syntax for %%SET in MFBSI is:
%%SET %%VarName[space(s)]=[space(s)]Expression
Expression can be:

Constant or AutoEdit variable(s)

AutoEditFunction

AutoEditFunction %%PLUS|%%MINUS Number|AutoEdit variable

This example shows %%SET variable substitution:

Statement/Expression Resolves as...

%%SET %%PARM=XYZ %%PARM: [XYZ]

%%SET %%PARM =XYZ %%PARM: [XYZ]

%%SET %%PARM = XYZ %%PARM: [XYZ]

%%SET %%PARM = X Y Z %%PARM: [XYZ]

%%SET %%PARM=ABC DEF %%PARM: [ABCDEF]

%%SET %%PARM=ABC%%BLANK2DEF %%PARM: [ABC DEF]

%%SET %%PARM=ABC%%BLANKDEF %%PARM: [ABC DEF]

%%SET %%PARM=ABCDEF%%BLANK5 %%PARM: [ABCDEF ]

%%SET %%PARM=ABCDEF%%BLANK3 %%PARM: [ABCDEF ]

%%SET %%PARM='ABCDEF%%BLANK5' %%PARM: ['ABCDEF ']

%%SET %%PARM=%%$ODATE%%.ABC %%PARM: [20110701ABC]

%%SET %%PARM=%%$ODATE.ABC %%PARM: [20110701.ABC]

Error: %%$ODATEABC can't be resolved.


%%SET %%PARM=%%$ODATEABC
Note: If it exists in the pool, value of %%PARM is left as-is.

%%SET %%A=1
%%SET %%B=2
%%SET %%A2=100
Statement/Expression Resolves as...

// TAPE=TAPE100,
// TAPE=TAPE%%A%%B, // TAPE=TAPE1.2,
// TAPE=TAPE%%A.%%B, // PARM=PRM12,
// PARM=PRM%%A%%.%%B, // PARM=PRM1.2,
// PARM=PRM%%A%%..%%B, // PARM=1 2,
// PARM='%%A%%%BLANK3%%B', //DDN DD DSN=HLQ.DATASET.A12,
//DDN DD DSN=HLQ.DATASET.A%%A.%%B, //DDN DD DSN=HLQ.DATASET.A1.2,
//DDN DD DSN=HLQ.DATASET.A%%A..%%B, //DDN DD DSN=HLQ.DATASET.A1.2,
//DDN DD DSN=HLQ.DATASET.A%%A%%..%%B, //DDN DD DSN=HLQ.DATASET.A100,
//DDN DD DSN=HLQ.DATASET.A%%A%%B,

%%$ODATE%%BLANK5%%#AS-IS%%BLANK5%%WEEK 20110716 %%AS-IS 28

This example shows resolution of date functions in the %%SET control statement.

Statement/Expression Resolves as...

%%$YEARWK# %%$DATE [2011W28]


%%$YEARWK# 20010214 [2011W28]
%%$YEARWK# 20050101 [2011W28]
%%$YEARWK# 20011231 [2011W28]

%%$YEARWK# 20101220 [2011W28]


%%$YEARWK# 20101227 [2011W28]
%%$YEARWK# 20110102 [2011W28]
%%$YEARWK# 20110103 [2011W28]

%%$CALCDTE %%$ODATE +D1 [20110717]


%%$CALCDTE %%$ODATE +1 [20110717]

%%SET %%ADD_DATE=7 [7]


%%$CALCDTE %%$ODATE +%%ADD_DATE [20110723]
%%$CALCDTE 20110101 -1 [20101231]
%%$CALCDTE 20101231 +1 [20110101]
%%$CALCDTE 20110228 +1 [20110301]
%%$CALCDTE 20110228 +1 [20110301]
This example shows resolution of %%PLUS / %%MINUS in the %%SET control statement:

Statement/Expression Resolves as...

%%SET %%_SCRATCH1=10 %%PLUS 25 [35]


%%SET %%_SCRATCH2= %%B %%MINUS %%A [1]
%%SET %%_SCRATCH3=%%A %%PLUS %%B [3]

This example shows resolution of %%SUBSTR in the %%SET control statement:

Statement/Expression Resolves as...

%%SET %%STR=00-01-02 [00-01-02]


%%SET %%TAPE_01=%%SUBSTR %%STR 4 2 [01]
%%SET %%TAPE_02=EE100002 [EE100002]
%%SET %%TAPE_03=EE100003 [EE100003]
%%SET %%TAPE_04=EE100004 [EE100004]
%%SET %%TAPE_05=EE100005 [EE100005]
%%SET %%TAPE_06=EE100006 [EE100006]
%%SET %%TAPE_07=EE100007 [EE100007]
%%SET %%TAPE_08=EE100008 [EE100008]
%%SET %%TAPE_09=EE100009 [EE100009]
%%SET %%TAPE_10=EE100010 [EE100010]
%%SET %%TAPE_11=EE100011 [EE100011]
%%SET %%TAPE_12=EE100012 [EE100012]

// UNIT=TAPE,VOL=SER=TAPE%%TAPE_01, // UNIT=TAPE,VOL=SER=TAPE01,
// UNIT=TAPE,VOL=SER=%%TAPE%%OMONTH, // UNIT=TAPE,VOL=SER=EE100007,
Parent topic: Enabling Control-M AutoEdit Use

Send feedback about this topic

%%GLOBAL and %%LIBSYM


%%GLOBAL and %%LIBSYM values are stored in text files. In these text files:

Each record specifies the parameter name and the associated value.

Blank lines are ignored.

Comment lines start with a semicolon.

Values that contain explicit spaces are enclosed in double quotes.


This shows an example of symbol file contents:
; some comment
ABC=ABC

def="ABC DEF"
Group = XYZ
Parm2 = "'123 567'"
The environment variable DAGLOBAL specifies the folder for the text file(s) used by %%GLOBAL. In a
similar way, for %%LIBSYM members, the folder name is extracted from an environment variable or from
the catalog.
This example shows resolution of %%GLOBAL and %%LIBSYM control statements:

Statement/Expression Resolves As

//* %%GLOBAL MBRNAME The environment variable DAGLOBAL specifies


the location of the MBRNAME text file.

//* %%LIBSYM DATA.SET.NAME %%MEMSYM MBRNAME The environment


variable DATA.SET.NAME orDATA.SET.NAME as
defined in the catalog specifies the MBRNAME
text file location.
Parent topic: Enabling Control-M AutoEdit Use

Send feedback about this topic

%%INCLIB and %%INCMEM


The syntax for %%INCLIB and %%INCMEM are:
//* %%INCLIBDataSetName %%INCMEMmember
or
//* %%INCLIB DDNAME=ddName %%INCMEMmember
DataSetName or ddName must be exported as an environment variable and point to the folder where the
file that defines member is found. Otherwise, the catalog is used. Extensions are not used in the syntax.
You can specify multiple paths with concatenation if using ddName. Each path is separated by a
semicolon (Windows) or colon (UNIX/Linux).

%%GOTO and %%LABEL


Use %%GOTO either subordinated to a conditional control statement such as %%IF or %%ELSE, or as
an imperative statement. If used within a conditional control statement, %%GOTO implicitly terminates
the conditional control statement.
The label names specified with %%GOTO or %% LABEL are constant, so they are resolved as a
variable. The search for a %%LABEL associated to a %%GOTO is done in ascending order from
the %%GOTO position.
Displaying the Symbols Pool in JCL Command Lines
MFBSI has specific control statements that insert the existing symbols pool into JCL as command lines.
Use the %%LISTVAR or %%LISTVARS control statements to do this.
9 //* %%LISTVAR
10 //* --------------------------------------------------------------------
<LISTVAR
11 //* ODATE = [010201]
<LISTVAR
12 //* OYEAR = [01]
<LISTVAR
22 //* --------------------------------------------------------------------
<LISTVAR
Parent topic: Enabling Control-M AutoEdit Use

When MFBSI detects an AutoEdit error, it inserts an error message in the JCL just before the statement
in error. The error message text starts with //* ??? JCLSI0050E. The end of the message displays
the number of the original JCL line.
For example:
1 //MFIDPS01 JOB 'MFIDPS',CLASS=A,MSGCLASS=1
2 //* %%GLOBAL GLOBAL01
3 //* %%LIBSYM MFIDPS.CTRLM.SYMB %%MEMSYM SYMMBR01
4 //* %%SET %%SYMBMBR=SYMMBR01
5 //* %%LIBSYM MFIDPS.CTRLM.SYMB %%MEMSYM %%SYMBMBR
6 //*
7 //STEP1 EXEC PGM=IEFBR14
8 //SYSOUT DD SYSOUT=*
9 //*??? JCLSI0050E For "DAGLOBAL(NOTFOUND)" file open error: 9/009. (9)
10 //* %%GLOBAL NOTFOUND << JCLin
11 //*
In case of AutoEdit error(s), MFBSI generates a bad JCL statement at the end of the JCL to abort the
submitted job.
21 //*
22 // ***** MFBSI GENERATED JCL ERROR (AUTOEDIT FACILITY ERROR) *****
**** JCLCM0409E INVALID OPERATOR
23 //
**** JCLCM0172E JOB FAILED - JCL ERROR

If this happens, the Control-M AutoEdit facility receives a get RC=208 message.
The submitted JCL can be found in the $MFBSI_DIR\JCLTemp folder.
Parent topic: Enabling Control-M AutoEdit Use
http://documentation.microfocus.com/help/index.jsp?topic=%2Fcom.microfocus.eclipse.infocent
er.studee60ux%2FGUID-385EDA67-B4F2-4BD7-9DA7-2788EC80CF5F.html

te quejes, no esperes a ver que puede la informatica hacer por ti, si no que puedes
hacer tu con la informatica.
alfrcort
Usuario

Mensajes: 21

Registrado: 14 Ene 2009, 09:15

Pas: espaa

Ciudad: madrid

Ocupacin: Lider de proyectos

A
r
r
i
b
a

Re: calculo de fechas por CONTROL-M

por alfrcort 09 Abr 2011, 21:52

hola rulas

aqui te dejo la lista de variables de fecha de control-m, no se cual se utlize para calcular lo que
necesitas y espero que te sirva de algo
por cierto mi perfil dice que estoy en espaa, ahora estoy en mexico.
--------------------------------------------------------------------------------------------------
tomado del manual de control-m de banco BSCH (Banco Santander Central Hispano)

10.1 Variables del sistema.


El formato de estas variables es:
%%nombre_de_la_variable
donde %% son los smbolos que identifican variable de autoedicin para C-M. Este
sustituir la variable por su contenido y ajustar la longitud de la lnea donde est escrita.

Las variables de auto-edicin del sistema son:


%%ODATE : Fecha original del Job (YYMMDD).
%%OYEAR : Ao original del Job (YY).
%%OMONTH : Mes original del Job (MM).
%%ODAY : Da original del Job (DD).
%%OWDAY : Da original de la semana del Job (1=DOMINGO, 2=LUNES ...
6=VIERNES, 0=SABADO).
%%OJULDAY : Da original del trabajo en el ao (JJJ)
%%RDATE : Fecha actual de trabajo del sistema (YYMMDD)
%%RYEAR : Ao actual de trabajo del sistema (YY)
%%RMONTH : Mes actual de trabajo del sistema (MM)
%%RDAY : Da actual de trabajo del sistema (DD)
%%RWDAY a de la semana actual de trabajo del sistema (idem %%OWDAY)
%%DATE : Fecha gregoriana de trabajo (YYMMDD).
%%YEAR : Ao gregoriano de trabajo (YY).
%%MONTH: Mes gregoriano de trabajo (MM).
%%DAY : Da gregoriano de trabajo (DD).
%%WDAY : Da de la semana del da gregoriano (dem %%RWDAY).
%%JULDAY : Da juliano de la fecha de trabajo (JJJ)
%%TIME : Hora del da (HHMMSS).
%%$SIGN : El valor dado en $ representa el identificador del ordenador sobre
el que el Job debe ejecutarse.
%%BLANK : Blanco.

10.5.5 %%CALCDATE.
Puede calcular fechas a partir de una fecha dada. Su formato ser:
%%CALCDATE fecha +/- una_cantidad
donde la fecha estar en formato en YYMMDD y la cantidad estar dentro del rango 1- 65.
Ejemplo.
%%SET %%FECHA-AYER = %%CALDATE %%ODATE - 1
cuyo resultado ser para el 1 de junio de 1992
%%SET %%FECHA-AYER = 920530
La sentencia %%CALCDATE debe incluirse como parte de la sentencia %%SET
no te quejes, no esperes a ver que puede la informatica hacer por ti, si no que puedes hacer tu con la
informatica.

alfrcort

Usuario

Mensajes: 21

Registrado: 14 Ene 2009, 09:15

Pas: espaa

Ciudad: madrid

Ocupacin: Lider de proyectos

Men
Perso
nal

Bienve
nido DinoLand - Foros informticos en espaol
Invita
do Area para los "compu" sapiens que desean aprender y ayudar a otros.

U
s Obviar
er
: Buscar Buscar

P Bsqueda avanzada
a
ss
: ndice general MVS - OS/390 - z/OS Control de versiones
Ingre
sar
auto Cambiar tamao de la fuente
mtic
amen
te: Imprimir vista

FAQ
Login
Registrarte
Regis
trart Identificarte
e!
Olvid calculo de fechas por CONTROL-M
mi Publicar una respuesta
clave
Re
Buscar este tema Buscar
envia
r
email 5 mensajes Pgina 1 de 1
de
activ
acin calculo de fechas por CONTROL-M

por rulas2009 08 Abr 2011, 23:27

Hola,
Comu
nique
se Tengo que calcular por medio de Control-M, algunas fechas, por ejemplo, corro con
con:
un odate del 2011-04-03, necesito calcular el primer dia habil del mes
Webmas anterior(20011-03-??) y el ultimo dia habil del mes anterior (2011-03-??)...alguien
ter
tendra como se resuelven estas fechas.... gracias por su ayuda...

rulas2009
Bsq
ueda Usuario

Desca
rgas

Foro

Mensajes: 11

Registrado: 12 Sep 2010, 22:32

Pas: mexico

Buscar
Ciudad: queretaro

Ocupacin: Analista de desarrollo

A
r
Enlac r
es i
b
a
Pginas

de IBM Re: calculo de fechas por CONTROL-M


Sitios de

interes por alfrcort 09 Abr 2011, 19:27

Hola Rulas
Boletine me imagino que la fecha la necesitas a tiempo de control-M, o bien si la fecha la
s introduces (por ODATE), a un programa lo puedes calcular por programa, en caso de
Acerca que necesites la fecha ODATE del dia y ademas las fechas parametros de primer dia
de este
habil y ultimo habil del mes anterior, lo puedes resolver en la pantalla de control-m
sitio
de definicion del proceso en cuestion.
Encu
esta
alf
Cual
cree no te quejes, no esperes a ver que puede la informatica hacer por ti, si no que puedes
Ud. hacer tu con la informatica.
que es
la alfrcort
soluci
n a la
Usuario
edad
prome
dia
muy
alta
(50
aos)
de la
gente Mensajes: 21
de
mainfr Registrado: 14 Ene 2009, 09:15
ame.

Cambiar Pas: espaa


el
mainfra Ciudad: madrid
me por
UNIX/Li Ocupacin: Lider de proyectos
nux/Win
dows. A
r
r
i
Proveer b
herrami a
entas
grficas
(bajo
Re: calculo de fechas por CONTROL-M
windows
) para
por alfrcort 09 Abr 2011, 21:52
realizar
el hola rulas
trabajo.

aqui te dejo la lista de variables de fecha de control-m, no se cual se utlize para


Entrena
r en la
calcular lo que necesitas y espero que te sirva de algo
empres por cierto mi perfil dice que estoy en espaa, ahora estoy en mexico.
a gente
mas --------------------------------------------------------------------------------------------------
joven
que tomado del manual de control-m de banco BSCH (Banco Santander Central Hispano)
continue
la tarea
como 10.1 Variables del sistema.
hoy
(Pantall El formato de estas variables es:
a
%%nombre_de_la_variable
verde).
donde %% son los smbolos que identifican variable de autoedicin para C-M. Este
sustituir la variable por su contenido y ajustar la longitud de la lnea donde est
escrita.

Volver a Las variables de auto-edicin del sistema son:


ensear
en las %%ODATE : Fecha original del Job (YYMMDD).
universi
dades el %%OYEAR : Ao original del Job (YY).
mainfra %%OMONTH : Mes original del Job (MM).
me
(como %%ODAY : Da original del Job (DD).
se hacia
muchos %%OWDAY : Da original de la semana del Job (1=DOMINGO, 2=LUNES ...
aos
6=VIERNES, 0=SABADO).
atras).
%%OJULDAY : Da original del trabajo en el ao (JJJ)
%%RDATE : Fecha actual de trabajo del sistema (YYMMDD)
%%RYEAR : Ao actual de trabajo del sistema (YY)
Otra
%%RMONTH : Mes actual de trabajo del sistema (MM)
%%RDAY : Da actual de trabajo del sistema (DD)
432 Vo %%RWDAY a de la semana actual de trabajo del sistema (idem %%OWDAY)
tos
Totale %%DATE : Fecha gregoriana de trabajo (YYMMDD).
s
%%YEAR : Ao gregoriano de trabajo (YY).
Mirar
%%MONTH: Mes gregoriano de trabajo (MM).
encuest
a... %%DAY : Da gregoriano de trabajo (DD).
%%WDAY : Da de la semana del da gregoriano (dem %%RWDAY).
%%JULDAY : Da juliano de la fecha de trabajo (JJJ)
%%TIME : Hora del da (HHMMSS).
%%$SIGN : El valor dado en $ representa el identificador del ordenador sobre
el que el Job debe ejecutarse.
%%BLANK : Blanco.

10.5.5 %%CALCDATE.
Puede calcular fechas a partir de una fecha dada. Su formato ser:
%%CALCDATE fecha +/- una_cantidad
donde la fecha estar en formato en YYMMDD y la cantidad estar dentro del rango 1-
65.
Ejemplo.
%%SET %%FECHA-AYER = %%CALDATE %%ODATE - 1
cuyo resultado ser para el 1 de junio de 1992
%%SET %%FECHA-AYER = 920530
La sentencia %%CALCDATE debe incluirse como parte de la sentencia %%SET
no te quejes, no esperes a ver que puede la informatica hacer por ti, si no que puedes
hacer tu con la informatica.

alfrcort

Usuario

Mensajes: 21

Registrado: 14 Ene 2009, 09:15

Pas: espaa

Ciudad: madrid

Ocupacin: Lider de proyectos

A
r
r
i
b
a

Re: calculo de fechas por CONTROL-M

por rulas2009 10 Abr 2011, 00:21

ok...........gracias lo aplico y te comento

rulas2009

Usuario

Mensajes: 11

Registrado: 12 Sep 2010, 22:32

Pas: mexico

Ciudad: queretaro

Ocupacin: Analista de desarrollo

A
r
r
i
b
a

Re: calculo de fechas por CONTROL-M

por Tintxiko 11 Abr 2011, 09:53

Amigo rulas, te har falta algo parecido a lo siguiente:

CDIGO: SELECCIONAR TODO

//* ULTIMO DIA DEL MES ANTERIOR (UDMA)


//* %%SET %%UDM = %%CALCDATE %%OYEAR.%%OMONTH%%.01 -1
//* %%SET %%UDMA = 20%%UDM
//* ULTIMO DIA LABORABLE DEL MES ANTERIOR (UDLMA)
//* %%SET %%UDLMA = %%$WCALC %%UDMA < Calendario
//*
//* PRIMER DIA DEL MES ANTERIOR (PDMA)
//* %%SET %%AO_ANT = %%SUBSTR %%UDLMA 1 4
//* %%SET %%MES_ANT = %%SUBSTR %%UDLMA 5 2
//* %%SET %%PDMA = %%AO_ANT.%%MES_ANT%%.01
//* PRIMER DIA LABORABLE DEL MES ANTERIOR (PDLMA)
//* %%SET %%PDLMA = %%$WCALC %%PDMA > Calendario

"Function %%$WCALC performs a shift from the specified date to a working


date in the specified calendar, according to indicated instructions."

> : "If the specified date is not a current working date, shift to the
next working date in the calendar. (If the specified date is a working
date, do not shift.)"

< : "If the specified date is not a current working date, shift to the
previous working date in the calendar. (If the specified date is a
working date, do not shift.)"

Calendario : nombre del calendario en el que se especifican los das de trabajo.

Haz alguna prueba hasta que te cuadre.


Saludos desde Vitoria.

Salud para todos.

Tintxiko

Tintxiko

Colaborador

Mensajes: 138

Registrado: 09 Dic 2003, 18:58

Pas: Espaa

Ciudad: Vitoria

Ocupacin: Otra

Planificador Control-M y sus parmetros


por Coboler@ el Dom Abr 17, 2011 7:50 pm

Control-M es el Planificador de Trabajos o Jobs,


mediante el cual se van submitiendo las cadenas sin
necesidad de intervencin (tericamente) de ningn
Operador.

Control-M es un planificador que permite condicionar la


correcta ejecucin de una/s cadena/s a la ejecucin de
otra/s.

Control-M adems permite pasar una serie de


Parmetros a las cadenas que lanza, como pueden ser
la Fecha del da, Hora, SubSistema sobre el que corren
las cadenas, Unit de los ficheros de dicho SubSistema, y
otra serie de parmetros y variables tiles para la
ejecucin de las cadenas. Adems, permite operar con
estos parmetros (extraer el mes de la fecha, tomar la
fecha pero poniendo un da deseado, etc.).

EXP.CTM.V410.SYMBOL(DWHEMER)
DWHDSN = INF
DWHUNIT = SYSWRK
* MODIFICAR LAS VARIABLES EN CASO DE
EMERGENCIA ***
* EJEMPLO:
%%DWHDSN = PRODWH
%%DWHUNIT = WORK

Para hacer uso por ejemplo de estos parmetros en un


Jcl que va a ser ejecutado bajo Control-M, seria
necesario codificar algo as :

//INCM000 JOB (00,INC),S.A.C.


//**************************************
**************************
//* %%LIBSYM EXP.CTM.V410.SYMBOL
%%MEMSYM DWHEMER
//**************************************
**************************
//P005 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
DEL %%DWHDSN.INC.FECHAMES NVSAM
DEL %%DWHDSN.INC.M000MI01.UNLOAD
NVSAM
DEL %%DWHDSN.INC.M000MI09.UNLOAD
NVSAM
DEL %%DWHDSN.INC.M000MI11.UNLOAD
NVSAM
SET MAXCC=0
/*
//**************************************
**************************
//P010 EXEC TSOBATCH,COND=(0,NE)
//FECHAMES DD
DSN=%%DWHDSN.INC.FECHAMES,
// DISP=(,CATLG,DELETE),
//
UNIT=%%DWHUNIT,SPACE=(CYL,(100,20),RLSE
),
// DCB=RECFM=FB,LRECL=32,BLKSIZE=18432)
//SYSTSIN DD *
DSN SYSTEM (DBSP)
RUN PROG (INCM160)
END
/*

En el ejemplo, se genera el fichero FECHAMES, desde el


entorno de Produccin, pero para ser utilizado en el
Centro de Informacin, ya que se llamar
INF.INC.FECHAMES y tendr UNIT=SYSWRK.

Otros Parmetros que pueden usarse en las cadenas


son los de fechas, seria necesario codificar algo as :

//P070 EXEC DBSIUTIL,UID='LOADALTA'


//SYSREC DD
DSN=DBSI.MOROLOAD.TSMOMS.MES.D%%OJULD
AY,
// DISP=(OLD,PASS)
//SYSIN DD *
LOAD DATA REPLACE LOG NO DISCARDS 1
INTO TABLE BKMOROCI.MOMORO_SCTO
RUNSTATS TABLESPACE BKMOROCI.TSMOMS
INDEX(ALL) TABLE(ALL)
/*

En el ejemplo, se realiza la carga de la tabla NUMALTAS


con el fichero SYSREC, mediante la utilidad DBSIUTIL,
pero la parte final del fichero toma el nombre D + Da
Juliano (D109), recogido de Control-M.

//P010 EXEC PGM=IAFGENN1,COND=(0,NE)


//ENTRADA DD
DSN=EXP.MICIAF.POSM0981.D%%ODATE,DISP=
SHR
//SALIDA DD DSN=&&POSM0981,
// DISP=(,PASS),UNIT=WORK,
// SPACE=(TRK,(50,10),RLSE),
//
DCB=(RECFM=V,LRECL=32722,BLKSIZE=32726)
//SYSPRINT DD SYSOUT=*
//CONTROL1 DD
DSN=EXP.IAF.DATA(POSM0981),DISP=SHR

En el ejemplo, se ejecuta el programa IAFGENN1,


tomando como entrada el fichero ENTRADA, al cual
toma como parmetros para su nombre en su parte
final D + Fecha Da (D981122).

Tambin podemos tener nuestros propios Parmetros


que pueden usarse en las cadenas de la siguiente forma
:

//XARD029 JOB (00,EXT),CONTABILIDAD


//**************************************
**************************
//JOBLIB DD
DSN=CSP330.AELOAD.PRO,DISP=SHR
//**************************************
**************************
//* %%SET %%B1 = BKPOSI.POSICION
//**************************************
**************************
//P010 EXEC DSNTIPRO
//SYSREC00 DD
DSN=PRO.WORK.XAR.TSPOSI,DISP(,PASS),
// UNIT=WORK,SPACE=(TRK,(500,50),RLSE)
//SYSIN DD *
%%B1 WHERE POSI_CENTRO = 0005 AND
POSI_TIPOCTA = 18
/*

En el ejemplo, se realiza la descarga de la tabla


POSICION de creador BKPOSI, sobre el fichero
SYSREC00, mediante la utilidad DSNTIPOR, extrayendo
nicamente del Centro 0005 aquellas filas cuyo tipo de
cuenta sea 18.

You might also like