Automating the Envision Process Handler

Step 1: Create theUnidata Subroutine

  1. Log in to Colleague Studio
  2. Start a new Colleague Studio Project (File -> New -> Project)
  3. From the New Project window, choose Colleague Studio Project
  4. Give the project a name.
  5. Log into your test environment
  6. Create a new workgroup or choose an appropriate existing workgroup. The new project will be created.
  7. Right click on the project and choose to create a new process.
  8. Fill out the New Process Parameters as follows:
    Application: CORE
    Process Type: Subroutine Process
    Process Name: XS.BUILD.PHANTOM.QUEUES (Follow your college's naming scheme.)
    Description: Build Phantom Queues
    Default Menu Mnemonic: (leave blank)
    Release Status: Developing
    Press Next to continue.
  9. The next screen, Subroutine Process Specific Parameters, should have "Subroutine" checked, and everything else blank. Press Finish to create your process.

  1. Select "Code" from the tabs running across the bottom of the main pane.

Note Regarding X.STOP.TIME: X.STOP.TIME is hardcoded to 12:55 am in the code below (bolded). It is important to schedule the envision phantom process to stop one to two hours before the backup process starts, in order to allow time for large processes to run. If 12:55 is not an appropriate time for you, you can change it by setting X.STOP.TIME =

Copy and paste this code into the code pane, updating X.STOP.TIME as needed.:

X.DATE = DATE()

*------

* 1 hour = 3600 seconds, 1 day = 86400 seconds

*------

* 1 = one second past midnight

* 3600 = 1 am, 43200 = noon, 72000 = 8pm

* 6900 = 1:55am

* 79200 = 10pm, 86400 = midnight

*------

*THIS WILL BE USED TO SET START TIME ONE MIN FROM NOW

X.TIME = TIME() + 60

*THIS WILL BE USED TO SET STOP TIME

*ADJUST THE NUMBER OF SECONDS TO YOUR DESIRED STOP TIME

* Set stop time to 12:55am:

X.STOP.TIME = 3300

V.PHANT.ACTIVE.QUEUES.ID = 'PHANT.ACTIVE.QUEUES'

FOR_THE PHANT.ACTIVE.QUEUES.ID

VL.PHANT.RUNNING.QUEUES = 'DEFAULT'

VL.PHANT.STATUS = 'START'

* START DATE THIS CRON IS RUN IS TODAY

VL.PHANT.START.DATE = X.DATE

*START TIME IS ONE MIN FROM NOW

VL.PHANT.START.TIME = X.TIME

*STOP DATE IS TOMORROW

X.DATE = DATE() + 1

VL.PHANT.STOP.DATE = X.DATE

*STOP TIME IS 12:55AM

VL.PHANT.STOP.TIME = X.STOP.TIME

VL.PHANT.SUSPEND.TIME.START = ''

VL.PHANT.SUSPEND.TIME.END = ''

*RUN ONLY ONE JOB AT A TIME

VL.PHANT.MAX.TO.RUN = '1'

END_THE PHANT.ACTIVE.QUEUES.ID

RETURN

  1. Select "Elements" from the tab across the bottom. Add the following Elements:
    PHANT.ACTIVE.QUEUES.ID
    PHANT.RUNNING.QUEUES
    PHANT.STATUS
    PHANT.START.TIME
    PHANT.START.DATE
    PHANT.STOP.DATE
    PHANT.STOP.TIME
    PHANT.SUSPEND.TIME.END
    PHANT.SUSPEND.TIME.START
    PHANT.MAX.TO.RUN

  1. Press the "Generate a Process Definition" button from the menu to create generated code.
  1. Right click on the process and choose Export to export the subroutine.

Creating the Unidata Paragraph

  1. Close out of Colleague Studio and get to a colon prompt for the test environment.
  2. Type AE VOC X<COLLEGE NUMBER>.START.PROCESS.HANDLER (or use your college's naming scheme)
  3. Enter the following lines (Note: the bolded line should be the Process name from step 4a)
    001: PA
    002: *STARTS E.P.H.RUN AS CRONJOBS FROM CRON
    003: *
    004: XS.BUILD.PHANTOM.QUEUES
    005: UDT.OPTIONS 8 OFF
    006: PHANTOM PROCESS.PHANTOM.QUEUES
    007: PROC.BROWSE ''
  4. FI to file the paragraph
  5. Test the paragraph by typing the paragraph's name at the colon prompt and pressing enter. It should start a phantom process and not give you any errors.
  6. Exit your telnet session.

Package the Unidata Process

  1. Return to your Colleague Studio project
  2. Right click on the process you created and select Team -> Check Out
  3. Right click again and choose Team -> Ready for Build
  4. Open Datatel Colleague and go to CPKG
  5. Log in with your LPR username and password
  6. Give the package a meaningful name on the lookup screen
  7. Choose to add a new package

Code for setting up multiple queues…

X.DATE = DATE()

*------

* 1 hour = 3600 seconds, 1 day = 86400 seconds

*------

* 1 = one second past midnight

* 3600 = 1 am, 43200 = noon, 72000 = 8pm

* 6900 = 1:55am

* 79200 = 10pm, 86400 = midnight

*------

* Set stop time to 12:55am:

X.STOP.TIME = 3300

V.PHANT.ACTIVE.QUEUES.ID = 'PHANT.ACTIVE.QUEUES'

FOR_THE PHANT.ACTIVE.QUEUES.ID

VL.PHANT.RUNNING.QUEUES<1,1> = 'DEFAULT'

VL.PHANT.RUNNING.QUEUES<1,2> = 'PORTAL'

VL.PHANT.RUNNING.QUEUES<1,3> = 'SS'

VL.PHANT.STATUS<1,1> = 'START'

VL.PHANT.STATUS<1,2> = 'START'

VL.PHANT.STATUS<1,3> = 'START'

* START DATE THIS CRON IS RUN

VL.PHANT.START.DATE<1,1> = X.DATE

VL.PHANT.START.DATE<1,2> = X.DATE

VL.PHANT.START.DATE<1,3> = X.DATE

*START TIME IS ONE MIN FROM NOW

X.TIME = TIME() + 60

VL.PHANT.START.TIME<1,1> = X.TIME

VL.PHANT.START.TIME<1,2> = X.TIME

VL.PHANT.START.TIME<1,3> = X.TIME

*STOP DATE IS TOMORROW

X.DATE = DATE() + 1

VL.PHANT.STOP.DATE<1,1> = X.DATE

VL.PHANT.STOP.DATE<1,2> = X.DATE

VL.PHANT.STOP.DATE<1.3> = X.DATE

*STOP TIME IS 12:55AM

VL.PHANT.STOP.TIME<1,1> = X.STOP.TIME

VL.PHANT.STOP.TIME<1,2> = X.STOP.TIME

VL.PHANT.STOP.TIME<1,3> = X.STOP.TIME

VL.PHANT.SUSPEND.TIME.START<1,1> = ''

VL.PHANT.SUSPEND.TIME.START<1,2> = ''

VL.PHANT.SUSPEND.TIME.START<1,3> = ''

VL.PHANT.SUSPEND.TIME.END<1,1> = ''

VL.PHANT.SUSPEND.TIME.END<1,2> = ''

VL.PHANT.SUSPEND.TIME.END<1,3> = ''

*RUN ONLY ONE JOB AT A TIME

VL.PHANT.MAX.TO.RUN<1,1> = '1'

VL.PHANT.MAX.TO.RUN<1,2> = '2'

VL.PHANT.MAX.TO.RUN<1,3> = '5'

END_THE PHANT.ACTIVE.QUEUES.ID

RETURN