cl

pts.
Tags:
CL
i have created a file member AA20081224 using addpfm.The file members will get created on a daily basis with that particular date appended to AA. I need a code that will check on a daily basis if there are file members that are more than 3 months old and purge all members except for the one generated that particular date.

Answer Wiki

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

You’ve already got code to crerate a member name that’s one day old

http://itknowledgeexchange.techtarget.com/itanswers/cl-3/

Here is logic for what you want
1. get system date
2. substring into cc mm dd yy
3/ convert mm and dd to dec
3. subtract 3 from mmd
4 If mmd is less than 1
subtract 1 from yyd, adding 12 to mmd
5 convert ccd and mmd to cc and mm
6 build the member name string

7 get a list of members
use DSPFD
TYPE > *MBRLIST
OUTPUT > *OUTFILE
provide a filename and library for the temp file
8. in the declaration section dclf yourOutfile from 7
9. loop:
RECV < — this reads a record
MONMSG CPF0864 EXEC(GOTO EOF) <– watches for end of file
10. If ( &memberNameFileFromFile < NameFromStep6)
RMVM ( yourfile &memberNameFileFromFile)
11. goto loop
12 EOF: ENDPGM

Note, inorder to compile this program a copy of the file from step 7 must exist in your library list.

Discuss This Question: 5  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
  • I tried doing thsi..not sure if this is right approach ADDPFM FILE(SAAPH) MBR(&MEMNAM) CHGVAR VAR(&COUNT) VALUE(&COUNT+1) IF COND(&COUNT *GT 90) THEN(DO) IF COND(&COUNT *GT 90) THEN(DO) CHGVAR VAR(&COUNT) VALUE(0) RMVM FILE(SAAPAH) MBR(*ALL) ---------------------------here i need to retain the member generated currently,,,, how do i do that..........is there any other logic
    0 pointsBadges:
    report
  • the below code was a bad logic....the count will always remain1 during every run...just so confused :)
    0 pointsBadges:
    report
  • Gilly400
    Hi, You'll need to get a list of members to process. You can do this by using DSPFD to an output file, selecting the member list as the type of information. Then you can read your output file into your CL program and check whether the date is older than 3 months, if it is, then you can remove that particular member with RMVM. First establish your cutoff date - retrieve the current system date into a variable, substring the variable into separate year, month and day variables. subtract 3 from your month field, if your month field is less than 1, add 12 to your month and subtract 1 from your year. Now concatenate the year, month and date back together to give you your cutoff date. Concatenate your member name for the cutoff date ('AA' + cutoff date). Read your DSPFD output file, if the member name in the file is less than your member name with the cutoff date then you can remove it. Regards, Martin Gilbert.
    23,730 pointsBadges:
    report
  • can this be developed using a cl code...because iam in the middle of a cl code where i have already built the member name.
    0 pointsBadges:
    report
  • Gilly400
    Hi, Yes, all of my previous posting can be done in CL - no need for any other programming languages. Regards, Martin Gilbert.
    23,730 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