272
272
- Job status `SYS` indicates a system failure.
273
273
- Job status `?` indicates status can not be determined.
274
274
- Job status `TYPRUN=SCAN` indicates that the job had the TYPRUN parameter with SCAN option.
275
- - Job status `NOEXEC` indicates that the job had the TYPRUN parameter with COPY option.
275
+ - Job status `TYPRUN=COPY` indicates that the job had the TYPRUN parameter with COPY option.
276
+ - Job status `HOLD` indicates that the job had the TYPRUN parameter with either the HOLD or JCLHOLD options.
276
277
- Jobs where status can not be determined will result in None (NULL).
277
278
type: str
278
279
sample: AC
@@ -1116,8 +1117,9 @@ def run_module():
1116
1117
result ["execution_time" ] = job_output_txt [0 ].get ("execution_time" )
1117
1118
1118
1119
result ["duration" ] = duration
1120
+ job_msg = job_output_txt [0 ].get ("ret_code" , {}).get ("msg" )
1119
1121
1120
- if duration >= wait_time_s :
1122
+ if duration >= wait_time_s and job_msg != "HOLD" :
1121
1123
result ["failed" ] = True
1122
1124
result ["changed" ] = False
1123
1125
_msg = ("The JCL submitted with job id {0} but appears to be a long "
@@ -1161,19 +1163,13 @@ def run_module():
1161
1163
job_ret_code .update ({"msg_txt" : _msg })
1162
1164
raise Exception (_msg )
1163
1165
1164
- if job_ret_code_code is not None and job_ret_code_msg == 'NOEXEC' :
1165
- job_dd_names = job_output_txt [0 ].get ("ddnames" )
1166
- jes_jcl_dd = search_dictionaries ("ddname" , "JESJCL" , job_dd_names )
1167
- # These are the conditions for a job run with TYPRUN=COPY.
1168
- if not jes_jcl_dd :
1169
- job_ret_code .update ({"msg" : "TYPRUN=COPY" })
1170
- _msg = ("The job was run with TYPRUN=COPY. "
1171
- "This way, the steps are not executed, but the JCL is validated and stored "
1172
- "in the JES spool. "
1173
- "Please review the job log for further details." )
1174
- job_ret_code .update ({"msg_txt" : _msg })
1175
-
1176
- if job_ret_code_code is None or job_ret_code .get ("msg" ) == 'NOEXEC' :
1166
+ if job_ret_code_msg == 'HOLD' :
1167
+ _msg = ("The job was run with TYPRUN=HOLD or TYPRUN=JCLHOLD "
1168
+ "to request special job processing. This will result in no completion, "
1169
+ "no return code, no job steps and changed will be set to false." )
1170
+ job_ret_code .update ({"msg_txt" : _msg })
1171
+ is_changed = False
1172
+ elif job_ret_code_code is None and job_ret_code .get ("msg" ) == 'NOEXEC' :
1177
1173
# If there is no job_ret_code_code (Job return code) it may NOT be an error,
1178
1174
# some jobs will never return have an RC, eg Started tasks(which are not supported),
1179
1175
# so further analyze the
@@ -1183,21 +1179,21 @@ def run_module():
1183
1179
jes_jcl_dd = search_dictionaries ("ddname" , "JESJCL" , job_dd_names )
1184
1180
1185
1181
# Its possible jobs don't have a JESJCL which are active and this would
1186
- # cause an index out of range error .
1182
+ # mean the job had TYPRUN=COPY .
1187
1183
if not jes_jcl_dd :
1188
- _msg_detail = " for status {0}." .format (job_ret_code_msg ) if job_ret_code_msg else "."
1189
- _msg = ("The job return code was not available in the job log, "
1190
- "please review the job log{0}" .format (_msg_detail ))
1184
+ job_ret_code .update ({"msg" : "TYPRUN=COPY" })
1185
+ _msg = ("The job was run with TYPRUN=COPY. "
1186
+ "This way, the steps are not executed, but the JCL is validated and stored "
1187
+ "in the JES spool. "
1188
+ "Please review the job log for further details." )
1191
1189
job_ret_code .update ({"msg_txt" : _msg })
1192
- raise Exception (_msg )
1193
-
1194
- jes_jcl_dd_content = jes_jcl_dd [0 ].get ("content" )
1195
- jes_jcl_dd_content_str = " " .join (jes_jcl_dd_content )
1196
- # The regex can be r"({0})\s*=\s*(COPY|HOLD|JCLHOLD|SCAN)" once zoau support is in.
1197
- special_processing_keyword = re .search (r"({0})\s*=\s*(SCAN)"
1198
- .format ("|" .join (JOB_SPECIAL_PROCESSING )), jes_jcl_dd_content_str )
1190
+ else :
1191
+ jes_jcl_dd_content = jes_jcl_dd [0 ].get ("content" )
1192
+ jes_jcl_dd_content_str = " " .join (jes_jcl_dd_content )
1193
+ # The regex can be r"({0})\s*=\s*(COPY|HOLD|JCLHOLD|SCAN)" once zoau support is in.
1194
+ special_processing_keyword = re .search (r"({0})\s*=\s*(SCAN)"
1195
+ .format ("|" .join (JOB_SPECIAL_PROCESSING )), jes_jcl_dd_content_str )
1199
1196
1200
- if job_ret_code_msg == 'NOEXEC' :
1201
1197
job_ret_code .update ({"msg" : special_processing_keyword [0 ]})
1202
1198
job_ret_code .update ({"code" : None })
1203
1199
job_ret_code .update ({"msg_code" : None })
@@ -1206,19 +1202,17 @@ def run_module():
1206
1202
"return code or job steps and changed will be false."
1207
1203
.format (job_submitted_id , special_processing_keyword [0 ])})
1208
1204
is_changed = False
1209
- else :
1210
- # The job_ret_code_code is None at this point, but the job_ret_code_msg_code could be populated
1211
- # so check both and provide a proper response.
1205
+ elif job_ret_code_code is None :
1206
+ # The job_ret_code_code is None at this point, but the job_ret_code_msg_code could be populated
1207
+ # so check both and provide a proper response.
1212
1208
1213
- if job_ret_code_msg_code is None :
1214
- _msg_detail = " for status {0}." .format (job_ret_code_msg ) if job_ret_code_msg else "."
1215
- _msg = ("The job return code was not available in the job log, "
1216
- "please review the job log{0}" .format (_msg_detail ))
1217
- job_ret_code .update ({"msg_txt" : _msg })
1218
- raise Exception (_msg )
1209
+ if job_ret_code_msg_code is None :
1210
+ _msg_detail = " for status {0}." .format (job_ret_code_msg ) if job_ret_code_msg else "."
1211
+ _msg = ("The job return code was not available in the job log, "
1212
+ "please review the job log{0}" .format (_msg_detail ))
1213
+ job_ret_code .update ({"msg_txt" : _msg })
1214
+ raise Exception (_msg )
1219
1215
1220
- # raise Exception("The job return code was not available in the job log, "
1221
- # "please review the job log and error {0}.".format(job_ret_code_msg))
1222
1216
elif job_ret_code_code != 0 and max_rc is None :
1223
1217
_msg = ("The job return code {0} was non-zero in the "
1224
1218
"job output, this job has failed." .format (str (job_ret_code_code )))
0 commit comments