Skip to content

Automated test facility for batch applications update - README update and included items #130

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions endevor/Automated-Test-Facility-Using-Test4Z/BUMPJOB.rex
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/* REXX */
/* Bump the last character on a Jobname to next value */
Trace O
Arg jobname;
Rotation = '12345678901',
'ABCDEFGHIJKLMNOPQRSTUVWXYZA',
'@#$@'
jobname = word(jobname,1)
lastchar = Substr(jobname,Length(jobname))
wherenext = Pos(lastchar,Rotation) + 1
overlaychar = Substr(Rotation,wherenext,1)
nextJobname = overlay(jobname,overlaychar,Length(jobname))
nextJobname = overlay(overlaychar,jobname,Length(jobname))
Return nextJobname
18 changes: 18 additions & 0 deletions endevor/Automated-Test-Facility-Using-Test4Z/GETACCTC.rex
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* REXX */
Arg whatuser
JobAccountingCode. = '12340'
JobAccountingCode.user#01 = '127398730'
JobAccountingCode.user#02 = '127398730'
JobAccountingCode.user#03 = '106321234'
JobAccountingCode.user#04 = '106321234'
JobAccountingCode.user#05 = '111212340'
JobAccountingCode.user#06 = '124312340'
JobAccountingCode.user#07 = '121412340'
JobAccountingCode.user#08 = '118412340'
JobAccountingCode.user#09 = '124312340'
JobAccountingCode.user#10 = '114412340'
JobAccountingCode.user#11 = '123212340'
JobAccountingCode.user#12 = '111412340'
JobAccountingCode.user#13 = '106341234'
JobAccountingCode.user#14 = '301123400'
Return JobAccountingCode.whatuser
155 changes: 155 additions & 0 deletions endevor/Automated-Test-Facility-Using-Test4Z/SUBMITST.rex
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
/* REXX */
/*----------------------------------------------------------*/
/* This Rexx is given a JCL dataset and member name in its */
/* parameter. */
/* The REXX: */
/* o submits the JCL */
/* o watches and waits for it to complete its execution*/
/* o returns to caller */
/* */
/*----------------------------------------------------------*/
CALL BPXWDYN 'INFO DD(SUBMITST)'
If RESULT = 0 Then Trace ?R
Arg SubmitJCL WaitLoops LoopSeconds;

/* Set the value for Phase that indicates job is done */
FinalExpectedPhase = "AWAITING OUTPUT"

/*----------------------------------------------------------*/
/* Get my jobname.... Cannot wait for myself */
/* Ensure the job we submit does not have the same jobname */
/* as my own. */
/*----------------------------------------------------------*/
myJobName = MVSVAR('SYMDEF',JOBNAME ) /*Returns JOBNAME */

/* Submit the JCL named in the parameter */
Call Submit_n_save_jobInfo;
If SelectJobName = myJobName then,
Do
Say 'The job to be monitored is mine. Invalid request'
Exit(8)
End;

/* Wait for the submitted job to finish */
jobnum = SelectJobNumber
jobid = SelectJobName
ownerid = USERID()
retcode. = ' '
daten. = ' '
Timen.= ' '
PhaseName. = ' '
Call Monitor_Job_Status;

exit

Submit_n_save_jobInfo: /* submit SubmitJCL job and save job info */

Address TSO "PROFILE NOINTERCOM" /* turn off msg notific */
CALL MSG "ON"
CALL OUTTRAP "out."
ADDRESS TSO "SUBMIT '"SubmitJCL"'" ;
CALL OUTTRAP "OFF"
JobData = Strip(out.1);
jobinfo = Word(JobData,2) ;
If jobinfo = 'JOB' then,
jobinfo = Word(JobData,3) ;
SelectJobName = Word(Translate(jobinfo,' ',')('),1) ;
SelectJobNumber = Word(Translate(jobinfo,' ',')('),2) ;

Return;

Monitor_Job_Status:

IsfRC = isfcalls( "ON" )
if IsfRC <> 0 then Exit(8)

