From 9f4a34b28f8ad68ecda62818b249ea3c2eec1356 Mon Sep 17 00:00:00 2001 From: Joseph Walther Date: Sat, 29 Mar 2025 19:06:40 -0500 Subject: [PATCH 1/4] Additional variable handling by C1BMXIN --- .../C1BMXIN.skl | 92 +++++++++++++++---- .../README.md | 13 ++- 2 files changed, 85 insertions(+), 20 deletions(-) diff --git a/endevor/Package-Shipping-Model-and-Script-Examples/C1BMXIN.skl b/endevor/Package-Shipping-Model-and-Script-Examples/C1BMXIN.skl index c643e34..4a4d774 100644 --- a/endevor/Package-Shipping-Model-and-Script-Examples/C1BMXIN.skl +++ b/endevor/Package-Shipping-Model-and-Script-Examples/C1BMXIN.skl @@ -3,12 +3,15 @@ TRACE Off WHEREAMI = 'C1BMXIN' HOSTHLQ = Strip(VDDHSPFX) + If HOSTHLQ = '' then HOSTHLQ = USERID() RMOTHLQ = Strip(VDDRSPFX) + If RMOTHLQ = '' then RMOTHLQ = USERID() SHIPPER = USERID() SYSUID = USERID() SENDNODE = SYSVAR(SYSNODE) )ENDREXX )CM ---------- +)CM ---------- Get Package, Destination and pkg/Bko values )REXX VNBSQDSP PKGID DESTIN TYPRUN OUTRBAK VDDXNODE NODENAME TRACE Off WHEREAMI = 'C1BMXIN' @@ -18,8 +21,47 @@ IF TYPERUN = 'TYPRUN' THEN TYPRUN = '' OUTRBAK = STRIP(STRIP(TAIL,'T','.')) NODENAME = Strip(VDDXNODE) + NODENAME = REXALDST(DESTIN) )ENDREXX )CM ---------- +)CM ---------- Get Transmission method, Host and Remote HLQ values +)REXX DESTIN HOSTHLQ RMOTHLQ XMITMETH + Trace Off + WHEREAMI = 'C1BMXIN' + + CALL BPXWDYN "ALLOC DD(BSTIPT01) ", + "LRECL(0080) BLKSIZE(0800) SPACE(5,5) ", + "RECFM(F,B) TRACKS NEW UNCATALOG REUSE "; + Queue "LIST DESTINATION" DESTIN "TO FILE CSVALDST ", + "OPTIONS NOCSV ." + "EXECIO 1 DISKW BSTIPT01 (Finis" + + CALL BPXWDYN "ALLOC DD(CSVALDST) ", + " LRECL(1800) BLKSIZE(3600) SPACE(5,5) DSORG(PS) ", + " RECFM(F,B) TRACKS NEW UNCATALOG REUSE "; + CALL BPXWDYN "ALLOC DD(BSTERR) LRECL(133) BLKSIZE(13300) ", + " DSORG(PS) SPACE(1,1) RECFM(F,B) TRACKS ", + " NEW UNCATALOG REUSE "; + CALL BPXWDYN "ALLOC DD(C1MSGS1) LRECL(133) BLKSIZE(13300) ", + " DSORG(PS) SPACE(1,1) RECFM(F,B) TRACKS ", + " NEW UNCATALOG REUSE "; + + ADDRESS LINK 'BC1PCSV0' ; /* Call CSV utility */ + + "EXECIO * DISKR CSVALDST ( Stem apiDestinations. FINIS" + + CALL BPXWDYN "FREE DD(BSTIPT01) " + CALL BPXWDYN "FREE DD(CSVALDST) " + CALL BPXWDYN "FREE DD(BSTERR) " + CALL BPXWDYN "FREE DD(C1MSGS1)" + If apiDestinations.0 = 0 then EXIT(12) + Destination= Strip(Substr(apiDestinations.1,013,07)) + HOSTHLQ = Strip(Substr(apiDestinations.1,079,14)) + RMOTHLQ = Strip(Substr(apiDestinations.1,113,14)) + XMITMETH = Strip(Substr(apiDestinations.1,051,11)) +)ENDREXX +)CM ---------- +)CM ---------- Get Date and Time variables from VNBCPARM )REXX VNBCPARM DATE6 TIME6 DATE8 TIME8 NEXTJOB TRACE Off WHEREAMI = 'C1BMXIN' @@ -32,26 +74,27 @@ )CM ---------- This section shows accessing Site-Specific variables )CM ---------- Longer variable names must be assigned to )CM ---------- valid 8-byte ISPF variable names -)REXX CSIQCLS0 ORDERDSN - TRACE ?R - WHERE = 'C1BMXIN Get local variables ' - WhereIam = Strip(Left("@"MVSVAR(SYSNAME),8)) ; - - interpret 'Call' WhereIam "'MyCLS0Library'" - CSIQCLS0 = Result - interpret 'Call' WhereIam "'AltIDOrderfile'" - ORDERDSN = Result -)ENDREXX -)CM ---------- This section only applies to DE32 -)REXX PKGID C1SUBSYS - /* code for DE32 shipping only */ +)REXX CSIQCLS0 ORDERDSN + TRACE OFF + WHERE = 'C1BMXIN Get local variables ' + WhereIam = Strip(Left("@"MVSVAR(SYSNAME),8)) ; + + interpret 'Call' WhereIam "'MyCLS0Library'" + CSIQCLS0 = Result + interpret 'Call' WhereIam "'AltIDOrderfile'" + ORDERDSN = Result + +)ENDREXX +)CM ---------- This section only applies to a Broadcom demo system +)REXX PKGID MYSUBSYS + /* code for Broadcom demo system shipping only */ TRACE Off - WHERE = 'C1BMXIN DE32 only code ' + WHERE = 'C1BMXIN DEV2 only code ' PkgInfo = GETSYRSB(PKGID) ; /* get sys/sub from pkg name*/ If Words(PkgInfo) = 2 then, - C1SUBSYS = Word(PkgInfo,1); /* get sys/sub from pkg name*/ + MYSUBSYS = Word(PkgInfo,1); /* get sys/sub from pkg name*/ Else, - C1SUBSYS = 'NA' + MYSUBSYS = 'NA' )ENDREXX )CM PKGID SHIPMENT BATCH JCL - SYSIN CARD IMAGES - ISPSLIB(C1BMXIN) )CM @@ -66,17 +109,20 @@ )CM &VNBSQDSP //* *==============================================================* * +//* *==============================================================* * //* *= Substitute variables in the Remote JCL ===============* * //* *==============================================================* * //TAILOR EXEC PGM=IRXJCL,PARM='ENBPIU00 A', C1BMXIN // COND=(4,LT) -//TABLE DD * Replaces variable values in listed MODEL DDName +//TABLE DD * If necessary replace these for your xmit method * MODEL TBLOUT AHJOB AHJOB C1BMXFTC C1BMXFTC //C1BMXFTC DD DSN=&&XFTC,DISP=(OLD,PASS) //AHJOB DD DSN=&HOSTHLQ..D&DATE6..T&TIME6..&DESTIN..AHJOB, -// DISP=SHR +// DISP=(MOD,CATLG,KEEP), +// SPACE=(CYL,(5,5)),UNIT=3390, +// DCB=(RECFM=FB,LRECL=80,BLKSIZE=3120,DSORG=PO) //OPTIONS DD *,SYMBOLS=JCLONLY **These variables are substituted** Destin = '&DESTIN' Package = '&PKGID' @@ -86,11 +132,19 @@ TIME6 = '&TIME6' SHIPPER = '&SHIPPER' NODENAME = '&NODENAME' - HOSTLIBS = '&HOSTHLQ..D&DATE6..T&TIME6..&DESTIN' + HOSTHLQ = '&HOSTHLQ' RMOTHLQ = '&RMOTHLQ' + XMITMETH = '&XMITMETH' + Say 'XMITMETH=' XMITMETH + HOSTLIBS = '&HOSTHLQ..D&DATE6..T&TIME6..&DESTIN' RMOTLIBS = '&RMOTHLQ..D&DATE6..T&TIME6..&DESTIN' Say 'HOSTLIBS='HOSTLIBS ; Say 'RMOTLIBS='RMOTLIBS +* DEV2 only + C1SUBSYS = '&MYSUBSYS' //SYSEXEC DD DISP=SHR,DSN=&CSIQCLS0 +//APIMSG DD SYSOUT=* +//BSTAPI DD SYSOUT=* +//BSTERR DD SYSOUT=* //SHOWME DD SYSOUT=* //SYSTSPRT DD SYSOUT=* //* *===================================================== C1BMXIN / * diff --git a/endevor/Package-Shipping-Model-and-Script-Examples/README.md b/endevor/Package-Shipping-Model-and-Script-Examples/README.md index 4ff4da9..bdfc20c 100644 --- a/endevor/Package-Shipping-Model-and-Script-Examples/README.md +++ b/endevor/Package-Shipping-Model-and-Script-Examples/README.md @@ -81,7 +81,18 @@ The combination of the **@DBOX** and **C1BMXIN** members gives you the ability t Members in this folder show how you can capture values for shipping variables and re-use them. -__C1BMXIN.skl__ is a version of the C1BMXIN skeleton found in your CSIQSENU library. This version captures values for some of the package shipping variables, and makes it possible for them to be available in your shipping JCL. Shipments for all transmission methods use the **C1BMXIN** member. The example uses Table Tool in a step named TAILOR to capture and expand variables for subsequent shipping jobs. +__C1BMXIN.skl__ is a version of the C1BMXIN skeleton found in your CSIQSENU library. When C1BMXIN is referenced during the initiation of a package shipment, many of the variables related to the shipment are briefly available. Within the C1BMXIN member you will find a reference to the VNBSQDSP variable - SHIP statement itself whcih names the package, the destinaion the PKG/BACKOUT value. Other package shipping varibles are also briefly available, whcih you can use in the shipment skeleton and CSIQOPTN members to improve the commenting and to increase functionality. + +This version captures values for some of the package shipping variables, and makes it possible for them to be available in your shipping JCL. Shipments for all transmission methods use the **C1BMXIN** member. The example uses Table Tool in a step named TAILOR to capture and expand variables for subsequent shipping jobs. + +Within the C1BMXIN example, you will find **)REXX** and **)ENDREXX** pairs that capture values for variables included on the **)REXX** statement. You can delete sections you do not need. For example, if do not need to capture the Transmission Method, then you can delete lines, starting with this line, + + )REXX DESTIN HOSTHLQ RMOTHLQ XMITMETH +to the line that contains this text + + )ENDREXX + +For variables captured, the example C1BMXIN uses Table Tool to replace values for those variables that you may have placed in your CSIQSENU and CSIQOPTN members. The example tailors the content of C1BMXFTC, which Endevor builds for Netview FTP (or IBM FTP) commands. The inclusion or exclusion of the C1BMXFTC references in your version might depend on your transmission utility. You will need to tailor outputs for the transmission tool you are using. From c4249c6b08668d4facdb559b133633f75ab174e0 Mon Sep 17 00:00:00 2001 From: Joseph Walther Date: Mon, 31 Mar 2025 12:18:36 -0500 Subject: [PATCH 2/4] Delete Behind action and drop use of API for CSV Delete Behind action and drop use of API for CSV --- .../Package-Automation/PULLTGGR.rex | 1205 ++++++++--------- .../DELBHIND.jcl | 51 + .../DELETMBR.rex | 7 + .../README.md | 12 + 4 files changed, 641 insertions(+), 634 deletions(-) create mode 100644 endevor/Package-Shipping-Model-and-Script-Examples/DELBHIND.jcl create mode 100644 endevor/Package-Shipping-Model-and-Script-Examples/DELETMBR.rex diff --git a/endevor/Field-Developed-Programs/Package-Automation/PULLTGGR.rex b/endevor/Field-Developed-Programs/Package-Automation/PULLTGGR.rex index 3fb5f38..951b582 100644 --- a/endevor/Field-Developed-Programs/Package-Automation/PULLTGGR.rex +++ b/endevor/Field-Developed-Programs/Package-Automation/PULLTGGR.rex @@ -1,634 +1,571 @@ -/* REXX */ -/* */ -/* https://github.com/BroadcomMFD/broadcom-product-scripts */ -/* */ -/* This rexx is a called subroutine. */ -/* It can be called by PKGESHIP during exit processing, or */ -/* by a package Sweep job. (See SWEEPJOB) . */ -/* */ -/* From data in SHIPRULE, BILDTGGR updates the Trigger file */ -/* for each expected shipment. PULLTGGR submits package ship jobs. */ -/* */ - - /* If a DDNAME of PULLTGGR is allocated, then Trace */ - WhatDDName = 'PULLTGGR' - CALL BPXWDYN "INFO FI("WhatDDName")", - "INRTDSN(DSNVAR) INRDSNT(myDSNT)" - if Substr(DSNVAR,1,1) /= ' ' then TraceRc = 1; - IF TraceRc = 1 then Trace R - -/* PkgExecJobname = MVSVAR('SYMDEF',JOBNAME ) Returns JOBNAME */ - -/* Variable settings for each site ---> */ - WhereIam = WHERE@M1() - - interpret 'Call' WhereIam "'MyCLS2Library'" - MyCLS2Library = Result - Say 'Running PULLTGGR in' MyCLS2Library - - interpret 'Call' WhereIam "'TriggerFileName'" - TriggerFileName = Result - - interpret 'Call' WhereIam "'MyAUTULibrary'" - MyAUTULibrary = Result - - interpret 'Call' WhereIam "'MyHomeAddress'" - MyHomeAddress = Result - - interpret 'Call' WhereIam "'MyAUTHLibrary'" - MyAUTHLibrary = Result - - interpret 'Call' WhereIam "'MyLOADLibrary'" - MyLOADLibrary = Result - - interpret 'Call' WhereIam "'MyDATALibrary'" - MyDATALibrary = Result - ShipRules = MyDATALibrary"(SHIPRULE)" - - interpret 'Call' WhereIam "'MyOPT2Library'" - MyOPT2Library = Result - - interpret 'Call' WhereIam "'MyOPTNLibrary'" - MyOPTNLibrary = Result - - interpret 'Call' WhereIam "'MySENULibrary'" - MySENULibrary = Result - - interpret 'Call' WhereIam "'MySEN2Library'" - MySEN2Library = Result - - interpret 'Call' WhereIam "'MyCLS0Library'" - MyCLS0Library = Result - - interpret 'Call' WhereIam "'MyCLS2Library'" - MyCLS2Library = Result - - interpret 'Call' WhereIam "'AltIDAcctCode'" - AltIDAcctCode = Result - - interpret 'Call' WhereIam "'AltIDJobClass'" - AltIDJobClass = Result - - interpret 'Call' WhereIam "'TransmissionMethods'" - TransmissionMethods = Result - - interpret 'Call' WhereIam "'TransmissionModels'" - TransmissionModels = Result - - interpret 'Call' WhereIam "'SHLQ'" - SHLQ = Result - - sa= 'TransmissionMethods =' TransmissionMethods - sa= 'TransmissionModels =' TransmissionModels - -/* <---- Variable settings for each site */ - - Arg DSN_Prefix ModelDSN . ; - DSN_Prefix = Strip(DSN_Prefix,'B',',') ; - ModelDSN = Strip(ModelDSN,'B',',') ; - ModelDSN = Strip(ModelDSN) - Sa= "DSN_Prefix =" DSN_Prefix - Sa= "ModelDSN =" ModelDSN - Jobnbr = ' ' - -/* */ -/* This Rexx participates in the submission of Endevor Package */ -/* Shipment jobs. It is called by the Endevor sweep job. */ -/* */ -/* */ -/* Allocate and prepare files for TBL#TOOL execution */ -/* */ -/* */ - Submit_RC = 0 ; - Last_Submit_RC = 0 ; - TodaysDate = DATE('S') ; - NOW = TIME(L); - HOUR = SUBSTR(NOW,1,2) ; - IF HOUR = '00' THEN HOUR = '0' - MINUTE = SUBSTR(NOW,4,2) ; - CurrentTime= HOUR || MINUTE ; - - SENDNODE = MVSVAR(SYSNAME) - HSYSEXEC = MyCLS2Library - Userid = USERID() - - Call AllocateTriggerForUpdate ; - - "EXECIO * DISKR TRIGGER (STEM $tablerec. FINIS" ; - /* Build all the ...pos variables from heading */ - Call ProcessTriggerFileHeading; - -/* */ - $All_VARIABLES = $table_variables, - " PkgExecJobname ParmVal", - " Jobname Userid Date8 Date6 Time8 Time6 Destination", - " MyCLS0Library MyCLS2Library MyHomeAddress", - " MyAUTULibrary MyAUTHLibrary MyLOADLibrary ", - " MyOPT2Library MyOPTNLibrary MySEN2Library MySENULibrary", - " HSYSEXEC DB2DSN MODE SHPHLQ STEPLIB", - " ShipOutput SHLQ ", - " AltIDAcctCode AltIDJobClass ", - " Hostprefix Rmteprefix Transmissn ", - " Destin VNBLSDST SENDNODE Typrun Notify TARGnode " - -/* */ - Do trg# = 1 to $tablerec.0 - status = Substr($tablerec.trg#,Stpos,1) ; - If status /= "_" & status /= " " &, - status /= "B" then iterate; - ShipOutput = 'OUT' - If status = "B" then ShipOutput = 'BAC' ; - Package = Substr($tablerec.trg#,Packagepos,16) ; - System = Strip(Substr($tablerec.trg#,Systempos,08)); - Destination = Strip(Substr($tablerec.trg#,Destinationpos,08)); - Date = Substr($tablerec.trg#,Datepos,08) ; - IF Date > TodaysDate then iterate ; - Time = Substr($tablerec.trg#,Timepos,04) ; - IF Date = TodaysDate &, - Time > CurrentTime then iterate ; - /* Get Endevor Destination Definition */ - /* for file names and transmission method */ - - /* - Do one of these: - Call GetDestinationInfoViaAPI; - -- or -- - Call GetDestinationInfoViaCSV; - */ - - Call GetDestinationInfoViaCSV; - - Jobname = Strip(Substr($tablerec.trg#,Jobnamepos,08)) ; - If Jobname = 'useridX' then Jobname = USERID() || 'X' - PkgExecJobname = Jobname ; -/* - OwnerMask = Strip(Substr($tablerec.trg#,OwnerMaskpos,08)) ; - QualifierMask =, - Strip(Substr($tablerec.trg#,QualifierMaskpos,08)) ; - BindPackageMask =, - Strip(Substr($tablerec.trg#,BindPackageMaskpos,08)) ; - PathMask =, - Strip(Substr($tablerec.trg#,PathMaskpos,08)) ; -*/ - TYPRUN = Strip(Substr($tablerec.trg#,TYPRUNpos,6)) ; - if Length(Typrun) > 0 then, - Typrun = ',TYPRUN='Typrun - -/* - Notify = Strip(Substr($tablerec.trg#,Notifypos,8)) ; - if Length(Notify) < 2 then, - Notify = '&SYSUID' -*/ - - seconds = '000001' /* Wait 1 second before submitting next*/ - Call WaitAwhile ; - - Date8 = DATE('S') - Date6 = substr(Date8,3); - Temp = TIME('L') - - Time8 = Substr(Temp,1,2) ||, - Substr(Temp,4,2) ||, - Substr(Temp,7,2) ||, - Substr(Temp,10,2) ; - Time6 = Substr(Temp,1,2) ||, - Substr(Temp,4,2) ||, - Substr(Temp,7,2) ; - - ParmVal = Date8 Time8 - NewStatus = 's' ; - Call UPDATE_MODEL_FROM_VARIABLES ; /* Submits Shipment job */ - $headingVariable = 'St' - pos= $Starting_$position.$headingVariable - if Last_Submit_RC = 0 then, - Do - $tablerec.trg# = Overlay(NewStatus,$tablerec.trg#,Stpos) ; - $tablerec.trg# = , - Overlay(CurrentTime,$tablerec.trg#,Timepos) ; - pos= $Starting_$position.$headingVariable - If Substr(Jobnbr,1,1) > ' ' then, - $tablerec.trg# = , - Overlay(Jobnbr,$tablerec.trg#,Jobnumbpos); - End - Else, - $tablerec.trg# = Overlay("?",$tablerec.trg#,Stpos) ; - Last_Submit_RC = 0 ; - - End ; /* Do trg# = 1 to $tablerec.0 */ - - "EXECIO * DISKW TRIGGER (STEM $tablerec. FINIS" ; - - Call FreeTriggerFile ; - - Exit(Submit_RC) ; - -/* */ -/* The subroutine below is modified from the TBL#TOOL */ -/* */ -UPDATE_MODEL_FROM_VARIABLES: - - Method# = Wordpos(Transmissn,TransmissionMethods) ; - If Method# = 0 then, - Do - NewStatus = 'R' ; - Return ; - End; - ShipModel = Word(TransmissionModels,Method#); - - /* Determine Shipment JCL Model */ - STRING = "ALLOC DD(MODEL) ", - " DA('"ModelDSN"("ShipModel")')", - " SHR REUSE "; - sa= 'Destination' Destination 'is' ShipModel - CALL BPXWDYN STRING; - MyResult = RESULT ; - If MyResult > 0 then, - Do - Say 'Cannot find Shipment Model' ShipModel - Return ; - End; - - "EXECIO * DISKR "MODEL "(STEM $Model. FINIS" ; - $delimiter = "|" ; - STRING = "FREE DD(MODEL) " - CALL BPXWDYN STRING; - - Trace off - DO $LINE = 1 TO $Model.0 - $PLACE_VARIABLE = 1; - CALL EVALUATE_SYMBOLICS ; - END; /* DO $LINE = 1 TO $Model.0 */ - IF TraceRc = 1 then Trace R - - CALL BPXWDYN , - "ALLOC DD(SYSUT1) LRECL(80) BLKSIZE(27920) SPACE(5,5) ", - " RECFM(F,B) TRACKS ", - " NEW UNCATALOG REUSE "; - - "EXECIO * DISKW SYSUT1 (STEM $Model. FINIS" ; - - Call Submit_Job ; - - Drop $Model. ; - - RETURN; - -/* */ -/* The subroutine below is borrowed from the TBL#TOOL */ -/* */ -EVALUATE_SYMBOLICS: - - DO FOREVER; - $PLACE_VARIABLE = POS('&',$Model.$LINE,$PLACE_VARIABLE) - IF $PLACE_VARIABLE = 0 THEN LEAVE; - $temp_$LINE = TRANSLATE($Model.$LINE,' ',',.()"/\+-*|'); - $temp_$LINE = TRANSLATE($temp_$LINE,' ',"'"$delimiter); - $table_word = WORD(SUBSTR($temp_$LINE,($PLACE_VARIABLE+1)),1); - $table_word = TRANSLATE($table_word,'_','-') ; - $varlen = LENGTH($table_word) + 1 ; - - if WORDPOS($table_word,$All_VARIABLES) = 0 then, - do - $PLACE_VARIABLE = $PLACE_VARIABLE + 1 ; - iterate; - end; - - $temp_word = VALUE($table_word) ; - IF DATATYPE($temp_word,S) = 9 THEN, - $temp = 'SYMBVALUE = ' $temp_word ; - ELSE, - $temp = "SYMBVALUE = '"$temp_word"'" ; - IF TraceRc = 1 then say $temp - INTERPRET $temp; - SA= 'SYMBVALUE = ' SYMBVALUE ; - - $tail = SUBSTR($Model.$LINE,($PLACE_VARIABLE+$varlen)) ; - if Substr($tail,1,1) = $delimiter then, - $tail = SUBSTR($tail,2) ; - IF $PLACE_VARIABLE > 1 THEN, - $Model.$LINE = , - SUBSTR($Model.$LINE,1,($PLACE_VARIABLE-1)) ||, - SYMBVALUE || $tail ; - else, - $Model.$LINE = , - SYMBVALUE || $tail ; - END; /* DO FOREVER */ - - RETURN; - -Submit_Job: - - STRING = "ALLOC DD(SYSIN) DUMMY" - CALL BPXWDYN STRING; -/* - STRING = "ALLOC DD(SYSPRINT) DUMMY" - CALL BPXWDYN STRING; -*/ - - STRING = "ALLOC DD(SYSUT2)", - "SYSOUT(A) WRITER(INTRDR) REUSE " ; - CALL BPXWDYN STRING; - - ADDRESS LINK 'IEBGENER' - - "EXECIO * DISKR SYSUT1 (STEM $SUBS. FINIS" ; - "EXECIO * DISKW SYSPRINT (STEM $SUBS. FINIS" ; - - STRING = "FREE DD(SYSUT1)" - CALL BPXWDYN STRING; - - STRING = "FREE DD(SYSUT2)" - CALL BPXWDYN STRING; - - return; - -AllocateTriggerForUpdate: - - STRING = "ALLOC DD(TRIGGER)", - " DA('"TriggerFileName"') OLD REUSE" - seconds = '000007' /* Number of Seconds to wait if needed */ - - Do Forever /* or at least until the file is available */ - CALL BPXWDYN STRING; - MyRC = RC - MyResult = RESULT ; - If MyResult = 0 then Leave - Call WaitAwhile - End /* Do Forever */ - - Return ; - -FreeTriggerFile: - - STRING = "FREE DD(TRIGGER)" - CALL BPXWDYN STRING ; - - Return ; - -/* */ -/* Convert Date formats */ -/* */ - -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 - -ProcessTriggerFileHeading : -/* The subroutine below is modified from the TBL#TOOL */ - - $tbl = 1 ; - $TableHeadingChar = '*' - - $LastWord = Word($tablerec.$tbl,Words($tablerec.$tbl)); - If DATATYPE($LastWord) = 'NUM' then, - Do - Say 'Please remove sequence numbers from the Table' - Exit(12) - End - - $tmprec = Substr($tablerec.$tbl,2) ; - $PositionSpclChar = POS('-',$tmprec) ; - If $PositionSpclChar = 0 then, - $PositionSpclChar = POS('*',$tmprec) ; - $tmpreplaces = '-,.'$TableHeadingChar ; - $tmprec = TRANSLATE($tmprec,' ',$tmpreplaces); - $table_variables = strip($tmprec); - $Heading_Variable_count = WORDS($table_variables) ; - If $Heading_Variable_count /=, - Words(Substr($tablerec.$tbl,2)) then, - Do - Say 'Invalid table Heading:' $tablerec.$tbl - exit(12) - End - - $heading = Overlay(' ',$tablerec.$tbl,1); /* Space leading * */ - Do $pos = 1 to $Heading_Variable_count - $HeadingVariable = Word($table_variables,$pos) ; - $tmp = Wordindex($Heading,$pos) ; - $Starting_$position.$HeadingVariable = $tmp - $tmp = $tmp + Length(Word($Heading,$pos)) -1 ; - $Ending_$position.$HeadingVariable = $tmp - - /* Build ...pos variables and values */ - tmp = ""$HeadingVariable"pos =", - $Starting_$position.$HeadingVariable - Sa= tmp - Interpret tmp - - end; /* DO $pos = 1 to $Heading_Variable_count */ - - $Heading = Translate($Heading,' ','-*') - - Return ; - -GetDestinationInfoViaAPI: - - /* Set values for Hostprefix and Rmteprefix */ - /* From the site definition */ - - /* Call API to Get Destination information */ - - - STRING = "ALLOC DD(BSTAPI) SYSOUT(J) " - CALL BPXWDYN STRING; - - STRING = "ALLOC DD(BSTERR) SYSOUT(J) " - CALL BPXWDYN STRING; - - STRING = "ALLOC DD(APIMSGS) LRECL(133) BLKSIZE(13300) ", - " DSORG(PS) ", - " SPACE(1,1) RECFM(F,B) TRACKS ", - " NEW UNCATALOG REUSE "; - CALL BPXWDYN STRING; - - STRING = "ALLOC DD(APILIST) LRECL(2048) BLKSIZE(22800) ", - " DSORG(PS) ", - " SPACE(1,1) RECFM(V,B) TRACKS ", - " NEW UNCATALOG REUSE "; - CALL BPXWDYN STRING; - - /* Call API to Get Destination information */ - parm = Left(Destination'*',7) - - /* Call APIALDST to get Destination information */ - - ADDRESS LINKMVS "APIALDST parm" - RETURN_RC = RC ; - If RETURN_RC > 0 then, - DO - parm = 'DDN:STEPLIB,APIALDST,'parm - ADDRESS LINKMVS 'CONCALL' "parm" - SA= 'CANNOT GET INFORMATION FROM ENDEVOR' ; - EXIT - END ; - "EXECIO * DISKR APILIST ( Stem apiDestinations. FINIS" - Sa= 'Messages from PULLTGGR:' - Hostprefix = Strip(Substr(apiDestinations.1,079,14)) - Rmteprefix = Strip(Substr(apiDestinations.1,113,14)) - Transmissn = Strip(Substr(apiDestinations.1,051,11)) - TARGnode = Strip(Substr(apiDestinations.1,062,08)) - - STRING = "FREE DD(APILIST)" - CALL BPXWDYN STRING; - STRING = "FREE DD(APIMSGS)" - CALL BPXWDYN STRING; - STRING = "FREE DD(BSTAPI) " - CALL BPXWDYN STRING; - STRING = "FREE DD(BSTERR) " - CALL BPXWDYN STRING; - - Return ; - -GetDestinationInfoViaCSV: - - /* Set values for Hostprefix and Rmteprefix */ - /* From the site definition */ - - /* Call CSV to Get Destination information */ - - STRING = "ALLOC DD(C1MSGS1) DUMMY " - CALL BPXWDYN STRING; - STRING = "ALLOC DD(BSTERR) DUMMY " - CALL BPXWDYN STRING; - STRING = "ALLOC DD(BSTAPI) DUMMY " - CALL BPXWDYN STRING; - - STRING = "ALLOC DD(CSVDEST) LRECL(4000) BLKSIZE(32000) ", - " DSORG(PS) ", - " SPACE(1,5) RECFM(F,B) TRACKS ", - " NEW UNCATALOG REUSE "; - CALL BPXWDYN STRING; - - STRING = "ALLOC DD(BSTIPT01) LRECL(80) BLKSIZE(800) ", - " DSORG(PS) ", - " SPACE(1,5) RECFM(F,B) TRACKS ", - " NEW UNCATALOG REUSE "; - CALL BPXWDYN STRING; - - Push "LIST DESTINATION '"Destination"'", - " TO FILE CSVDEST OPTIONS ." - - "EXECIO 1 DISKW BSTIPT01 (FINIS "; - - ADDRESS LINK 'BC1PCSV0' ; /* load from authlib */ - call_rc = rc ; -/* ADDRESS TSO 'ISRDDN' */ - - "EXECIO * DISKR CSVDEST (STEM API. finis" - - STRING = "FREE DD(CSVDEST)" ; - CALL BPXWDYN STRING; - STRING = "FREE DD(BSTIPT01)" ; - CALL BPXWDYN STRING; - STRING = "FREE DD(C1MSGS1)" ; - CALL BPXWDYN STRING; - STRING = "FREE DD(BSTERR)" ; - CALL BPXWDYN STRING; - STRING = "FREE DD(BSTAPI)" ; - CALL BPXWDYN STRING; - - IF API.0 < 2 THEN, - Do - Say 'Cannot find Definition for Destination' Destination - EXIT(12) - End - - $table_variables= Strip(API.1,'T') - - $table_variables = translate($table_variables,"_"," ") ; - $table_variables = translate($table_variables," ",',"') ; - $table_variables = translate($table_variables,"@","/") ; - $table_variables = translate($table_variables,"@",")") ; - $table_variables = translate($table_variables,"@","(") ; - - Do rec# = 2 to API.0 - $detail = API.rec# - - /* Parse the Detail record until done */ - Do $column = 1 to Words($table_variables) - Call ParseDetailCSVline - End - - Sa= 'Messages from PULLTGGR:' - Hostprefix = HOST_DSN_PREFIX - Rmteprefix = REMOTE_DSN_PREFIX - Transmissn = TRANS_DESC - TARGnode = TRANS_NODE - End; /* Do rec# = 1 to API.0 */ - - RETURN ; - -ParseDetailCSVline: - - /* Find the data for the current $column */ - - $dlmchar = Substr($detail,1,1); - - If $dlmchar = "'" then, - Do - SA= 'parsing with single quote ' - PARSE VAR $detail "'" $temp_value "'" $detail ; - If Substr($detail,1,1) = ',' then, - $detail = Strip(Substr($detail,2),'L') - End - Else, - If $dlmchar = '"' then, - Do - SA= 'parsing with double quote ' - PARSE VAR $detail '"' $temp_value '"' $detail ; - If Substr($detail,1,1) = ',' then, - $detail = Strip(Substr($detail,2),'L') - End - Else, - If $dlmchar = ',' then, - Do - SA= 'parsing with comma ' - PARSE VAR $detail ',' $temp_value ',' $detail ; - If Substr($detail,1,1)/= ',' then, - $detail = "," || $detail - $detail = Strip(Substr($detail,2),'L') */ - End - Else, - If Words($detail) = 0 then, - $temp_value = ' ' - Else, - Do - SA= 'parsing with comma ' - PARSE VAR $detail $temp_value ',' $detail ; - Sa= '$temp_value=>' $temp_value '<' - End - $temp_value = STRIP($temp_value) ; - $rslt = $temp_value - $rslt = Strip($rslt,'B','"') ; - $rslt = Strip($rslt,'B',"'") ; - if Length($rslt) < 1 then $rslt = ' ' - if Length($rslt) < 250 then, - $temp = WORD($table_variables,$column) '= "'$rslt'"'; - Else, - $temp = WORD($table_variables,$column) "=$rslt" - INTERPRET $temp; - If rec# < 3 then Say $temp - - RETURN ; - +/* REXX */ +/* */ +/* https://github.com/BroadcomMFD/broadcom-product-scripts */ +/* */ +/* This rexx is a called subroutine. */ +/* It can be called by PKGESHIP during exit processing, or */ +/* by a package Sweep job. (See SWEEPJOB) . */ +/* */ +/* From data in SHIPRULE, BILDTGGR updates the Trigger file */ +/* for each expected shipment. PULLTGGR submits package ship jobs. */ +/* */ + + /* If a DDNAME of PULLTGGR is allocated, then Trace */ + WhatDDName = 'PULLTGGR' + CALL BPXWDYN "INFO FI("WhatDDName")", + "INRTDSN(DSNVAR) INRDSNT(myDSNT)" + if Substr(DSNVAR,1,1) /= ' ' then TraceRc = 1; + IF TraceRc = 1 then Trace R + +/* PkgExecJobname = MVSVAR('SYMDEF',JOBNAME ) Returns JOBNAME */ + +/* Variable settings for each site ---> */ + WhereIam = WHERE@M1() + + interpret 'Call' WhereIam "'MyCLS2Library'" + MyCLS2Library = Result + Say 'Running PULLTGGR in' MyCLS2Library + + interpret 'Call' WhereIam "'TriggerFileName'" + TriggerFileName = Result + + interpret 'Call' WhereIam "'MyAUTULibrary'" + MyAUTULibrary = Result + + interpret 'Call' WhereIam "'MyHomeAddress'" + MyHomeAddress = Result + + interpret 'Call' WhereIam "'MyAUTHLibrary'" + MyAUTHLibrary = Result + + interpret 'Call' WhereIam "'MyLOADLibrary'" + MyLOADLibrary = Result + + interpret 'Call' WhereIam "'MyDATALibrary'" + MyDATALibrary = Result + ShipRules = MyDATALibrary"(SHIPRULE)" + + interpret 'Call' WhereIam "'MyOPT2Library'" + MyOPT2Library = Result + + interpret 'Call' WhereIam "'MyOPTNLibrary'" + MyOPTNLibrary = Result + + interpret 'Call' WhereIam "'MySENULibrary'" + MySENULibrary = Result + + interpret 'Call' WhereIam "'MySEN2Library'" + MySEN2Library = Result + + interpret 'Call' WhereIam "'MyCLS0Library'" + MyCLS0Library = Result + + interpret 'Call' WhereIam "'MyCLS2Library'" + MyCLS2Library = Result + + interpret 'Call' WhereIam "'AltIDAcctCode'" + AltIDAcctCode = Result + + interpret 'Call' WhereIam "'AltIDJobClass'" + AltIDJobClass = Result + + interpret 'Call' WhereIam "'TransmissionMethods'" + TransmissionMethods = Result + + interpret 'Call' WhereIam "'TransmissionModels'" + TransmissionModels = Result + + interpret 'Call' WhereIam "'SHLQ'" + SHLQ = Result + + sa= 'TransmissionMethods =' TransmissionMethods + sa= 'TransmissionModels =' TransmissionModels + +/* <---- Variable settings for each site */ + + Arg DSN_Prefix ModelDSN . ; + DSN_Prefix = Strip(DSN_Prefix,'B',',') ; + ModelDSN = Strip(ModelDSN,'B',',') ; + ModelDSN = Strip(ModelDSN) + Sa= "DSN_Prefix =" DSN_Prefix + Sa= "ModelDSN =" ModelDSN + Jobnbr = ' ' + +/* */ +/* This Rexx participates in the submission of Endevor Package */ +/* Shipment jobs. It is called by the Endevor sweep job. */ +/* */ +/* */ +/* Allocate and prepare files for TBL#TOOL execution */ +/* */ +/* */ + Submit_RC = 0 ; + Last_Submit_RC = 0 ; + TodaysDate = DATE('S') ; + NOW = TIME(L); + HOUR = SUBSTR(NOW,1,2) ; + IF HOUR = '00' THEN HOUR = '0' + MINUTE = SUBSTR(NOW,4,2) ; + CurrentTime= HOUR || MINUTE ; + + SENDNODE = MVSVAR(SYSNAME) + HSYSEXEC = MyCLS2Library + Userid = USERID() + + Call AllocateTriggerForUpdate ; + + "EXECIO * DISKR TRIGGER (STEM $tablerec. FINIS" ; + /* Build all the ...pos variables from heading */ + Call ProcessTriggerFileHeading; + +/* */ + $All_VARIABLES = $table_variables, + " PkgExecJobname ParmVal", + " Jobname Userid Date8 Date6 Time8 Time6 Destination", + " MyCLS0Library MyCLS2Library MyHomeAddress", + " MyAUTULibrary MyAUTHLibrary MyLOADLibrary ", + " MyOPT2Library MyOPTNLibrary MySEN2Library MySENULibrary", + " HSYSEXEC DB2DSN MODE SHPHLQ STEPLIB", + " ShipOutput SHLQ ", + " AltIDAcctCode AltIDJobClass ", + " Hostprefix Rmteprefix Transmissn ", + " HOSTHLQ RMOTHLQ XMITMETH ", + " Destin VNBLSDST SENDNODE Typrun Notify TARGnode " + +/* */ + Do trg# = 1 to $tablerec.0 + status = Substr($tablerec.trg#,Stpos,1) ; + If status /= "_" & status /= " " &, + status /= "B" then iterate; + ShipOutput = 'OUT' + If status = "B" then ShipOutput = 'BAC' ; + Package = Substr($tablerec.trg#,Packagepos,16) ; + System = Strip(Substr($tablerec.trg#,Systempos,08)); + Destination = Strip(Substr($tablerec.trg#,Destinationpos,08)); + Date = Substr($tablerec.trg#,Datepos,08) ; + IF Date > TodaysDate then iterate ; + Time = Substr($tablerec.trg#,Timepos,04) ; + IF Date = TodaysDate &, + Time > CurrentTime then iterate ; + + Call GetDestinationInfoViaCSV; + + Jobname = Strip(Substr($tablerec.trg#,Jobnamepos,08)) ; + If Jobname = 'useridX' then Jobname = USERID() || 'X' + PkgExecJobname = Jobname ; +/* + OwnerMask = Strip(Substr($tablerec.trg#,OwnerMaskpos,08)) ; + QualifierMask =, + Strip(Substr($tablerec.trg#,QualifierMaskpos,08)) ; + BindPackageMask =, + Strip(Substr($tablerec.trg#,BindPackageMaskpos,08)) ; + PathMask =, + Strip(Substr($tablerec.trg#,PathMaskpos,08)) ; +*/ + TYPRUN = Strip(Substr($tablerec.trg#,TYPRUNpos,6)) ; + if Length(Typrun) > 0 then, + Typrun = ',TYPRUN='Typrun + +/* + Notify = Strip(Substr($tablerec.trg#,Notifypos,8)) ; + if Length(Notify) < 2 then, + Notify = '&SYSUID' +*/ + + seconds = '000001' /* Wait 1 second before submitting next*/ + Call WaitAwhile ; + + Date8 = DATE('S') + Date6 = substr(Date8,3); + Temp = TIME('L') + + Time8 = Substr(Temp,1,2) ||, + Substr(Temp,4,2) ||, + Substr(Temp,7,2) ||, + Substr(Temp,10,2) ; + Time6 = Substr(Temp,1,2) ||, + Substr(Temp,4,2) ||, + Substr(Temp,7,2) ; + + ParmVal = Date8 Time8 + NewStatus = 's' ; + Call UPDATE_MODEL_FROM_VARIABLES ; /* Submits Shipment job */ + $headingVariable = 'St' + pos= $Starting_$position.$headingVariable + if Last_Submit_RC = 0 then, + Do + $tablerec.trg# = Overlay(NewStatus,$tablerec.trg#,Stpos) ; + $tablerec.trg# = , + Overlay(CurrentTime,$tablerec.trg#,Timepos) ; + pos= $Starting_$position.$headingVariable + If Substr(Jobnbr,1,1) > ' ' then, + $tablerec.trg# = , + Overlay(Jobnbr,$tablerec.trg#,Jobnumbpos); + End + Else, + $tablerec.trg# = Overlay("?",$tablerec.trg#,Stpos) ; + Last_Submit_RC = 0 ; + + End ; /* Do trg# = 1 to $tablerec.0 */ + + "EXECIO * DISKW TRIGGER (STEM $tablerec. FINIS" ; + + Call FreeTriggerFile ; + + Exit(Submit_RC) ; + +/* */ +/* The subroutine below is modified from the TBL#TOOL */ +/* */ +UPDATE_MODEL_FROM_VARIABLES: + + Method# = Wordpos(Transmissn,TransmissionMethods) ; + If Method# = 0 then, + Do + NewStatus = 'R' ; + Return ; + End; + ShipModel = Word(TransmissionModels,Method#); + + /* Determine Shipment JCL Model */ + STRING = "ALLOC DD(MODEL) ", + " DA('"ModelDSN"("ShipModel")')", + " SHR REUSE "; + sa= 'Destination' Destination 'is' ShipModel + CALL BPXWDYN STRING; + MyResult = RESULT ; + If MyResult > 0 then, + Do + Say 'Cannot find Shipment Model' ShipModel + Return ; + End; + + "EXECIO * DISKR "MODEL "(STEM $Model. FINIS" ; + $delimiter = "|" ; + STRING = "FREE DD(MODEL) " + CALL BPXWDYN STRING; + + Trace off + DO $LINE = 1 TO $Model.0 + $PLACE_VARIABLE = 1; + CALL EVALUATE_SYMBOLICS ; + END; /* DO $LINE = 1 TO $Model.0 */ + IF TraceRc = 1 then Trace R + + CALL BPXWDYN , + "ALLOC DD(SYSUT1) LRECL(80) BLKSIZE(27920) SPACE(5,5) ", + " RECFM(F,B) TRACKS ", + " NEW UNCATALOG REUSE "; + + "EXECIO * DISKW SYSUT1 (STEM $Model. FINIS" ; + + Call Submit_Job ; + + Drop $Model. ; + + RETURN; + +/* */ +/* The subroutine below is borrowed from the TBL#TOOL */ +/* */ +EVALUATE_SYMBOLICS: + + DO FOREVER; + $PLACE_VARIABLE = POS('&',$Model.$LINE,$PLACE_VARIABLE) + IF $PLACE_VARIABLE = 0 THEN LEAVE; + $temp_$LINE = TRANSLATE($Model.$LINE,' ',',.()"/\+-*|'); + $temp_$LINE = TRANSLATE($temp_$LINE,' ',"'"$delimiter); + $table_word = WORD(SUBSTR($temp_$LINE,($PLACE_VARIABLE+1)),1); + $table_word = TRANSLATE($table_word,'_','-') ; + $varlen = LENGTH($table_word) + 1 ; + + if WORDPOS($table_word,$All_VARIABLES) = 0 then, + do + $PLACE_VARIABLE = $PLACE_VARIABLE + 1 ; + iterate; + end; + + $temp_word = VALUE($table_word) ; + IF DATATYPE($temp_word,S) = 9 THEN, + $temp = 'SYMBVALUE = ' $temp_word ; + ELSE, + $temp = "SYMBVALUE = '"$temp_word"'" ; + IF TraceRc = 1 then say $temp + INTERPRET $temp; + SA= 'SYMBVALUE = ' SYMBVALUE ; + + $tail = SUBSTR($Model.$LINE,($PLACE_VARIABLE+$varlen)) ; + if Substr($tail,1,1) = $delimiter then, + $tail = SUBSTR($tail,2) ; + IF $PLACE_VARIABLE > 1 THEN, + $Model.$LINE = , + SUBSTR($Model.$LINE,1,($PLACE_VARIABLE-1)) ||, + SYMBVALUE || $tail ; + else, + $Model.$LINE = , + SYMBVALUE || $tail ; + END; /* DO FOREVER */ + + RETURN; + +Submit_Job: + + STRING = "ALLOC DD(SYSIN) DUMMY" + CALL BPXWDYN STRING; +/* + STRING = "ALLOC DD(SYSPRINT) DUMMY" + CALL BPXWDYN STRING; +*/ + + STRING = "ALLOC DD(SYSUT2)", + "SYSOUT(A) WRITER(INTRDR) REUSE " ; + CALL BPXWDYN STRING; + + ADDRESS LINK 'IEBGENER' + + "EXECIO * DISKR SYSUT1 (STEM $SUBS. FINIS" ; + "EXECIO * DISKW SYSPRINT (STEM $SUBS. FINIS" ; + + STRING = "FREE DD(SYSUT1)" + CALL BPXWDYN STRING; + + STRING = "FREE DD(SYSUT2)" + CALL BPXWDYN STRING; + + return; + +AllocateTriggerForUpdate: + + STRING = "ALLOC DD(TRIGGER)", + " DA('"TriggerFileName"') OLD REUSE" + seconds = '000007' /* Number of Seconds to wait if needed */ + + Do Forever /* or at least until the file is available */ + CALL BPXWDYN STRING; + MyRC = RC + MyResult = RESULT ; + If MyResult = 0 then Leave + Call WaitAwhile + End /* Do Forever */ + + Return ; + +FreeTriggerFile: + + STRING = "FREE DD(TRIGGER)" + CALL BPXWDYN STRING ; + + Return ; + +/* */ +/* Convert Date formats */ +/* */ + +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 + +ProcessTriggerFileHeading : +/* The subroutine below is modified from the TBL#TOOL */ + + $tbl = 1 ; + $TableHeadingChar = '*' + + $LastWord = Word($tablerec.$tbl,Words($tablerec.$tbl)); + If DATATYPE($LastWord) = 'NUM' then, + Do + Say 'Please remove sequence numbers from the Table' + Exit(12) + End + + $tmprec = Substr($tablerec.$tbl,2) ; + $PositionSpclChar = POS('-',$tmprec) ; + If $PositionSpclChar = 0 then, + $PositionSpclChar = POS('*',$tmprec) ; + $tmpreplaces = '-,.'$TableHeadingChar ; + $tmprec = TRANSLATE($tmprec,' ',$tmpreplaces); + $table_variables = strip($tmprec); + $Heading_Variable_count = WORDS($table_variables) ; + If $Heading_Variable_count /=, + Words(Substr($tablerec.$tbl,2)) then, + Do + Say 'Invalid table Heading:' $tablerec.$tbl + exit(12) + End + + $heading = Overlay(' ',$tablerec.$tbl,1); /* Space leading * */ + Do $pos = 1 to $Heading_Variable_count + $HeadingVariable = Word($table_variables,$pos) ; + $tmp = Wordindex($Heading,$pos) ; + $Starting_$position.$HeadingVariable = $tmp + $tmp = $tmp + Length(Word($Heading,$pos)) -1 ; + $Ending_$position.$HeadingVariable = $tmp + + /* Build ...pos variables and values */ + tmp = ""$HeadingVariable"pos =", + $Starting_$position.$HeadingVariable + Sa= tmp + Interpret tmp + + end; /* DO $pos = 1 to $Heading_Variable_count */ + + $Heading = Translate($Heading,' ','-*') + + Return ; + +GetDestinationInfoViaCSV: + + /* Set values for Hostprefix and Rmteprefix */ + /* From the site definition */ + + /* Call CSV to Get Destination information */ + + STRING = "ALLOC DD(C1MSGS1) DUMMY " + CALL BPXWDYN STRING; + STRING = "ALLOC DD(BSTERR) DUMMY " + CALL BPXWDYN STRING; + STRING = "ALLOC DD(BSTAPI) DUMMY " + CALL BPXWDYN STRING; + + STRING = "ALLOC DD(CSVDEST) LRECL(4000) BLKSIZE(32000) ", + " DSORG(PS) ", + " SPACE(1,5) RECFM(F,B) TRACKS ", + " NEW UNCATALOG REUSE "; + CALL BPXWDYN STRING; + + STRING = "ALLOC DD(BSTIPT01) LRECL(80) BLKSIZE(800) ", + " DSORG(PS) ", + " SPACE(1,5) RECFM(F,B) TRACKS ", + " NEW UNCATALOG REUSE "; + CALL BPXWDYN STRING; + + Push "LIST DESTINATION '"Destination"'", + " TO FILE CSVDEST OPTIONS ." + + "EXECIO 1 DISKW BSTIPT01 (FINIS "; + + ADDRESS LINK 'BC1PCSV0' ; /* load from authlib */ + call_rc = rc ; +/* ADDRESS TSO 'ISRDDN' */ + + "EXECIO * DISKR CSVDEST (STEM API. finis" + + STRING = "FREE DD(CSVDEST)" ; + CALL BPXWDYN STRING; + STRING = "FREE DD(BSTIPT01)" ; + CALL BPXWDYN STRING; + STRING = "FREE DD(C1MSGS1)" ; + CALL BPXWDYN STRING; + STRING = "FREE DD(BSTERR)" ; + CALL BPXWDYN STRING; + STRING = "FREE DD(BSTAPI)" ; + CALL BPXWDYN STRING; + + IF API.0 < 2 THEN, + Do + Say 'Cannot find Definition for Destination' Destination + EXIT(12) + End + + $table_variables= Strip(API.1,'T') + + $table_variables = translate($table_variables,"_"," ") ; + $table_variables = translate($table_variables," ",',"') ; + $table_variables = translate($table_variables,"@","/") ; + $table_variables = translate($table_variables,"@",")") ; + $table_variables = translate($table_variables,"@","(") ; + + Do rec# = 2 to API.0 + $detail = API.rec# + + /* Parse the Detail record until done */ + Do $column = 1 to Words($table_variables) + Call ParseDetailCSVline + End + + Sa= 'Messages from PULLTGGR:' + Hostprefix = HOST_DSN_PREFIX + HOSTHLQ = HOST_DSN_PREFIX + Rmteprefix = REMOTE_DSN_PREFIX + RMOTHLQ = REMOTE_DSN_PREFIX + Transmissn = TRANS_DESC + XMITMETH = TRANS_DESC + TARGnode = TRANS_NODE + End; /* Do rec# = 1 to API.0 */ + + RETURN ; + +ParseDetailCSVline: + + /* Find the data for the current $column */ + + $dlmchar = Substr($detail,1,1); + + If $dlmchar = "'" then, + Do + SA= 'parsing with single quote ' + PARSE VAR $detail "'" $temp_value "'" $detail ; + If Substr($detail,1,1) = ',' then, + $detail = Strip(Substr($detail,2),'L') + End + Else, + If $dlmchar = '"' then, + Do + SA= 'parsing with double quote ' + PARSE VAR $detail '"' $temp_value '"' $detail ; + If Substr($detail,1,1) = ',' then, + $detail = Strip(Substr($detail,2),'L') + End + Else, + If $dlmchar = ',' then, + Do + SA= 'parsing with comma ' + PARSE VAR $detail ',' $temp_value ',' $detail ; + If Substr($detail,1,1)/= ',' then, + $detail = "," || $detail + $detail = Strip(Substr($detail,2),'L') */ + End + Else, + If Words($detail) = 0 then, + $temp_value = ' ' + Else, + Do + SA= 'parsing with comma ' + PARSE VAR $detail $temp_value ',' $detail ; + Sa= '$temp_value=>' $temp_value '<' + End + $temp_value = STRIP($temp_value) ; + $rslt = $temp_value + $rslt = Strip($rslt,'B','"') ; + $rslt = Strip($rslt,'B',"'") ; + if Length($rslt) < 1 then $rslt = ' ' + if Length($rslt) < 250 then, + $temp = WORD($table_variables,$column) '= "'$rslt'"'; + Else, + $temp = WORD($table_variables,$column) "=$rslt" + INTERPRET $temp; + If rec# < 3 then Say $temp + + RETURN ; + diff --git a/endevor/Package-Shipping-Model-and-Script-Examples/DELBHIND.jcl b/endevor/Package-Shipping-Model-and-Script-Examples/DELBHIND.jcl new file mode 100644 index 0000000..d8464f1 --- /dev/null +++ b/endevor/Package-Shipping-Model-and-Script-Examples/DELBHIND.jcl @@ -0,0 +1,51 @@ +//********************************************************************** +//* STEP1 WRITE: Get the COMPONENT list for the source element +//********************************************************************** +//WRITE EXEC PGM=CONWRITE,MAXRC=4 DELBHIND +//CONWIN DD * + WRITE ELEMENT &C1ELEMENT + FROM ENV &C1SENVMNT SYSTEM &C1SYSTEM SUBSYSTEM &C1SSUBSYS + TYPE &C1ELTYPE STAGE &C1SSTGID + TO DDN PRNTFILE + OPTION COMPONENT. +//PRNTFILE DD DSN=&&PRNTFILE,DISP=(NEW,PASS), +// UNIT=&TUNIT,SPACE=(TRK,(5,5)), +// DCB=(RECFM=FB,LRECL=203,BLKSIZE=4060) +//* +//********************************************************************** +//* STEP2 SHOWME1: Show the COMPONENT List +//********************************************************************** +//SHOWME1 EXEC PGM=IEBGENER DELBHIND +//SYSPRINT DD DUMMY +//SYSUT1 DD DSN=&&PRNTFILE,DISP=(OLD,PASS) +//SYSUT2 DD SYSOUT=* +//SYSIN DD DUMMY +//* +//********************************************************************** +//* STEP3 DELBHIND: Create Delete Behind transactions for +//* remote DELETE actions. +//********************************************************************** +//DELBHIND EXEC PGM=IRXJCL,PARM='ENBPIU00 M O',MAXRC=4 DELBHIND +//TABLE DD DSN=&&PRNTFILE,DISP=(OLD,PASS) +//POSITION DD * + InOrOut 37 37 + DDNAME 49 56 + STEPNAME 29 36 + Member 39 46 + Dataset 57 100 +//OPTIONS DD * + $Table_Type = 'positions' + tempdsn = Translate(Dataset,' ','.'); + lastnode = Word(tempdsn,Words(tempdsn)) + If lastnode = 'LISTLIB' then $SkipRow = 'Y' +//MODEL DD * + %DELETMBR &Dataset &Member +//SYSEXEC DD DSN=YOUR.NDVR.EMER.ADMINSYS.CSIQCLS0, +// DISP=SHR +//SYSTSIN DD DUMMY +//SYSTSPRT DD SYSOUT=* +//TBLOUT DD SYSOUT=* +//*BLOUT DD DISP=SHR,DSN=&HLQ#...DELETES(&C1ELEMENT), +//* MONITOR=COMPONENTS +//* +//********************************************************************** diff --git a/endevor/Package-Shipping-Model-and-Script-Examples/DELETMBR.rex b/endevor/Package-Shipping-Model-and-Script-Examples/DELETMBR.rex new file mode 100644 index 0000000..11fd1de --- /dev/null +++ b/endevor/Package-Shipping-Model-and-Script-Examples/DELETMBR.rex @@ -0,0 +1,7 @@ +/* REXX */ + Arg Dataset Member; + "ALLOC DD(PDS) DSN('"Dataset"') SHR REUSE" + QUEUE " DELETE "Dataset"("Member") FILE (PDS)" + "Execio 1 DISKW SYSIN (Finis" + ADDRESS LINK 'IDCAMS' + Exit diff --git a/endevor/Package-Shipping-Model-and-Script-Examples/README.md b/endevor/Package-Shipping-Model-and-Script-Examples/README.md index bdfc20c..f2205df 100644 --- a/endevor/Package-Shipping-Model-and-Script-Examples/README.md +++ b/endevor/Package-Shipping-Model-and-Script-Examples/README.md @@ -137,6 +137,14 @@ It might be useful to consider using a JES include, where an included member nam // INCLUDE MEMBER=#&DESTID JES include from MY.REMOTE.JCL +## Shipping "Delete Behind" actions + +If you ship from Endevor locations in the middle of your map, and you want package shipments to replicate remote "delete behind" actions - to match what your processors are doing locally - consider members DELBHIND and DELETMBR. + +You can include or copy DELBHIND into your Move processor to create "delete behind transactions", based on your elements component list. Tailor the last step to identify which members and datasets from the component list you want to delete. Tailoring might also be necessary to adjust remote dataset names that differ from those listed in the component list. The "transactions" can be shipped to destinations where cleanup needs to occur. + +If you place DELETMBR at each destination where needed, it can delete the members from the datasets identified in each "delete behind transaction". If the targeted member is already missing from the dataset, no action is done. + ## Tips and Techniques @@ -252,3 +260,7 @@ Lines 13 and 14 show the REXX code identifying where it is running. The **MVSVAR Engaging a "callable REXX" service may also be performed from other REXX programs, such as an Endevor REXX exit or from REXX zowe executions. One final note about the CSIQCLS0 variable. The variable is created brand new in the REXX portion of the C1BMXIN skeleton, and is used as an ISPF variable later on the TAILOR step. You can make variables like CSIQCLS0 be both an ISPF variable and a Table Tool variable, if it is included in the OPTIONS of the TAILOR step. + +### More from the Package Automation Folder + +Find more examples and information on package Shipping in the [Package Automation folder](https://github.com/BroadcomMFD/broadcom-product-scripts/tree/main/endevor/Field-Developed-Programs/Package-Automation) From a528764a6d5ce35693be081796bb61ef86b597c3 Mon Sep 17 00:00:00 2001 From: Joseph Walther Date: Mon, 31 Mar 2025 18:00:52 -0500 Subject: [PATCH 3/4] Update C1BMXIN.skl --- .../Package-Shipping-Model-and-Script-Examples/C1BMXIN.skl | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/endevor/Package-Shipping-Model-and-Script-Examples/C1BMXIN.skl b/endevor/Package-Shipping-Model-and-Script-Examples/C1BMXIN.skl index 4a4d774..d4f96ba 100644 --- a/endevor/Package-Shipping-Model-and-Script-Examples/C1BMXIN.skl +++ b/endevor/Package-Shipping-Model-and-Script-Examples/C1BMXIN.skl @@ -119,11 +119,9 @@ AHJOB AHJOB C1BMXFTC C1BMXFTC //C1BMXFTC DD DSN=&&XFTC,DISP=(OLD,PASS) -//AHJOB DD DSN=&HOSTHLQ..D&DATE6..T&TIME6..&DESTIN..AHJOB, -// DISP=(MOD,CATLG,KEEP), -// SPACE=(CYL,(5,5)),UNIT=3390, -// DCB=(RECFM=FB,LRECL=80,BLKSIZE=3120,DSORG=PO) //OPTIONS DD *,SYMBOLS=JCLONLY **These variables are substituted** + AHJOB = '&HOSTHLQ..D&DATE6..T&TIME6..&DESTIN..AHJOB' + CALL BPXWDYN "ALLOC DD(AHJOB) DA("AHJOB") SHR REUSE" Destin = '&DESTIN' Package = '&PKGID' OUTRBAK = '&OUTRBAK' From 2c4831490a3947f968ea89cb2dae53b803f44694 Mon Sep 17 00:00:00 2001 From: Joseph Walther Date: Thu, 3 Apr 2025 08:00:45 -0500 Subject: [PATCH 4/4] Update to C1BMXIN to cover more diverse situations --- .../C1BMXIN.skl | 112 +++++++++--------- 1 file changed, 54 insertions(+), 58 deletions(-) diff --git a/endevor/Package-Shipping-Model-and-Script-Examples/C1BMXIN.skl b/endevor/Package-Shipping-Model-and-Script-Examples/C1BMXIN.skl index d4f96ba..bb78809 100644 --- a/endevor/Package-Shipping-Model-and-Script-Examples/C1BMXIN.skl +++ b/endevor/Package-Shipping-Model-and-Script-Examples/C1BMXIN.skl @@ -1,15 +1,5 @@ )CM Capture Package shipping variables for JCL substitutions -)REXX HOSTHLQ VDDHSPFX RMOTHLQ VDDRSPFX SHIPPER SYSUID SENDNODE - TRACE Off - WHEREAMI = 'C1BMXIN' - HOSTHLQ = Strip(VDDHSPFX) - If HOSTHLQ = '' then HOSTHLQ = USERID() - RMOTHLQ = Strip(VDDRSPFX) - If RMOTHLQ = '' then RMOTHLQ = USERID() - SHIPPER = USERID() - SYSUID = USERID() - SENDNODE = SYSVAR(SYSNODE) -)ENDREXX +)CM Choose which )REXX ... )ENDREXX sections work for you )CM ---------- )CM ---------- Get Package, Destination and pkg/Bko values )REXX VNBSQDSP PKGID DESTIN TYPRUN OUTRBAK VDDXNODE NODENAME @@ -24,45 +14,8 @@ NODENAME = REXALDST(DESTIN) )ENDREXX )CM ---------- -)CM ---------- Get Transmission method, Host and Remote HLQ values -)REXX DESTIN HOSTHLQ RMOTHLQ XMITMETH - Trace Off - WHEREAMI = 'C1BMXIN' - - CALL BPXWDYN "ALLOC DD(BSTIPT01) ", - "LRECL(0080) BLKSIZE(0800) SPACE(5,5) ", - "RECFM(F,B) TRACKS NEW UNCATALOG REUSE "; - Queue "LIST DESTINATION" DESTIN "TO FILE CSVALDST ", - "OPTIONS NOCSV ." - "EXECIO 1 DISKW BSTIPT01 (Finis" - - CALL BPXWDYN "ALLOC DD(CSVALDST) ", - " LRECL(1800) BLKSIZE(3600) SPACE(5,5) DSORG(PS) ", - " RECFM(F,B) TRACKS NEW UNCATALOG REUSE "; - CALL BPXWDYN "ALLOC DD(BSTERR) LRECL(133) BLKSIZE(13300) ", - " DSORG(PS) SPACE(1,1) RECFM(F,B) TRACKS ", - " NEW UNCATALOG REUSE "; - CALL BPXWDYN "ALLOC DD(C1MSGS1) LRECL(133) BLKSIZE(13300) ", - " DSORG(PS) SPACE(1,1) RECFM(F,B) TRACKS ", - " NEW UNCATALOG REUSE "; - - ADDRESS LINK 'BC1PCSV0' ; /* Call CSV utility */ - - "EXECIO * DISKR CSVALDST ( Stem apiDestinations. FINIS" - - CALL BPXWDYN "FREE DD(BSTIPT01) " - CALL BPXWDYN "FREE DD(CSVALDST) " - CALL BPXWDYN "FREE DD(BSTERR) " - CALL BPXWDYN "FREE DD(C1MSGS1)" - If apiDestinations.0 = 0 then EXIT(12) - Destination= Strip(Substr(apiDestinations.1,013,07)) - HOSTHLQ = Strip(Substr(apiDestinations.1,079,14)) - RMOTHLQ = Strip(Substr(apiDestinations.1,113,14)) - XMITMETH = Strip(Substr(apiDestinations.1,051,11)) -)ENDREXX -)CM ---------- )CM ---------- Get Date and Time variables from VNBCPARM -)REXX VNBCPARM DATE6 TIME6 DATE8 TIME8 NEXTJOB +)REXX VNBCPARM DATE6 TIME6 DATE8 TIME8 NEXTJOB SHIPPER SYSUID SENDNODE TRACE Off WHEREAMI = 'C1BMXIN' NEXTJOB = SUBMITER || '@' @@ -70,6 +23,19 @@ DATE6 = Substr(DATE8,3) TIME8 = Strip(TIME8) TIME6 = Substr(TIME8,1,6) + SHIPPER = USERID() + SYSUID = USERID() + SENDNODE = SYSVAR(SYSNODE) +)ENDREXX +)CM ---------- +)CM ---------- HOSTHLQ and RMOTHLQ from VDDHSPFX and VDDRSPFX +)CM ---------- You may elect to hard-code these values, or +)CM ---------- to use the CSVCALL step below. Only 1 method is needed. +)REXX HOSTHLQ VDDHSPFX RMOTHLQ VDDRSPFX + TRACE ?r + WHEREAMI = 'C1BMXIN' + HOSTHLQ = Strip(VDDHSPFX) + RMOTHLQ = Strip(VDDRSPFX) )ENDREXX )CM ---------- This section shows accessing Site-Specific variables )CM ---------- Longer variable names must be assigned to @@ -109,6 +75,21 @@ )CM &VNBSQDSP //* *==============================================================* * +)SEL &HOSTHLQ EQ &Z +//* *==============================================================* * +//* CALL CSV to get HOSTHLQ, RMOTHLQ and XMITMETH values ** +//* *==============================================================* * +//CSVCALL EXEC PGM=NDVRC1,PARM='BC1PCSV0' +)IM C1BMXLIB +//BSTIPT01 DD * + LIST DESTINATION &DESTIN TO FILE CSVPKGE OPTIONS NOCSV . +//C1MSGS1 DD SYSOUT=* +//BSTERR DD SYSOUT=* +//CSVPKGE DD DSN=&&&&CSVFILE,DISP=(NEW,PASS), +// UNIT=SYSDA,SPACE=(TRK,(5,5)), +// DCB=(RECFM=FB,LRECL=133,BLKSIZE=13300) +)ENDSEL &HOSTHLQ EQ &Z +//* *==============================================================* * //* *==============================================================* * //* *= Substitute variables in the Remote JCL ===============* * //* *==============================================================* * @@ -118,10 +99,29 @@ * MODEL TBLOUT AHJOB AHJOB C1BMXFTC C1BMXFTC -//C1BMXFTC DD DSN=&&XFTC,DISP=(OLD,PASS) +//C1BMXFTC DD DSN=&&&&XFTC,DISP=(OLD,PASS) +)SEL &HOSTHLQ EQ &Z +//APILIST DD DSN=&&&&CSVFILE,DISP=(OLD,DELETE) +//OPTIONS DD *,SYMBOLS=JCLONLY **These variables are substituted** +* Get Destination information from CSVCALL step above + "EXECIO * DISKR APILIST ( Stem apiDestinations. FINIS" + If apiDestinations.0 = 0 then EXIT(12) + Destination= Strip(Substr(apiDestinations.1,013,07)) + HOSTHLQ = Strip(Substr(apiDestinations.1,079,14)) + RMOTHLQ = Strip(Substr(apiDestinations.1,113,14)) + XMITMETH = Strip(Substr(apiDestinations.1,051,11)) + Say 'HOSTHLQ=' HOSTHLQ ' RMOTHLQ=' RMOTHLQ + Say 'XMITMETH=' XMITMETH +)ENDSEL &HOSTHLQ EQ &Z +)SEL &HOSTHLQ NE &Z //OPTIONS DD *,SYMBOLS=JCLONLY **These variables are substituted** - AHJOB = '&HOSTHLQ..D&DATE6..T&TIME6..&DESTIN..AHJOB' + HOSTHLQ = '&HOSTHLQ' + RMOTHLQ = '&RMOTHLQ' +)ENDSEL &HOSTHLQ NE &Z +* Allocate AHJOB for input and output + AHJOB = HOSTHLQ'.D&DATE6..T&TIME6..&DESTIN..AHJOB' CALL BPXWDYN "ALLOC DD(AHJOB) DA("AHJOB") SHR REUSE" +* Other collected variables..... Destin = '&DESTIN' Package = '&PKGID' OUTRBAK = '&OUTRBAK' @@ -130,13 +130,9 @@ TIME6 = '&TIME6' SHIPPER = '&SHIPPER' NODENAME = '&NODENAME' - HOSTHLQ = '&HOSTHLQ' - RMOTHLQ = '&RMOTHLQ' - XMITMETH = '&XMITMETH' - Say 'XMITMETH=' XMITMETH - HOSTLIBS = '&HOSTHLQ..D&DATE6..T&TIME6..&DESTIN' - RMOTLIBS = '&RMOTHLQ..D&DATE6..T&TIME6..&DESTIN' - Say 'HOSTLIBS='HOSTLIBS ; Say 'RMOTLIBS='RMOTLIBS + HOSTLIBS = HOSTHLQ'.D&DATE6..T&TIME6..&DESTIN' + RMOTLIBS = RMOTHLQ'.D&DATE6..T&TIME6..&DESTIN' +* Say 'HOSTLIBS='HOSTLIBS ; Say 'RMOTLIBS='RMOTLIBS * DEV2 only C1SUBSYS = '&MYSUBSYS' //SYSEXEC DD DISP=SHR,DSN=&CSIQCLS0