Figure 1 is an example program
written in REXX that performs simple Promote Copy user exit activity.
This routine reads the promote exit file, and based on the types of
the members being promoted, copies the member to a library outside
of SCLM's control. The exit then passes a return code of zero (0)
to SCLM.
Figure 1. Promote User Exit (Part 1
of 3)/* REXX */
/* PROMCPY1 - PROMOTE COPY USER EXIT */
/**********************************************************************/
/* INPUTS: */
/* PARMS - */
/* EXTYP - An 8-character literal value indicating the exit type */
/* Valid types are: */
/* BINITIAL Build Initial (BLDINIT) */
/* BUILD Build Notify (BLDNTF) */
/* PINITIAL Promote Initial (PRMINIT) */
/* PVERIFY Promote Verify (PRMVFY) */
/* PCOPY Promote Copy (PRMCOPY) */
/* PPURGE Promote Purge (PRMPURGE). */
/* PROJ - The 8-character name of the project */
/* PRJDF - The 8-character name of the project definition */
/* TSOUID - The 8-character value of the user's logon ID */
/* FROMGRP - From Group or Build Group */
/* TYPE - Type containing the member being promoted. */
/* MEMBER - Member being promoted. */
/* SCOPE - The 8-character name of the scope */
/* Valid scopes are as follows: */
/* Build scope Limited, normal, subunit, extended. */
/* Promote scope Normal, subunit, extended. */
/* MODE - The 13-character name of the mode */
/* Valid modes are as follows: */
/* Build mode Forced, conditional, unconditional, */
/* and report only. */
/* Promote mode Conditional, unconditional, and report. */
/* TOGRP - The 8-character name of the group; */
/* blank for build exit */
/* */
/**********************************************************************/
/* OUTPUTS: */
/* RETURN_CODE - RETURN CODE */
/* 0 - All copies performed successfully. */
/* 16 - All or some copies not performed successfully */
/* 32 - Input or Output files can not be initialized */
/**********************************************************************/
/* PROCESS: */
/* THIS PROGRAM COPIES LOAD MODULES TO THEIR EXECUTION DATASET */
/* */
/**********************************************************************/
ARG PARM
/* Initialize passed parameters */
Call INIT
/* Only process when to group is production */
If togrp <> 'PROD' then exit 0
Figure 2. Promote User Exit (Part
2 of 3)/* read exit file */
"execio * diskr PROMEXIT (stem extline. finis)"
/* Process each line of the exit file */
Do i = 1 to extline.0 /* For all lines in stem variable */
/* Extract variables from a line out of the exit file */
parse upper var extline.i eogroup 10 eotype 19 eomember 28 eostatus
eogroup = STRIP(eogroup)
eotype = STRIP(eotype)
eomember= STRIP(eomember)
eostatus= STRIP(eostatus)
/* If member ok continue */
If eostatus = 'COPY SUCCESSFUL' then
Call Process_Member
End
EXIT max_rc
INIT:
/* Parse out variables passed to the exit routine and strip blanks */
PARSE UPPER VAR parm extyp ',' proj ',' prjdf ',' tsouid ',',
fromgrp ',' type ',' member ',' scope ',' mode ',' togrp
extyp = strip(extyp)
proj = strip(proj)
prjdf = strip(prjdf)
tsouid = strip(tsouid)
fromgrp = strip(fromgrp)
type = strip(type)
member = strip(member)
scope = strip(scope)
mode = strip(mode)
togrp = strip(togrp)
max_rc = 0
return
Process_Member:
/* Process each member in the exit file */
/* If the member type is to be processed setup 'TO' dataset */
/* 'TO' dataset for the copy is a preallocated library */
Select
When eotype = "LOADLIB" then Do
outdsn = "'SYS2.LOADLIB'"
Call Perform_Copy
End
When eotype = "LOADCICS" then Do
outdsn = "'SYS2.CICSLOAD'"
Call Perform_Copy
End
Otherwise
nop
End
Return
Figure 3. Promote User Exit (Part
3 of 3)Perform_copy:
/* Initialize the FROM and TO datasets and perform copy */
indsn = "'"proj"."togrp"."eotype"'"
Address ISPEXEC "LMINIT DATAID(FROMDSN) DATASET("indsn")"
If rc <> 0 then do
Say "Error on LMINIT for FROM dataset indsn return code" rc
exit 32
End
Address ISPEXEC "LMINIT DATAID(TODSN) DATASET("outdsn")"
If rc <> 0 then do
Say "Error on LMINIT for TO dataset indsn return code" rc
exit 32
End
/* Copy member from SCLM prod into live dataset */
Address ISPEXEC "LMCOPY FROMID("fromdsn") FROMMEM("eomember")
TODATAID("todsn") TOMEM("eomember") REPLACE"
If rc <> 0 then do /* If error on the Copy */
Say "Member" eomember "can not be copied to" outdsn
max_rc = 16
End
Else /* Member was copied successfully */
Say eomember "has been copied to" outdsn
Return
The program uses the ISPF library management services to perform
the copy and as such must be invoked in SCLM in one of two ways:
- Using the ISPLNK call method as shown below:
PRMCOPY=SELECT, C
PRMCPYCM=ISPLNK, C
PRMCPYOP='CMD(PROMCPY1,', C
- From a driver exit that uses a call method of TSOLNK as follows:
Address ISPEXEC 'SELECT CMD(PROMCPY1' parm ')'