I have written an RPGLE program that deletes files in certain IFS folders that are older than a given date (the retention period for each folder is held in a control file).
For each folder it uses the QShell LS (List) command as below to list all files, sorted by last modified date and outputting to a file:
The result looks like below:
I know the date columns vary depending on the length of the owner names and I have extracted the date and filename with no problem until now.
As far as I was aware during my testing, the date format shows as Month + Day + Year if the file is for a previous year and Month + Day + Time if it's for the current year.
In test, everything worked fine, but in this folder there is something weird going on.
Prior to 18th July 2022 the files show correctly with the year, but from the 18th onwards they all show the timestamp, so my date formatting assumes that this is 2023 not 2022.
This is totally unexpected. Is there something maybe I am not aware of with the List command and the way it outputs the dates?
We are running on A7.1 (in the process of undating to A7.3) so it might possibly be a bug?
Yes I know I could have written this differently, but some folders have hundreds of temporary files in them and we want an audit process.
Using the List command I can retrieve a list of the files in 1 single folder by date and when I come to one that has a more recent date than the cutoff, I ignore the rest of the files.
For each folder it uses the QShell LS (List) command as below to list all files, sorted by last modified date and outputting to a file:
Code:
STRQSH CMD('ls -ltr /foldername >/qsys.lib/DATALIBR.lib/prgifswkfi.file/prgifswkfi.mbr')
Code:
-rwxrwxrwx 1 FOWNER 0 343990 Jul 14 2022 20220714.txt -rwxrwxrwx 1 FOWNER 0 243145 Jul 15 2022 20220715.txt -rwxrwxrwx 1 FOWNER 0 60576 Jul 16 2022 20220716.txt -rwxrwxrwx 1 FOWNER 0 18959 Jul 17 2022 20220717.txt -rwxrwxrwx 1 FOWNER 0 388469 Jul 18 20:41 20220718.txt -rwxrwxrwx 1 FOWNER 0 340068 Jul 19 21:45 20220719.txt -rwxrwxrwx 1 FOWNER 0 285709 Jul 20 17:53 20220720.txt -rwxrwxrwx 1 FOWNER 0 287966 Jul 21 21:56 20220721.txt
As far as I was aware during my testing, the date format shows as Month + Day + Year if the file is for a previous year and Month + Day + Time if it's for the current year.
In test, everything worked fine, but in this folder there is something weird going on.
Prior to 18th July 2022 the files show correctly with the year, but from the 18th onwards they all show the timestamp, so my date formatting assumes that this is 2023 not 2022.
This is totally unexpected. Is there something maybe I am not aware of with the List command and the way it outputs the dates?
We are running on A7.1 (in the process of undating to A7.3) so it might possibly be a bug?
Yes I know I could have written this differently, but some folders have hundreds of temporary files in them and we want an audit process.
Using the List command I can retrieve a list of the files in 1 single folder by date and when I come to one that has a more recent date than the cutoff, I ignore the rest of the files.
Comment