Automic Workload Automation

  • 1.  Is there an Automic alternative to ESP gentime function

    Posted Dec 06, 2018 10:39 AM

    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.

    https://docops.ca.com/ca-workload-automation-esp-edition/11-4/en/reference/commands/gentime-command-generate-times

     

    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!

     

     



  • 2.  Re: Is there an Automic alternative to ESP gentime function

    Posted Dec 06, 2018 02:15 PM

    Hi

     

    as far as I understand you want to count back 10 days from a given date.

    script functuion SUB_DAYS does the trick.

    As optional parameter you can specify a CALE object if needed...

     

     

    Automic 

     

    cheers, Wolfgang



  • 3.  Re: Is there an Automic alternative to ESP gentime function

    Posted Dec 06, 2018 03:58 PM

    What about adding days?

    Is there an ADD_DAYS feature?



  • 4.  Re: Is there an Automic alternative to ESP gentime function

    Posted Dec 06, 2018 04:12 PM

    yes and both work:

    :SET &ADATE# = &$PHYS_DATE_YYYYMMDD#
    :SET &YDATE# = sub_days(&ADATE#,10)
    :SET &FDATE# = add_days(&ADATE#,30)

     

    :INC JOBI.OPENFRAME.TEST
    :PRINT &PMOMMM#
    :PRINT &YDATE#
    :PRINT &FDATE#

     

     

    2018-12-06 15:07:24 - U00020408 20181126
    2018-12-06 15:07:24 - U00020408 20190105



  • 5.  Re: Is there an Automic alternative to ESP gentime function

    Posted Dec 06, 2018 05:20 PM

    I sometimes prefer to do this sort of thing with a database SQL instruction, so I can put it inside of a UC4 SQL or SQLI variable and just call out that variable when needed, such as to populate a default value in a promptset or whatever.



  • 6.  Re: Is there an Automic alternative to ESP gentime function
    Best Answer

    Posted Dec 07, 2018 06:59 PM

    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),