myMessage = ' ';
isfprefix = SelectJobname
isfowner = USERID()
isfcols = "jname jobid ownerid queue jclass prtdest retcode",
" daten TIMEN PHASENAME "

seconds = LoopSeconds /* Number of Seconds to wait if needed */

/*********************************************/
/* Wait until the submitted job is completed */
/*********************************************/
Do loop# = 1 to WaitLoops
/* call exec_sdsf "0 ISFEXEC ST" opts_sdsf */
Address SDSF "isfexec ST (VERBOSE ALTERNATE DELAYED)"

if RC <> 0 then,
Do
say "RC" RC "returned from ISFEXEC ST" ;
Exit(12);
end;

Sa= 'isfcols=' isfcols
StRows = isfrows
If StRows = 0 then,
Do
say "No rows returned from ISFEXEC"
Call WaitAwhile
Iterate ;
end;

SubmittedJobPhase = 'Submitted'
Call EvaluateSubmittedJob
If SubmittedJobPhase = FinalExpectedPhase then Leave;

Call WaitAwhile

End; /* Do loop# = 1 to WaitLoops */

If SubmittedJobPhase /= FinalExpectedPhase then,
Do
Say 'Job' SelectJobname SelectJobNumber,
' not completed within Wait arguments',
WaitLoops LoopSeconds
exit(8)
End

Say 'Job' SelectJobname SelectJobNumber 'is completed',
' at ' DATE(S) TIME()

Return;

EvaluateSubmittedJob:

Do row# = 1 to StRows
Sa= 'Finding' jname.row# jobid.row# ownerid.row#,
jclass.row# PhaseName.row# Timen.row#
if jobid.row# /= SelectJobNumber then iterate;

SubmittedJobPhase = PhaseName.row#
Sa= 'Status:' SelectJobname SelectJobNumber ,
'retcode.row#=' retcode.row# SubmittedJobPhase ,
' on ' row# 'wait loop'
Leave;
End; /*Do row# = 1 to StRows */

Return;

WaitAwhile:
/* */
/* A resource is unavailable. Wait awhile and try */
/* accessing the resource again. */
/* */
/* The length of the wait is designated in the parameter */
/* value which specifies a number of seconds. */
/* A parameter value of '000003' causes a wait for 3 seconds. */
/* */
/*seconds = Abs(seconds) */
/*seconds = Trunc(seconds,0) */
Say "Waiting for" seconds "seconds at " DATE(S) TIME()
/* AOPBATCH and BPXWDYN are IBM programs */
CALL BPXWDYN "ALLOC DD(STDOUT) DUMMY SHR REUSE"
CALL BPXWDYN "ALLOC DD(STDERR) DUMMY SHR REUSE"
CALL BPXWDYN "ALLOC DD(STDIN) DUMMY SHR REUSE"

/* AOPBATCH and BPXWDYN are IBM programs */
parm = "sleep "seconds
Address LINKMVS "AOPBATCH parm"

Return

33 changes: 32 additions & 1 deletion endevor/Automated-Test-Facility-for-Batch-Applications/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,37 @@ These samples are provided as is and are not officially supported (see [license]

This procedure allows Endevor processors to automate the tailoring, submission and evaluation of Batch application tests. Tests are triggered automatically by the Move or Generate actions of elements of any element type. For example, you may initiate automated tests when a COBOL program is Moved or Generated at a certain stage of Endevor. The test will locate, tailor, submit and evaluate results for one or more JCL elements whose names appear in the "OPTIONS" content of the COBOL program.

## Features and Choices
The collection of items in this folder provides for automating Tests of your Endevor inventory.

- **Generate and/or Move actions** on an element of any type can be accompanied by the automated submission of a batch test of that element. You can choose to test programs, JCL, PROCS, PARMS or other elements that you want to be tested.

- **Simple instructions** you give to your Endevor processors can be written in either of two simple formats:
1) OPTIONS format - like the syntax given to CONPARMX steps
2) YAML - a popular, modern data serialization language that is widely used for writing configuration files. It is designed to be human-readable.

