midrange.com code scratchpad
Name:
CHGSCDJOB
Scriptlanguage:
Plain Text
Tabwidth:
4
Date:
03/15/2013 03:50:36 pm
IP:
Logged
Description:
The user was to lazy to give a description
Code:
  1.      H Copyright('(C) Copyright Group Dekko Services, LLC')
  2.      H ActGrp(*CALLER)
  3.      H DftActGrp(*NO)
  4.      H ExprOpts(*RESDECPOS)
  5.      H Bnddir('ROUTINES/SRVPGM':'QC2LE')
  6.      H OPTION(*NODEBUGIO)
  7.       ****************************************************************
  8.       * Created By:
  9.  
  10.       *     Group Dekko International Inc.
  11.       *     P.O. Box 2000
  12.       *     U.S. 6 and C.R. 400 E
  13.       *     Kendallville, IN  46755
  14.  
  15.       * CHGSCHJOB- Change Scheduled Jobs
  16.  
  17.       *--------------------------------------------------------------
  18.       * LTS    02/15/07  Initial write
  19.       * LTS    01/23/08  If a job being released missed a submit,
  20.       *                  do a submit immeditate.  Submitting these jobs
  21.       *                  will require a high level of authority.
  22.       * LTS01  03/12/13  Prevent library list errors on jobs submitted immediately.
  23.  
  24.       *--------------------------------------------------------------
  25.       * This program is used to hold scheduled jobs before a MIMIX
  26.       * failover.  It is then used to release scheduled jobs after
  27.       * the return to the normal production platform.
  28.       * Only SCD and HLD status codes are of interest to this process.
  29.       * Only jobs held by the current user can be released.
  30.       ****************************************************************
  31.       * 1. Process by *ALL, or a Job name.  (Wildcard * is valid as
  32.       *    (Wildcard * is valid as the last character of a job name.)
  33.       * 2. Commands can be Hold, Release, or Purge List.
  34.       * 3. Process the job list using the user index.
  35.       *    (The file will only contain jobs placed on hold by this process.)
  36.       *    A.  Holding Jobs
  37.       *      1). Hold the schedule entry
  38.       *      2). Updated the list
  39.       *    B.  Releasing Jobs that are on the list.
  40.       *      1). Restore status
  41.       *      2). Remove from the list.
  42.       *    C.  Purging the List
  43.       *      1). If job is on list, remove the index entry.
  44.       *      2). If not on list, ignore the request.
  45.       ****************************************************************
  46.       *Called Programs:€
  47.  
  48.       * Program Name         Description
  49.       * API QWCLSCDE         List Job Schedule Entries
  50.       * API QUSRTVUS         Retrieve User Space entry
  51.       * API QUSCRTUS         Create   User Space
  52.       * API QUSCUSAT         Change   User Space Attributes
  53.       * CLP GETHDGC          Retrieve system name
  54.  
  55.       ****************************************************************
  56.  
  57.      FCHGSCDJOB UF A E           K DISK
  58.  
  59.       *****************************************************************
  60.  
  61.      D Date            S               D
  62.      D DateWk          S               D
  63.      D Apos            S              1A   INZ(X'7D')
  64.      D JobDsc          S             21A   Inz(*Blanks)
  65.      D JobQue          S             21A   Inz(*Blanks)
  66.      D MsgQue          S             21A   Inz(*Blanks)
  67.  
  68.       *****************************************************************
  69.       * API Variables
  70.       *****************************************************************
  71.       * Execute Command (system) Subprocedure Variables
  72.      D SystemCmd       PR            10I 0 ExtProc('system')
  73.      D  CmdText                        *   Value Options(*String)               Command text string
  74.  
  75.      D Cmd             S          32702A   Varying                              Command to execute
  76.      D ErrorCPF        S              7A   Import('_EXCP_MSGID')                Error number
  77.  
  78.      D IBMDtDS         DS
  79.      D IBMDate                       10A
  80.      D IBMC                    1      1
  81.      D IBMYY                   2      3
  82.      D IBMMM                   4      5
  83.      D IBMDD                   6      7
  84.  
  85.      D MDYDS           DS
  86.      D MDYMM                   1      2
  87.      D MDYDD                   3      4
  88.      D MDYYY                   5      6
  89.      D MDYMDY                  1      6  0
  90.  
  91.       ****************************************************************
  92.       *  API parms
  93.       ****************************************************************
  94.  
  95.      D sjRtv           DS
  96.      D  sjInfSts               1      1                                         Information Status
  97.      D  sjJobNam               2     11                                         Job Name
  98.      D  sjEntry               12     21                                         Entry Number
  99.      D  sjScdDate             22     31                                         Sched Date
  100.      D  sjScdDays             32    101                                         Sched Days
  101.      D  sjScdTime            102    107                                         Sched Time
  102.      D  sjScdFreq            108    117                                         Sched Frequency
  103.      D  sjScdDOM             118    167                                         Reltv Day of Month
  104.      D  sjRecover            168    177                                         Recovery Action
  105.      D  sjNxtSbm             178    187                                         Next Submit Date
  106.      D  sjStatus             188    197                                         Status
  107.      D  sjJobQNm             198    207                                         Job Queue Name
  108.      D  sjJobQLb             208    217                                         Job Queue Libr
  109.      D  sjAddUser            218    227                                         Added by User
  110.      D  sjLstSbmD            228    237                                         Last Submit Date
  111.      D  sjLstSbmT            238    243                                         Last Submit Time
  112.      D  sjText               244    293                                         Text
  113.      D  sjReserv1            294    316                                         Reserved
  114.      D  sjJQStat             317    326                                         Job Queue Status
  115.      D  sjDtOmit             327    526                                         Dates Omitted
  116.      D  sjJobDNm             527    536                                         Job Desc Name
  117.      D  sjJobDLb             537    546                                         Job Desc Libr
  118.      D  sjJobUser            547    556                                         Job User
  119.      D  sjMsgQNm             557    566                                         Msg Queue Name
  120.      D  sjMsgQLb             567    576                                         Msg Queue Libr
  121.      D  sjSavEnt             577    586                                         Save Entry
  122.      D  sjLstJobN            587    596                                         Last Sbm Job Name
  123.      D  sjLstUser            597    606                                         Last Sbm User Name
  124.      D  sjLstJob#            607    612                                         Last Sbm Job Number
  125.      D  sjLstAtDt            613    622                                         Last Sbm Attemp Date
  126.      D  sjLstAtTm            623    628                                         Last Sbm Attemp Time
  127.      D  sjLstAtSt            629    638                                         Last Sbm Attemp Stat
  128.      D  sjReserv2            639    640                                         Reserved
  129. LTS02D  sjCmdLen             641    644B 0                                      Len of Cmd String
  130. LTS02D  sjCmd                645   1156                                         Command String
  131.  
  132.       ****************************************************************
  133.       * API Header Fields
  134.       * Header data starts at position 65
  135.       ****************************************************************
  136.      DQUSH0100         DS
  137.      D  QUSUA                  1     64                                         User Area
  138.      D  QUSSGH                65     68B 0                                      Generic Header Size
  139.      D  QUSSRL                69     72                                         Structure Rel Level
  140.      D  QUSFN                 73     80                                         Format Name
  141.      D  QUSAU                 81     90                                         API Used
  142.      D  QUSDTC                91    103                                         Date Time Created
  143.      D  QUSSIS               104    104                                         Information Status
  144.      D  QUSSUS               105    108B 0                                      Size User Space
  145.      D  QUSOIP               109    112B 0                                      Offset Input Parm
  146.      D  QUSSI0               113    116B 0                                      Size   Input Parm
  147.      D  QUSOHS               117    120B 0                                      Offset Header Sectn
  148.      D  QUSSHS               121    124B 0                                      Size   Header Sectn
  149.      D  QUSOLD               125    128B 0                                      Offset List Data
  150.      D  QUSSLD               129    132B 0                                      Size   List Data
  151.      D  QUSNBRLE             133    136B 0                                      Number List Entries
  152.      D  QUSSEE               137    140B 0                                      Size   Each Entry
  153.      D  QUSSIDLE             141    144B 0                                      CCSID  List Entry
  154.      D  QUSCID               145    146                                         Country  ID
  155.      D  QUSLID               147    149                                         Language ID
  156.      D  QUSSLID              150    150                                         Subset List Ind
  157.      D  QRESRVD              151    192                                         Reserved
  158.  
  159.       ****************************************************************
  160.       * API Error Structure parms
  161.       ****************************************************************
  162.      D ERRC0100        DS
  163.      D  ErrorBytes                   10I 0 Inz(%Size(ERRC0100))                 Bytes provided
  164.      D  BytesAvail                   10I 0 Inz(0)                               Bytes available
  165.      D  ExceptionID                   7A                                        Exception ID
  166.      D  Reserved1                     1A                                        Reserved
  167.      D  ExceptData                  256A                                        Exception data
  168.  
  169.       ****************************************************************
  170.       * API Variables defined
  171.       ****************************************************************
  172.      D                 DS
  173.      D  Offset                 1      4B 0
  174.      D  ValLen                 5      8B 0
  175.      D  JobEntPos              9     12B 0
  176.  
  177.      D UserSpace       S             20
  178.      D SpaceLib        S             10    INZ('QTEMP')
  179.      D Extatr          S             10
  180.      D Lendata         S             10i 0
  181.      D Public          S             10
  182.      D USText          S             50
  183.      D ReplUS          S             10
  184.      D InzValue        S              1
  185.  
  186.       * Working data structure for QUsChgUsA API
  187.      D USAttr          DS
  188.      D  QUsNumRec                     9B 0 Inz(1)
  189.      D  QUsKey                        9B 0 Inz(3)
  190.      D  QUsRecLen                     9B 0 Inz(1)
  191.      D  QUsRecData                    1A   Inz('1')
  192.  
  193.       ****************************************************************
  194.       * Misc
  195.       ****************************************************************
  196.  
  197.      D Up              C                   'ABCDEFGHIJKLMNOPQRS-
  198.      D                                      TUVWXYZ'
  199.      D Lo              C                   'abcdefghijklmnopqrs-
  200.      D                                      tuvwxyz'
  201.       ****************************************************************
  202.  
  203.      D                SDS
  204.      D  PgmNam                 1     10
  205.      D  JobNam               244    253
  206.      D  JobUsr               254    263
  207.      D  JobNbr               264    269
  208.  
  209.       *****************************************************************
  210.  
  211.      C                   If        CurCmd = HoldCmd
  212.      C                   ExSr      $Hld
  213.      C                   EndIf
  214.  
  215.      C                   If        CurCmd = PurgeCmd
  216.      C                   ExSr      $Prg
  217.      C                   EndIf
  218.  
  219.      C                   If        CurCmd = ReleaseCmd
  220.      C                   ExSr      $Rls
  221.      C                   EndIf
  222.  
  223.      C                   Move      *On           *InLR
  224.      C                   Return
  225.       ***********************************************************
  226.       ** Hold scheduled jobs
  227.       ***********************************************************
  228.      C     $Hld          BegSr
  229.  
  230.      C                   ExSr      $CrtLst
  231.      C                   ExSr      $RtvJob
  232.      C
  233.      C                   DoW       JobRtvCnt < JobCount
  234.  
  235.      C                   If        %Subst(CurJob:1:NameLen)  =
  236.      C                             %Subst(sjJobNam:1:NameLen)  or
  237.      C                             CurJob = All10
  238.  
  239.      C                   If        sjStatus = scheduled
  240.      C                   Eval      CMD = 'HLDJOBSCDE  '
  241.      C                                 + 'JOB('
  242.      C                                 + %Trim(sjJobNam) + ') '
  243.      C                                 + 'ENTRYNBR('
  244.      C                                 + %Trim(sjEntry)  + ')'
  245.      C                   ExSr      $System
  246.  
  247.       * If the job status is Scheduled and it appears in the file,
  248.       * a manual reset must have been done.  But the operator
  249.       * has requested a hold, so the job will be held again.
  250.      C                   Eval      cjSys = SystemName
  251.      C                   Eval      cjJob = sjJobNam
  252.      C                   Eval      cjEnt = sjEntry
  253.      C     LstKey        Chain     CHGSCDJOB
  254.  
  255.      C                   Eval      cjSys = SystemName
  256.      C                   Eval      cjJob = sjJobNam
  257.      C                   Eval      cjEnt = sjEntry
  258.      C                   Eval      cjDate = Today
  259.      C                   Eval      cjUser = JobUsr
  260.      C                   Eval      IBMDate = sjNxtSbm
  261.      C                   Eval      MDYYY   = IBMYY
  262.      C                   Eval      MDYMM   = IBMMM
  263.      C                   Eval      MDYDD   = IBMDD
  264.      C                   Monitor
  265.      C     *MDY          Move      MDYMDY        DateWk
  266.      C     *ISO          Move      DateWk        cjNxDt
  267.      C                   On-Error
  268.      C                   Eval      cjNxDt = Today
  269.      C                   EndMon
  270.  
  271.      C                   Move      sjScdTime     cjNxTm
  272.  
  273.      C                   If        %Found(CHGSCDJOB)
  274.      C                   Update    cjRec
  275.      C                   Else
  276.      C                   Write     cjRec
  277.      C                   EndIf
  278.  
  279.      C                   EndIf
  280.      C                   EndIf
  281.  
  282.      C                   ExSr      $RtvJob
  283.      C                   EndDo
  284.  
  285.      C                   ExSr      $DltUs
  286.  
  287.      C     #Hld          EndSr
  288.       ***********************************************************
  289.       ** Purge jobs from the file
  290.       ***********************************************************
  291.      C     $Prg          BegSr
  292.  
  293.      C                   Eval      cjSys = SystemName
  294.      C                   Eval      cjJob = *Blanks
  295.      C                   Eval      cjEnt = *Blanks
  296.      C     LstKey        SetLL     CHGSCDJOB
  297.      C                   Read      CHGSCDJOB
  298.  
  299.      C                   DoW       Not %EOF(CHGSCDJOB) and
  300.      C                             cjSys = SystemName
  301.      C                   If        cjUser = JobUsr
  302.      C                   If        %Subst(CurJob:1:NameLen)  =
  303.      C                             %Subst(cjJob:1:NameLen)  or
  304.      C                             CurJob = All10
  305.      C                   Delete    cjRec
  306.      C                   EndIf
  307.      C                   EndIf
  308.      C                   Read      CHGSCDJOB
  309.      C                   EndDo
  310.  
  311.      C     #Prg          EndSr
  312.       ***********************************************************
  313.       ** Release scheduled jobs
  314.       ***********************************************************
  315.       ** Previously, the control file was simply read and any
  316.       ** held jobs were ordered released.
  317.       ***********************************************************
  318.       ** The new approach reads a list of held jobs, and each is
  319.       ** compared to the control file to see the job was held by
  320.       ** the specified user, and to see if a submit was missed
  321.       ** during the down time.  If a submit was missed, the
  322.       ** job will be sumitted immeditate as well as being released.
  323.       ** After this loop, the file will be read to remove any
  324.       ** remaining obsolete control records for the specified
  325.       ** user.
  326.       ***********************************************************
  327.      C     $Rls          BegSr
  328.  
  329.      C                   ExSr      $CrtLst
  330.      C                   ExSr      $RtvJob
  331.      C
  332.      C                   DoW       JobRtvCnt < JobCount
  333.  
  334.      C                   If        %Subst(CurJob:1:NameLen)  =
  335.      C                             %Subst(sjJobNam:1:NameLen)  or
  336.      C                             CurJob = All10
  337.  
  338.      C                   If        sjStatus = Held
  339.      C                   Eval      cjSys = SystemName
  340.      C                   Eval      cjJob = sjJobNam
  341.      C                   Eval      cjEnt = sjEntry
  342.      C     LstKey        Chain     CHGSCDJOB
  343.      C                   If        %Found(CHGSCDJOB) and
  344.      C                             cjUser = JobUsr
  345.      C                   Eval      CMD = 'RLSJOBSCDE  '
  346.      C                                 + 'JOB('
  347.      C                                 + %Trim(cjJob) + ') '
  348.      C                                 + 'ENTRYNBR('
  349.      C                                 + %Trim(cjEnt)  + ')'
  350.      C                   ExSr      $System
  351.      C                   Delete    cjRec
  352.  
  353.       * Submit immediate.
  354.       * Last Attempt Status codes are are follows:
  355.       *  0 = Job not previously submitted.
  356.       *  1 = Job successfully submitted.
  357.       *  2 = Last job submission failed.  Check the message queue for details.
  358.       *  3 = Job not submitted due to held status.
  359.       *  4 = Job submitted after scheduled time as specified by recovery action.
  360.       *  5 = Job not submitted as specified by recovery action.
  361.      C*              **  If        sjRecover = SbmRls  and
  362.      C*              **            sjLstAtSt = '3'
  363.      C*              **  ExSr      $Immed
  364.      C*              **  EndIf
  365.  
  366.       * Submit immediate.
  367.       * Questions have been raised about the reliability of last attemp status codes
  368.       * in submitting jobs missed during the hold status.
  369.       * The new approach will submit jobs the had a next submit date and time that
  370.       * fell during the time window of the hold.
  371.      C                   Time                    UTime             6 0
  372.      C                   Time                    Date
  373.      C     *ISO          Move      Date          Today8            8 0
  374.      C                   If        sjRecover = SbmRls  and
  375.      C                             ((cjNxDt < Today8)  or
  376.      C                             (cjNxDt = Today8  and
  377.      C                             cjNxTm < UTime))
  378.      C                   ExSr      $Immed
  379.      C                   EndIf
  380.  
  381.      C                   EndIf
  382.      C                   EndIf
  383.      C                   EndIf
  384.  
  385.      C                   ExSr      $RtvJob
  386.      C                   EndDo
  387.  
  388.  
  389.       * Begin the cleanup loop.
  390.      C                   Eval      cjSys = SystemName
  391.      C                   Eval      cjJob = *Blanks
  392.      C                   Eval      cjEnt = *Blanks
  393.      C     LstKey        SetLL     CHGSCDJOB
  394.      C                   Read      CHGSCDJOB
  395.  
  396.      C                   DoW       Not %EOF(CHGSCDJOB)  and
  397.      C                             cjSys = SystemName
  398.      C                   If        cjUser = JobUsr
  399.      C                   If        %Subst(CurJob:1:NameLen)  =
  400.      C                             %Subst(cjJob:1:NameLen)  or
  401.      C                             CurJob = All10
  402.      C                   Delete    cjRec
  403.      C                   EndIf
  404.      C                   EndIf
  405.      C                   Read      CHGSCDJOB
  406.      C                   EndDo
  407.  
  408.      C     #Rls          EndSr
  409.       ***********************************************************
  410.       *  If a submit was missed during the downtime,
  411.       *  do a submit immediate.
  412.       ***********************************************************
  413.       * Job Schedule entries are usually one of three types:
  414.       * 1. SBMJOB CMD(.....)
  415.       * 2. CALL .....
  416.       * 3. COMMAND
  417.       *
  418.       * In each case a job will be submitted by this subroutine.
  419.       * Submitting all commands as jobs will allow retaining the
  420.       * intended run environment for each entry.
  421.       * Since the scheduler does not populate the *LDA, the current
  422.       * actual contents of the *LDA should not be of significance.
  423.       ***********************************************************
  424.      C     $Immed        BegSr
  425.  
  426. LTS01C                   Eval      Cmd = 'RUNJOBSCDE '
  427. LTS01C                                 + 'JOB('
  428. LTS01C                                 + %Trim(sjJobNam) + ') '
  429. LTS01C                                 + 'ENTRYNBR('
  430. LTS01C                                 + %Trim(sjEntry) + ') '
  431. LTS01C                   ExSr      $System
  432.  
  433.  
  434.  
  435.       * Format the Job Queue specification.
  436.      C*LTS01             If        %Subst(sjJobQNm:1:1)  = Asterisk
  437.      C*LTS01             Eval      JobQue   = sjJobQNm
  438.      C*LTS01             Else
  439.      C*LTS01             Eval      JobQue   = %Trim(sjJobQLb) + '/'
  440.      C*LTS01                                + %Trim(sjJobQNm)
  441.      C*LTS01             EndIf
  442.  
  443.       * Format the Job Description specification.
  444.      C*LTS01             If        %Subst(sjJobDNm:1:1)  = Asterisk
  445.      C*LTS01             Eval      JobDsc   = sjJobDNm
  446.      C*LTS01             Else
  447.      C*LTS01             Eval      JobDsc   = %Trim(sjJobDLb) + '/'
  448.      C*LTS01                                + %Trim(sjJobDNm)
  449.      C*LTS01             EndIf
  450.  
  451.       * Format the Nessage Que Description specification.
  452.      C*LTS01             If        %Subst(sjMsgQNm:1:1)  = Asterisk
  453.      C*LTS01             Eval      MsgQue   = sjMsgQNm
  454.      C*LTS01             Else
  455.      C*LTS01             Eval      MsgQue   = %Trim(sjMsgQLb) + '/'
  456.      C*LTS01                                + %Trim(sjMsgQNm)
  457.      C*LTS01             EndIf
  458.  
  459.      C*LTS01             Eval      Cmd = 'SBMJOB CMD('
  460.      C*LTS01                           + %Trim(sjCmd) + ') '
  461.      C*LTS01                           + 'JOB('
  462.      C*LTS01                           + %Trim(sjJobNam) + ') '
  463.      C*LTS01                           + 'JOBQ('
  464.      C*LTS01                           + %Trim(JobQue) + ') '
  465.      C*LTS01                           + 'JOBD('
  466.      C*LTS01                           + %Trim(JobDsc) + ') '
  467.      C*LTS01                           + 'MSGQ('
  468.      C*LTS01                           + %Trim(MsgQue) + ') '
  469.      C*LTS01                           + 'USER('
  470.      C*LTS01                           + %Trim(sjJobUser) + ') '
  471.      C*LTS01                           + 'SYSLIBL(*SYSVAL) '
  472.      C*LTS01                           + 'CURLIB(*USRPRF) '
  473.      C*LTS01                           + 'INLLIBL(*JOBD) '
  474.      C*LTS01             ExSr      $System
  475.  
  476.      C     #Immed        EndSr
  477.       ***********************************************************
  478.       ** Retrieve Job Entry from the user space                **
  479.       ***********************************************************
  480.      C     $RtvJob       BegSr
  481.  
  482.      C                   CALL      'QUSRTVUS'
  483.      C                   Parm                    UserSpace
  484.      C                   Parm                    JobEntPos
  485.      C                   Parm      JobEntSiz     ValLen
  486.      C                   Parm                    sjRtv
  487.      C                   Parm                    ErrC0100
  488.  
  489.      C     BytesAvail    IfEq      0
  490.      C                   Add       JobEntSiz     JobEntPos
  491.      C                   Add       1             JobRtvCnt
  492.      C                   EndIf
  493.  
  494.      C     #RtvJob       EndSr
  495.       ***********************************************************
  496.       ** Retireve a list of all scheduled jobs                 **
  497.       ***********************************************************
  498.      C     $CrtLst       BegSr
  499.  
  500.      C                   ExSr      $CrtUS
  501.  
  502.      C                   CALL      'QWCLSCDE'
  503.      C                   Parm                    UserSpace
  504.      C                   Parm      'SCDL0200'    JoblFmt           8
  505.      C                   Parm      All10         JobName          10
  506.      C                   Parm      *Blanks       ContHand         16
  507.      C                   Parm                    ErrC0100
  508.  
  509.  
  510.       * Retrieve user space header
  511.  
  512.      C                   CALL      'QUSRTVUS'
  513.      C                   Parm                    UserSpace
  514.      C                   Parm      1             Offset
  515.      C                   Parm      192           ValLen
  516.      C                   Parm                    QUSH0100
  517.      C                   Parm                    ErrC0100
  518.      C*
  519.      C     BytesAvail    IfEq      0
  520.      C     QUSOLD        Add       1             JobOffset         9 0
  521.      C                   Z-Add     QUSSEE        JobEntSiz         9 0
  522.      C                   Z-Add     QUSNBRLE      JobCount          9 0
  523.      C                   Z-ADD     JobOffset     JobEntPos
  524.      C                   Else
  525.      C                   Z-Add     0             JobOffset
  526.      C                   Z-Add     0             JobEntSiz
  527.      C                   Z-Add     0             JobCount
  528.      C                   EndIf
  529.  
  530.      C                   Z-Add     0             JobRtvCnt         9 0
  531.  
  532.      C     #CrtLst       EndSr
  533.       ***********************************************************
  534.       *  Create a user space in QTEMP to hold the job list.
  535.       ***********************************************************
  536.      C     $CrtUs        BegSr
  537.  
  538.      C                   Eval      UserSpace = 'SCDJ' + JobNbr + SpaceLib
  539.  
  540.      C                   Eval      Cmd     = 'DLTUSRSPC USRSPC(QTEMP/' +
  541.      C                                       %Trim(%Subst(UserSpace:1:10)) + ')'
  542.      C                   ExSr      $System
  543.  
  544.      C                   Call      'QUSCRTUS'
  545.      C                   Parm                    UserSpace
  546.      C                   Parm      'ScdJobLst'   Extatr
  547.      C                   Parm      10000         Lendata
  548.      C                   Parm      *Blank        Inzvalue
  549.      C                   Parm      '*ALL'        Public
  550.      C                   Parm                    USText
  551.      C                   Parm      '*NO'         ReplUS
  552.      C                   Parm                    ErrC0100
  553.  
  554.      C     BytesAvail    IfGt      0
  555.      C                   Move      Failed        Result
  556.      C                   Else
  557.  
  558.       * Change the user space size to grow automatically
  559.       * (Parms are defined and initialized above)
  560.      C                   Call      'QUSCUSAT'
  561.      C                   Parm                    SpaceLib
  562.      C                   Parm                    UserSpace
  563.      C                   Parm                    UsAttr
  564.      C                   Parm                    ErrC0100
  565.  
  566.      C     BytesAvail    IfGt      0
  567.      C                   Move      Failed        Result
  568.      C                   Else
  569.      C                   Move      Okay          Result
  570.      C                   EndIf
  571.      C                   EndIf
  572.  
  573.      C     #CrtUs        EndSr
  574.       ***********************************************************
  575.       *  Delete the user space in QTEMP.
  576.       ***********************************************************
  577.      C     $DltUs        BegSr
  578.  
  579.      C                   Eval      Cmd     = 'DLTUSRSPC USRSPC(QTEMP/' +
  580.      C                                       %Trim(%Subst(UserSpace:1:10)) + ')'
  581.      C                   ExSr      $System
  582.  
  583.      C     #DltUs        EndSr
  584.       *****************************************************************
  585.       * Perform system command
  586.       *****************************************************************
  587.      C     $System       BegSr
  588.  
  589.      C                   Eval      ErrorCPF = *Blanks
  590.  
  591.      C                   If        0 <> SystemCmd(Cmd)
  592.      C                   Move      Failed        Result            1
  593.      C                   Else
  594.      C                   Move      Okay          Result
  595.      C                   EndIf
  596.  
  597.      C     #System       EndSr
  598.       ****************************************************************
  599.       *  Initialization subroutine                                   *
  600.       ****************************************************************
  601.      C     *InzSr        BegSr
  602.  
  603.       * The command can be H=Hold, R=Release, or P=Purge from List
  604.       * The job can be a specific job name, or *ALL.
  605.  
  606.      C     *Entry        PList
  607.      C                   Parm                    CmdParm           1
  608.      C                   Parm                    JobParm          10
  609.  
  610.      C     LstKey        KList
  611.      C                   KFld                    cjSys
  612.      C                   KFld                    cjJob
  613.      C                   KFld                    cjEnt
  614.  
  615.      C     Lo:Up         XLATE     CmdParm       CmdParm
  616.      C     Lo:Up         XLATE     JobParm       JobParm
  617.  
  618.  
  619.       *  Get current system name.
  620.      C                   Call      'GETHDGC'
  621.      C                   Parm                    SystemName        8
  622.  
  623.  
  624.      C                   Move      'H'           HoldCmd           1
  625.      C                   Move      'P'           PurgeCmd          1
  626.      C                   Move      'R'           ReleaseCmd        1
  627.      C                   MoveL     '*SBMRLS'     SbmRls           10
  628.      C                   Move      *Blank        CurCmd            1
  629.      C                   If        CmdParm = HoldCmd   or
  630.      C                             CmdParm = PurgeCmd  or
  631.      C                             CmdParm = ReleaseCmd
  632.      C                   Move      CmdParm       CurCmd            1
  633.      C                   Else
  634.      C                   Move      *Blank        CurCmd
  635.      C                   EndIf
  636.  
  637.      C                   Move      JobParm       CurJob           10
  638.  
  639.      C                   Move      '*ALL      '  ALL10            10
  640. LTS01C                   Move      *On           Failed            1
  641. LTS01C                   Move      *Off          Okay              1
  642. LTS01C                   Move      'N'           No                1
  643. LTS01C                   Move      'Y'           Yes               1
  644. LTS01C                   Move      '*'           Asterisk          1
  645. LTS01C                   Z-Add     *Zero         NameLen           3 0
  646. LTS01C                   MoveL     'SCD'         Scheduled        10
  647. LTS01C                   MoveL     'HLD'         Held             10
  648.  
  649.      C                   Eval      NameLen = %Scan(Asterisk:CurJob:2)
  650.      C                   If        NameLen > 1
  651.      C                   Eval      NameLen -= 1
  652.      C                   Else
  653.      C                   Eval      NameLen  = %Len(CurJob)
  654.      C                   EndIf
  655.  
  656.  
  657.       *  Get current date
  658.      C                   Time                    Date
  659.      C     *ISO          Move      Date          Today             8 0
  660.  
  661.      C     #InzSr        EndSr
  662.       *********************************************************** 
© 2004-2019 by midrange.com generated in 0.011s valid xhtml & css