@@ -106,31 +106,10 @@ export class BundleDeployer {
106
106
* @memberof BundleDeployer
107
107
*/
108
108
private getDeployJCL ( ) : string {
109
- // Deploy actions begin by first undeploying any former version of the
110
- // Bundle that may still be installed, so generate an undeploy statement
111
- // first.
112
- let jcl = this . generateUndeployJCLWithoutTerminator ( ) ;
113
-
114
- jcl = jcl + "*\n" ;
115
-
116
- // Now generate the deploy statement.
117
- jcl = jcl + this . wrapLongLineForJCL ( "DEPLOY BUNDLE(" + this . params . arguments . name + ")\n" ) +
118
- this . wrapLongLineForJCL ( " BUNDLEDIR(" + this . params . arguments . bundledir + ")\n" ) +
119
- this . wrapLongLineForJCL ( " SCOPE(" + this . params . arguments . scope + ")\n" ) +
120
- this . wrapLongLineForJCL ( " STATE(AVAILABLE)\n" ) ;
121
-
122
- if ( this . params . arguments . timeout !== undefined ) {
123
- jcl = jcl + this . wrapLongLineForJCL ( " TIMEOUT(" + this . params . arguments . timeout + ")\n" ) ;
124
- }
125
- if ( this . params . arguments . csdgroup !== undefined ) {
126
- jcl = jcl + this . wrapLongLineForJCL ( " CSDGROUP(" + this . params . arguments . csdgroup + ");\n" ) ;
127
- }
128
- if ( this . params . arguments . resgroup !== undefined ) {
129
- jcl = jcl + this . wrapLongLineForJCL ( " RESGROUP(" + this . params . arguments . resgroup + ");\n" ) ;
130
- }
131
-
132
- // finally add a terminator
133
- jcl = jcl + "/*\n" ;
109
+ const jcl = this . generateCommonJCLHeader ( ) +
110
+ this . wrapLongLineForJCL ( "DEPLOY BUNDLE(" + this . params . arguments . name + ")\n" ) +
111
+ this . wrapLongLineForJCL ( " BUNDLEDIR(" + this . params . arguments . bundledir + ")\n" ) +
112
+ this . generateCommonJCLFooter ( "AVAILABLE" ) ;
134
113
135
114
return jcl ;
136
115
}
@@ -142,29 +121,31 @@ export class BundleDeployer {
142
121
* @memberof BundleDeployer
143
122
*/
144
123
private getUndeployJCL ( ) : string {
145
- // Get the basicundeploy JCL
146
- let jcl = this . generateUndeployJCLWithoutTerminator ( ) ;
147
-
148
- // finally add a terminator
149
- jcl = jcl + "/*\n" ;
124
+ const jcl = this . generateCommonJCLHeader ( ) +
125
+ this . wrapLongLineForJCL ( "UNDEPLOY BUNDLE(" + this . params . arguments . name + ")\n" ) +
126
+ this . generateCommonJCLFooter ( "DISCARDED" ) ;
150
127
151
128
return jcl ;
152
129
}
153
130
154
- // Generate the JCL for undeploy, but without terminating the stream
155
- private generateUndeployJCLWithoutTerminator ( ) : string {
156
- let jcl = this . params . arguments . jobcard + "\n" +
131
+ private generateCommonJCLHeader ( ) : string {
132
+ const jcl = this . params . arguments . jobcard + "\n" +
157
133
"//DFHDPLOY EXEC PGM=DFHDPLOY,REGION=100M\n" +
158
134
"//STEPLIB DD DISP=SHR,DSN=" + this . params . arguments . cicshlq + ".SDFHLOAD\n" +
159
135
"// DD DISP=SHR,DSN=" + this . params . arguments . cpsmhlq + ".SEYUAUTH\n" +
160
136
"//SYSTSPRT DD SYSOUT=*\n" +
161
137
"//SYSIN DD *\n" +
162
138
"*\n" +
163
139
this . wrapLongLineForJCL ( "SET CICSPLEX(" + this . params . arguments . cicsplex + ");\n" ) +
164
- this . wrapLongLineForJCL ( "*\n" ) +
165
- this . wrapLongLineForJCL ( "UNDEPLOY BUNDLE(" + this . params . arguments . name + ")\n" ) +
166
- this . wrapLongLineForJCL ( " SCOPE(" + this . params . arguments . scope + ")\n" ) +
167
- this . wrapLongLineForJCL ( " STATE(DISCARDED)\n" ) ;
140
+ this . wrapLongLineForJCL ( "*\n" ) ;
141
+
142
+ return jcl ;
143
+ }
144
+
145
+ private generateCommonJCLFooter ( targetState : string ) : string {
146
+ let jcl =
147
+ this . wrapLongLineForJCL ( " SCOPE(" + this . params . arguments . scope + ")\n" ) +
148
+ this . wrapLongLineForJCL ( " STATE(" + targetState + ")\n" ) ;
168
149
169
150
if ( this . params . arguments . timeout !== undefined ) {
170
151
jcl = jcl + this . wrapLongLineForJCL ( " TIMEOUT(" + this . params . arguments . timeout + ")\n" ) ;
@@ -176,10 +157,12 @@ export class BundleDeployer {
176
157
jcl = jcl + this . wrapLongLineForJCL ( " RESGROUP(" + this . params . arguments . resgroup + ");\n" ) ;
177
158
}
178
159
160
+ // finally add a terminator
161
+ jcl = jcl + "/*\n" ;
162
+
179
163
return jcl ;
180
164
}
181
165
182
-
183
166
private async createZosMFSession ( ) : Promise < any > {
184
167
// Create a zosMF session
185
168
const zosmfProfile = this . params . profiles . get ( "zosmf" ) ;
0 commit comments