ansible-for-i
ansible-for-i copied to clipboard
ibmi_spooled_file_data it should send all spools of same name in the parameters
Normally in Our daily activities we need to see multiple reports generated by a job. Current parameters list of ibmi_spooled_file_data module does contain spool name but it can select only 1 spool. There is spool number parameter but Many a times we don't know number of spools generated by a job. In this case ibmi_spooled_file_data Module is not able to send all spools with specific name
ibmi_spooled_file_data module always send the latest splf for a job, which may meet most of the case, but as you said, there may multi-spooled files generated. For this case, I actually don't want to make a big loop inside the module. As a solution, playbook should do more logic base on modules. E.g.,
ibmi_cl_command module could get a list of the spooled file of a job by running "ansible mysystem - m ibmi_cl_command -a "WRKSPLF SELECT(*ALL) JOB(005837/CHANGLE/QPRTJOB)", which contains the spooled number of a specific job, "stdout_lines": [ " 5770SS1 V7R4M0 190621 Work With All Spooled Files DB2MB1PA 8/31/21 1:10:55 CDT Page 1", " Last Spooled", " Device or Total Cur Creation Creation File Used File", " File User Queue User Data Sts Pages Page Copy Form Type Pty Date Time Nbr Job Number Queue Library ASP Date Size (K)", " QPJOBLOG CHANGLE QPRINT QZRCSRVS RDY 3 1 *STD 5 06/08/21 02:38:36 28 QPRTJOB 005837 QPRINT QGPL 1 06/08/21 44", " QPJOBLOG CHANGLE QPRINT QZRCSRVS RDY 3 1 *STD 5 06/08/21 02:41:49 29 QPRTJOB 005837 QPRINT QGPL 1 06/08/21 44", " QPJOBLOG CHANGLE QPRINT QZRCSRVS RDY 3 1 *STD 5 06/08/21 02:44:37 30 QPRTJOB 005837 QPRINT QGPL 1 06/08/21 44", " QPJOBLOG CHANGLE QPRINT QZRCSRVS RDY 3 1 *STD 5 06/08/21 02:44:48 31 QPRTJOB 005837 QPRINT QGPL 1 06/08/21 44", " QPRTLIBL CHANGLE QPRINT RDY 1 1 *STD 5 06/30/21 02:36:00 32 QPRTJOB 005837 QPRINT QGPL 1 06/30/21 28", " QPRTLIBL CHANGLE QPRINT RDY 1 1 *STD 5 06/30/21 02:36:54 33 QPRTJOB 005837 QPRINT QGPL 1 06/30/21 28", " QPRTLIBL CHANGLE QPRINT RDY 1 1 *STD 5 06/30/21 02:40:41 34 QPRTJOB 005837 QPRINT QGPL 1 06/30/21 28", " QPRTLIBL CHANGLE QPRINT RDY 1 1 *STD 5 07/08/21 19:23:41 35 QPRTJOB 005837 QPRINT QGPL 1 07/08/21 28", " QPRTSPLF CHANGLE QPRINT 0000006678 HLD 0 1 *STD 5 08/31/21 01:10:55 41 QPRTJOB 005837 QPRINT QGPL 1 08/31/21 0", " * * * * * E N D O F L I S T I N G * * * * *" ]
Then run the ibmi_spooled_file_data module with the spooled file number.
Thank you. This has helped. But getting the spool file numbers from WRKSPLF output is not straight forward.
- I took wrksplf lines in a list,
- then reduced this list to remove header lines from output of wrksplf
- prepare another list to store file number by substring from 103 to 106 position
- looped the spool extraction task on this list of file number
I got the results but I think that there must be some other easy way. Any idea for me?
At lease for now, I don't have a more easy way in my mind to get the number programmatically. I will continue to investigate to see if I can find anything helpful