You can establish unique tests on an element for selected Stages in Endevor, and have the submitted test automatically adjust lines of JCL for the Stage name where the element is found. STEPLIB concatenations, for example, can be automatically adjusted in a TEST stage, and different than the adjustment in the QA stage.

You can use broad statements to tailor the JCL or use Step and DDName references to pinpoint where changes are to be made.

- **Test evaluations** may be bypassed entirely, or masked and compared to a test baseline. A failed comparison can then reflect onto the element as a failed Generate or Move action.

## OPTIONS

The use of "OPTIONS" is not a new concept to Endevor. Typically, they are objects that provide detailed instructions to the CONPARMX steps of an Endevor processor. To implement this procedure, it is not necessary that you be familiar with the use of OPTIONS or with the CONPARMX utility. Example OPTIONS and processors are provided with this procedure. However, if you would like to know more about the use of OPTIONS in an Endevor processor, see [this doc](https://techdocs.broadcom.com/us/en/ca-mainframe-software/devops/ca-endevor-software-change-manager/18-1/administrating/processors/processor-utilities.html#concept.dita_f657792fe5b63ba8cd9304095175664793517854_CONPARMXUtility).

## YAML

Data can be constructed into a YAML format, and is easily readable by humans. YAML is a valid choice on the mainframe too - being known mostly to be used in distributed processes.

If you are new to YAML, you can find some introductions here:

- [YAML Site](https://yaml.org/spec/1.2.2/)
- [YAML (YAML Ain't Markup Language)](https://www.techtarget.com/searchitoperations/definition/YAML-YAML-Aint-Markup-Language)
- [What is YAML?](https://www.freecodecamp.org/news/what-is-yaml-the-yml-file-format/)

## Items in this collection

With this procedure, sample processor code is provided in the form of "Includes". Endevor optionally supports either a Panvalet include ("++INCLUDE"), or a Librarian include ("-INC"). If you are not using either, then just copy the sample "Include" code into the processors where you need them. If you are using the Panvalet include, then change the "-INC" references to "++INCLUDE" references (starting in column 8).

Options provide the details for the Automated Test Facility for Batch Applications. Two categories of OPTIONS are a part of this procedure.
Expand Down Expand Up @@ -43,4 +72,6 @@ Setup steps for the Automated Test Facility for Batch Applications:
The provided OPTIONS specify the Endevor C1STAGE, where Automated Testing is to occur. You can modify it to meet your needs, including using C1ENVMNT or C1SUBSYS to provide Automated Testing for Deploy to Test actions.


Note: Members **OPTVALDT**, **TXTRPLCE**, **JCLRPLCE** and **YAML2REX** are REXX subroutines required for the **Automated Test Facility for Batch Applications**. They are used by more than one solution on this GitHub, but can be found under the **Field-Developed-Programs** folder in the **Processor-Tools-and-Processor-Snippets** subfolder.
Note: Members **[OPTVALDT](https://github.com/BroadcomMFD/broadcom-product-scripts/blob/main/endevor/Field-Developed-Programs/Processor-Tools-and-Processor-Snippets/OPTVALDT.rex)**, **[TXTRPLCE](https://github.com/BroadcomMFD/broadcom-product-scripts/blob/main/endevor/Field-Developed-Programs/Processor-Tools-and-Processor-Snippets/TXTRPLCE.rex)**, **[JCLRPLCE](https://github.com/BroadcomMFD/broadcom-product-scripts/blob/main/endevor/Field-Developed-Programs/Processor-Tools-and-Processor-Snippets/JCLRPLCE.rex)** and **[YAML2REX](https://github.com/BroadcomMFD/broadcom-product-scripts/blob/main/endevor/Field-Developed-Programs/Processor-Tools-and-Processor-Snippets/YAML2REX.rex)** are REXX subroutines required for the **Automated Test Facility for Batch Applications**. They are used by more than one solution on this GitHub, but can be found by clicking their names, as shown above, or by navigating to the **Field-Developed-Programs** folder and the **Processor-Tools-and-Processor-Snippets** subfolder.

You may use a moveout file to collect all members related to the **Automated Test Facility for Batch Applications**.