CL problem with purge

pts.
Tags:
CL
CL programming
The below code was written to automatically purge files once in 2 months.The problem here is that there are months with 30,31 and 28 days so while deletion some files may be left out.Can this be rectified. CHGVAR VAR(&PYD) VALUE(&PYC) CHGVAR VAR(&PMD) VALUE(&PMC) CHGVAR VAR(&PDD) VALUE(&PDC) CHGVAR VAR(&PMD) VALUE(&PMD-2) IF COND(&PMD *LT 1) THEN(DO) CHGVAR VAR(&PYD) VALUE(&PYD-1) CHGVAR VAR(&PMD) VALUE(&PMD+12) ENDDO CHGVAR VAR(&PYC) VALUE(&PYD) CHGVAR VAR(&PMC) VALUE(&PMD) CHGVAR VAR(&FILEPU) VALUE(&PCC *TCAT &PYC *TCAT &PMC *TCAT &PDC) LOOP: RCVF MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(EOF)) CHGVAR VAR(&STRF) VALUE(%SST(&SAPURG 26 29)) CHGVAR VAR(&APINVF) VALUE(%SST(&SAPURG 2 19)) CHGVAR VAR(&APINVD) VALUE(%SST(&SAPURG 7 8)) CHGVAR VAR(&LNKFLNAM) VALUE('APINV/' *TCAT &APINVF) IF COND(&STRF *NE 'STMF') THEN(DO) GOTO CMDLBL(LOOP) ENDDO IF COND(&APINVD *LE &FILEPU) THEN(DO) RMVLNK OBJLNK(&LNKFLNAM) GOTO CMDLBL(LOOP)

Answer Wiki

Thanks. We'll let you know when a new response is added.

I don’t think they will be left out
When &FILEPU = 1090301 it would delete all entries from all previous months and years because you are using Less Than or Equal to logic

IF COND(&APINVD *LE &FILEPU) THEN(DO)

Some might stay on the system for 61 days and others for 58 or so before they are deleted. You asked for 2 months not 60 days.

Phil

Discuss This Question: 4  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Gilly400
    Hi, You're using *LE (Less than or Equal to) so anything older should also be removed. For example if the date is 1 March anything before 1 January should be removed, You should end up with 2 months data to the day so the number of days' data will vary depending on the 2 months that re being kept. Regards, Martin Gilbert.
    23,730 pointsBadges:
    report
  • philpl1jb
    Oh -- if you run this Feb 28th you want to remove - Dec 31 .. So I think you want to set the day part of the date &PDC to a high value like 31??? Phil
    51,355 pointsBadges:
    report
  • My problem is that a txt file may get created on 31 jan as abc20090131.Now when the purging logic does a minus 3(3 months) to the month and adds 12 on APril 30 so the file refered will be abc20090130 and abc20090131 will remain in the system longer.I was forced to use *LE because of this but i would like to use *eq and the files to be deleted promptly.
    0 pointsBadges:
    report
  • philpl1jb
    If you're running this for the end of the month then set the day part of the date, &PDC, to a high value like 31??? CHGVAR VAR(&PMC) VALUE(&PMD) CHGVAR VAR(&PDC) VALUE('31') <-- new line of code CHGVAR VAR(&FILEPU) VALUE(&PCC *TCAT &PYC *TCAT &PMC *TCAT &PDC) Phil
    51,355 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following