My shop is converting from CA ESP to CA Automic.
ESP provided a GENTIME function that is used to create customized date and/or time symbolic variables.
For example, there's a JCL that contains variable !PMOMMM
//JSTEP010 EXEC PGM=SORT
//SORTIN DD DSN=PLST.MST.LST.HISTORY.ACT.D(0),
// DISP=SHR
//SORTOUT DD DSN=PLST.PRM.LST.HISTORY.Y2018.!PMOMMM.(+1),
// DISP=(NEW,CATLG,DELETE),
// LRECL=1754,
// RECFM=VB,
// UNIT=VTS,
// RETPD=1460,
// VOL=(,,,10)
//SYSOUT DD SYSOUT=*
//SYSIN DD *
MERGE FIELDS=COPY
RECORD TYPE=V,LENGTH=(1754,,,150)
ESP would use GENTIME to resolve the variable
GENTIME PMO TODAY LESS 10 DAYS
So if the job was submitted on December 6th, the variable would resolve to NOV
i.e. PLST.PRM.LST.HISTORY.Y2018.NOV(+1),
If the job was submitted on December 12th, the variable would resolve to DEC
i.e. PLST.PRM.LST.HISTORY.Y2018.DEC(+1),
I have an include object with the following to get the first three letters of the month:
:SET &AMONTH# = GET_VAR(VARA.MONTHS,&AMM#)
:SET &PMOMMM# = STR_CUT(&AMONTH#,1,3)
It's getting the month from VARA.MONTHS
Where I'm struggling is how to incorporate code that would determine the month based on the current date minus 10 days.
Does anyone have ideas on how I can accomplish this in Automic?
Thanks!
Thanks Wolfgang, Pete and Phil!
The following was coded to resolve the issue
:SET &ADATE# = &$PHYS_DATE_YYYYMMDD#
:SET &YDATE# = sub_days(&ADATE#,10)
:SET &AYYYY# = STR_CUT(&ADATE#,1,4)
:SET &AYY# = STR_CUT(&ADATE#,3,2)
:SET &AMM# = STR_CUT(&ADATE#,5,2)
:SET &YMM# = STR_CUT(&YDATE#,5,2)
:SET &ADD# = STR_CUT(&ADATE#,7,2)
:SET &AD# = FORMAT(&ADD#)
:SET &ANR# = WEEKDAY_NR(&ADATE#)
:SET &ADAY# = GET_VAR(VARA.DAYS,&ANR#)
:SET &AMONTH# = GET_VAR(VARA.MONTHS,&AMM#)
:SET &YMONTH# = GET_VAR(VARA.MONTHS,&YMM#)
:IF &ADD# = "01" OR "21" OR "31"
: SET &DDSUFF# = "ST"
: ELSE
: IF &ADD# = "02" OR "22"
: SET &DDSUFF# = "ND"
: ELSE
: IF &ADD# = "03" OR "23"
: SET &DDSUFF# = "RD"
: ELSE
: SET &DDSUFF# = "TH"
: ENDIF
: ENDIF
:ENDIF
:SET &ATIME# = &$PHYS_TIME_HHMMSS#
:SET &AHH# = STR_CUT(&ATIME#,1,2)
:SET &AMN# = STR_CUT(&ATIME#,3,2)
:SET &***# = STR_CUT(&ATIME#,5,2)
:SET &ESPADATE# = "&ADAY# &AMONTH# &AD#&DDSUFF#, &AYYYY#"
:SET &ESPPDATE# = &ADATE#
:SET &ESPATIME# = "&AHH#.&AMN#.&***#"
:SET &ESPAMM# = &AMM#
:SET &PMOMMM# = STR_CUT(&YMONTH#,1,3)
The submitted JCL successfully resolved the variable to
//SORTOUT DD DSN=PLST.PRM.LST.HISTORY.Y2018.NOV.(+1),