|
jmoreno@militarycars.com wrote: > > Answer to blarkin@wt.net: > If the message gets to QHST the information regarding the > USER sending the reply is available. Good Luck. (By the way have > you received my request for the validation program for the CHGJOB command > ?) Regards...... Jorge Moreno / Military Car Sales / Woodbury / > New York I tried once, here goes again. Attached is files you need. -- Bob Larkin Larkin Computer Consulting blarkin@wt.net
*===============================================================
* To compile:
*
* CRTRPGPGM PGM(XXX/VCP001RG) SRCFILE(XXX/QRPGSRC)
*
*===============================================================
*
* PURPOSE
* Validity check program for the CHGJOB command
* The RUNPTY (run priority parameter) and TIMESLICE
* parameters are checked. If the are changed, it is
* logged to the CHGJOBLG file.
*
* The user profile of the job being changed will also
* be checked if the the LOGLVL or LOGCLPGM parameters
* are changed. They may not be changed for jobs running
* in FIRECALL mode.
*
* IMPLEMENTATION
* If a PARM is not specified on the CHGJOB command
* a null parameter is passed. When the program
* attempts to reference a null pointer, an exception
* is detected which is handled by the program status
* data structure. A flag is then set to prevent checking
* of that parameter again. This is done to prevent
* looping, because the *PSSR routine will return
* control to the top of the Detail Calcs.
*
*===============================================================
FTSCHGJOBO E DISK UC
*. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7
* Error code data structure for API's
IERR IDS
I I 16 B 1 40BIN1
I B 5 80BIN2
I 9 15 MSGID
I 16 16 FILLER
* Call stacker counter
I IDS
I B 1 40STKCTR
I B 5 80DTALEN
* Job Information
I DS
I 1 26 JOBINF
I 1 10 JOBNAM
I 11 20 JOBUSR
I 21 26 JOBNUM
I DS
I B 1 20BINRY2
I 1 2 BIN2A
I DS
I B 1 40BINRY4
I 1 4 BIN4A
* Time/Date Fields
I DS
I 1 140CHAR14
I 1 6 @TIME
I 7 8 @MM
I 9 10 @DD
I 7 10 @MMDD
I 11 14 @YEAR
* Qualified Message
IMSGFLB IDS
I I 'QCPFMSG' 1 10 MSGF
I I '*LIBL' 11 20 MSGFL
*===============================================================
I*Prototype for calling Retrieve Job Information API (QUSRJOBI)
*===============================================================
IQJIFMT DS
I B 1 40LEN
*===============================================================
I*Record structure for QUSRJOBI JOBI0100 format
*===============================================================
IQUSD0 DS
I* Qwc JOBI0100
I B 1 40QUSD0B
I* Bytes Return
I B 5 80QUSD0C
I* Bytes Avail
I 9 18 QUSD0D
I* Job Name
I 19 28 QUSD0F
I* User Name
I 29 34 QUSD0G
I* Job Number
I 35 50 QUSD0H
I* Int Job ID
I 51 60 QUSD0J
I* Job Status
I 61 61 QUSD0K
I* Job Type
I 62 62 QUSD0L
I* Job Subtype
I 63 64 QUSD0M
I* Reserved
I B 65 680QUSD0N
I* Run Priority
I B 69 720QUSD0P
I* Time Slice
I B 73 760QUSD0Q
I* Default Wait
I 77 86 QUSD0R
*===============================================================
*
* FIRECALL - Cannot Change Logging Level Message
I '0000Message Logging -C MSG06
I 'cannot be changed fo-
I 'r a job whose user i-
I 's in FIRECALL Mode. '
*
* FIRECALL - Cannot Change CL Logging Message
I '0000Log CL Program c-C MSG07
I 'annot be changed for-
I ' a job whose user is-
I ' in FIRECALL mode. '
*
* Named Constant
I 'Run Priority' C RUNPTY
I 'Time Slice ' C TIMSLC
*
* BINARY TO DECIMAL CONVERSION
IXDS IDS
I B 1 20X
I 2 2 XX
*
* Log Level Breakout
IX06DS IDS
I 1 6 XX06
I 1 2 X06A
I 3 3 LEVEL
I 4 5 SEV
I 6 6 TXT
* Call Stack Entry Type
* Program status data structure
I SDS
I* Exception number
I 43 46 ENUM
*===============================================================
* This is the list of all possible parms from the CHGJOB
* command. Only the parms we ar testing are passed from the
* CL driver program. These are included for documentation
* and/or future use.
** Documentation ** PARM PARM01 26 JOB/USER/NBR
** Documentation ** PARM PARM02 20 JobQ
** Documentation ** Name/Lib
** Documentation ** *SAME
** Documentation ** PARM PARM03 1 JOBPTY
** Documentation ** number
** Documentation ** *
** Documentation ** PARM PARM04 1 OUTPTY
** Documentation ** number
** Documentation ** *
** Documentation ** PARM PARM05 10 PrtTxt
** Documentation ** char
** Documentation ** *SAME
** Documentation ** PARM PARM06 6 LogLvl
** Documentation ** PARM PARM07 1 LogClPgm
** Documentation ** Y - Yes
** Documentation ** N - No
** Documentation ** * - SaMme
** Documentation ** PARM PARM08 10
** Documentation ** PARM PARM09 7 BrkMsg
** Documentation ** *NOTIFY
** Documentation **
** Documentation **
** Documentation ** PARM PARM10 10 StsMsg
** Documentation ** *USRPRF
** Documentation ** *SYSVAL
** Documentation ** *NONE
** Documentation ** *NORMAL
** Documentation ** *SAME
** Documentation ** PARM PARM11 10
** Documentation ** PARM PARM12 10 PrtDev
** Documentation ** *SAME
** Documentation ** *USRPRF
** Documentation ** *SYSVAL
** Documentation ** *WRKSTN
** Documentation ** name
** Documentation ** PARM PARM13 20 OutQ
** Documentation ** *SAME
** Documentation ** name
** Documentation ** PARM PARM14 10
** Documentation ** PARM PARM15 7 ScdDate
** Documentation ** PARM PARM16 6 ScdTime
** Documentation ** PARM PARM17 7 Date
** Documentation ** 0 -same
** Documentation ** PARM PARM18 10
** Documentation ** PARM PARM19 1 DatSep
** Documentation ** / - /
** Documentation ** - - -
** Documentation ** . - .
** Documentation ** , - ,
** Documentation ** * - *same
** Documentation ** x'00'-Sysval
** Documentation ** x'40'-blank
** Documentation ** PARM PARM20 10 TimSep
** Documentation ** / - /
** Documentation ** - - -
** Documentation ** . - .
** Documentation ** , - ,
** Documentation ** * - *same
** Documentation ** x'00'-Sysval
** Documentation ** x'40'-blank
** Documentation ** PARM PARM21 8 JobSwitches
** Documentation ** PARM PARM22 2 Runpty
** Documentation ** number(1-99)
** Documentation ** X'00'-*same
** Documentation ** PARM PARM23 4 TimeSlice
** Documentation ** PARM PARM24 10
** Documentation ** PARM PARM25 10
** Documentation ** PARM PARM26 10
** Documentation ** PARM PARM27 14 DevRcyAcn
** Documentation ** PARM PARM28 7 TSEPool
** Documentation ** PARM PARM29 7 PrtKeyFmt
** Documentation ** PARM PARM30 10
** Documentation ** PARM PARM31 10
** Documentation ** PARM PARM32 10
** Documentation ** PARM PARM33 10
** Documentation ** PARM PARM34 10 DupJobOpt
** Documentation ** PARM PARM35 10
*===============================================================
C *ENTRY PLIST
C PARM PARM01 26 JOB/USER/NBR
C PARM PARM06 6 LogLvl
C PARM PARM07 1 LogClPgm
* Y - Yes
* N - No
* * - SaMme
C PARM PARM22 2 Runpty
* number(1-99)
* X'00'-*same
C PARM PARM23 4 TimeSlice
C PARM MSGDTA
*
* Determine the Job being changed
C @PRM01 IFNE *ON
C EXSR #PRM01
C ENDIF
*
* Test for change in logging level (LOGLVL)
C @PRM06 IFNE *ON
C EXSR #PRM06
C ENDIF
*
* Test for change in log CL Program Command (LOGCLPGM)
C @PRM07 IFNE *ON
C EXSR #PRM07
C ENDIF
*
* Test for change in Run Priority (RUNPTY)
C @PRM22 IFNE *ON
C EXSR #PRM22
C ENDIF
*
* Test for change in Timeslice (TIMESLICE)
C @PRM23 IFNE *ON
C EXSR #PRM23
C ENDIF
*
C MOVE *ON *INLR
C RETRN
/EJECT
*===============================================================
C #PRM01 BEGSR
C MOVE *ON @PRM01 1
*
* Retrieve information about the Job
C CLEARJOBINF
C MOVELPARM01 JOBINF
C ENDSR
*===============================================================
C #PRM06 BEGSR
C MOVE *ON @PRM06 1
*
* Break out the characters in the LogLvl parm
C CLEARXX06
C MOVE PARM06 XX06
C MOVE *BLANKS MSGDTA 80
*
C EXSR RTVJI
C MOVE 'N' #FIREC 1 FIRECALL FLAG
C CALL 'TSCHKPRF'
C PARM CJUSR
C PARM #FIREC
*
* In Firecall Mode, changes to Logging Level are not allowed.
C #FIREC IFEQ 'Y'
*
* The Following line will test to see if Log Level has been
* changed.
C LEVEL IFNE '*'
C LEVEL ANDNE'4'
C MOVELMSG06 MSGDTA P
C ELSE
*
* The Following line will test to see if Severity filter value
* has been changed. X'FFFE' and X'0000' indicate no change or
* *SAME used for this parameter.
C SEV IFNE X'FFFE'
C SEV ANDNEX'0000'
C MOVELMSG06 MSGDTA P
C ELSE
*
* The Following line will test to see if Message Text Level
* value has been changed. '*' indicates no change and 'S' i
* Indicates that *SAME was used for this parameter.
C TXT IFNE 'S'
C TXT ANDNE'*'
C MOVELMSG06 MSGDTA P
C ENDIF
C ENDIF
C ENDIF
*
C ENDIF
*
C ENDSR
/EJECT
*===============================================================
C #PRM07 BEGSR
C MOVE *ON @PRM07 1
*
* The Following line will test to see if RUNPTY was passed
* was passed.
C PARM07 IFNE 'Y'
C PARM07 ANDNE'*'
*
* Check to see if profile in FireCall mode
C EXSR RTVJI
C MOVE 'N' #FIREC 1 FIRECALL FLAG
C CALL 'TSCHKPRF'
C PARM CJUSR
C PARM #FIREC
*
* In Firecall Mode, changes to Logging Level are not allowed.
C #FIREC IFEQ 'Y'
*
* Set return message data for calling program
C MOVELMSG07 MSGDTA P
C ENDIF
*
C ENDIF
*
C ENDSR
/EJECT
*===============================================================
C #PRM22 BEGSR
C MOVE *ON @PRM22 1
*
* Convert character to binary thru data structure
C MOVE PARM22 BIN2A
*
* If program gets here then the program status subroutine was
* not evoked, because a RUNPTY was passed to the validity
* checking program
*
* Log the change in Run Priority
*
C BINRY2 IFNE *ZERO
C MOVELRUNPTY ACTION 20
C Z-ADDBINRY2 DEC2 20
C MOVE DEC2 ACTION
C EXSR RTVJI
C MOVELACTION CJACT
C EXSR WRTLOG
C ENDIF
C ENDSR
/EJECT
*===============================================================
C #PRM23 BEGSR
C MOVE *ON @PRM23 1
*
* Convert character to binary thru data structure
C MOVE PARM23 BIN4A
*
* If program gets here then the program status subroutine was
* not evoked, because a TIMESLICE was passed to the validity
* checking program
*
* Log the change in Timeslice if job's current timeslice (QUSD0P)
* is not equal to the requested Timeslice (BINRY4). Command
* processor appears to be inconsistent, because sometimes a
* zero is passed if the Timeslice parm is not filled in. Other
* times the jobs current Timeslice is passed. That is why the
* parameter passed also must by greater than zero.
*
C BINRY4 IFNE QUSD0P
C BINRY4 ANDNE*ZERO
C MOVELTIMSLC ACTION 20
C Z-ADDBINRY4 DEC7 70
C MOVE DEC7 ACTION
C EXSR RTVJI
C MOVELACTION CJACT
C EXSR WRTLOG
C ENDIF
C ENDSR
/EJECT
*===============================================================
C RTVJI BEGSR
C #RTVJI IFNE *ON
*
*Retrieve current job info
C Z-ADD86 LEN
C MOVEL'*' QUALJB 26
C MOVE *BLANKS INTJBI 16
C MOVEL'JOBI0100'APIFMT 8
C CALL 'QUSRJOBI'
C PARM QUSD0
C PARM LEN
C PARM APIFMT Job name
C PARM QUALJB
C PARM INTJBI
*
C MOVELQUSD0D CJBJOB
C MOVELQUSD0F CJBUSR
C MOVELQUSD0G CJBNBR
*
* If the JOBNAM is not *, the job being changed is contained in
* the JOBINF Data Structure, otherwise, load the current job
* information we just retrieved.
C JOBNAM IFNE '*'
C MOVELJOBNAM CJJOB
C MOVELJOBUSR CJUSR
C MOVELJOBNUM CJNBR
*
* Retrieve target job's info. We may need Timeslice value.
C MOVELJOBINF QUALJB 26
C CALL 'QUSRJOBI'
C PARM QUSD0
C PARM LEN
C PARM APIFMT Job name
C PARM QUALJB
C PARM INTJBI
*
C ELSE
C MOVELQUSD0D CJJOB
C MOVELQUSD0F CJUSR
C MOVELQUSD0G CJNBR
C ENDIF
*
C MOVE *ON #RTVJI 1 SR Already Run
C ENDIF
C ENDSR
/EJECT
*===============================================================
C WRTLOG BEGSR
C TIME CHAR14 140 Work Field
C MOVELCHAR14 CJCTIM
C MOVEL@YEAR CJCDAT
C MOVE @MMDD CJCDAT
C OPEN TSCHGJOB
C WRITECHGJOBR
C CLOSETSCHGJOB
C ENDSR
/EJECT
*===============================================================
C *PSSR BEGSR
*
C PSRFLG IFEQ '1'
* If *PSSR is already handling error and then receives another
* set on H1 and return.
C MOVE *ON *INH1
C RETRN
C ELSE
C MOVE '1' PSRFLG 1
C ENUM IFEQ '3601'
C MOVE *ON ER3601 1
*
C ENDIF
C ENDIF
* Reset *PSSR error flag at exit of routine
C MOVE '0' PSRFLG
*
C ENDSR'*DETC'
*
*===============================================================
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.