Reading all pfs in production lib. using cl pgm

1485 pts.
Tags:
CL programs
CL/400
DSPFD
RGZPFM
Dear all,

I want to write a cl program under following scenario.

1. Use the command DSPFD to build a list of files existing in LIBA.(which is Prod Lib.) 2. Read the file. 3. Use Command RGZPFM to reorganize Every File that has more than 1000 deleted records Run the job and then DSPFD again to check your results.

Its urgent task,please help me with required code in cl/400 to do this task.

.Thanks

 

 

\



Software/Hardware used:
AS/400 -CL programming

Answer Wiki

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

There are some websites where you can download codef or free that will do what you want.to do.
Check this out.

http://www.help400.de/Eng/Freeware.htm

There is even a link on this site to Tom Liotta’s site

Discuss This Question: 11  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
  • HMSSL2K
    You should try to write it yourself first, if not you will never lean how to do it. Then if you have problems post your code here and we can help you.
    3,175 pointsBadges:
    report
  • Splat
    One suggestion: DSPFD FILE([library]/*ALL) TYPE(*MBRLIST) OUTPUT(*OUTFILE) will provide you an output file with the relevant record counts.
    6,795 pointsBadges:
    report
  • TomLiotta
    Use Command RGZPFM to reorganize Every File that has more than 1000 deleted records This is a very risky thing to do. It is possible that the program shouldn't be run. If we don't know details of the system and of the files involved, there's no way to know if a file should be reorganized. The process might be run on a system because space is tight, and a file that is too big to be reorganized might be selected. The file might even be used by relative record number. When the application database is so old that it doesn't automatically reuse deleted record space, anything is possible. Other methods should be investigated first. Tom
    125,585 pointsBadges:
    report
  • 6r
    Dear all I tried to write following CL program to reorganize all files in production lib. but when I run his program by submitting in qbatch ,it never completes and comes in Lock wait(LCKW) status ,which i knew when i did wrkactjob,one of my friend advised to use alcobj command but it will skip to reorganize to those files which are being locked by other programs in system. I am producing both program here with alcobj and without alcobj. my main motto is to rgzpfm all files in prod lib lets say its LIBA. 1) without using alcobj:- pgm DCL VAR(&MSG) TYPE(*CHAR) LEN(132) VALUE('file not reorganized') DCLF FILE(lLIBA/F2) MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(END)) DSPFD FILE(LIBA/*ALL) TYPE(*MBRLIST) + OUTPUT(*OUTFILE) FILEATR(*PF) + OUTFILE(LIBB/F2) LEVEL1: RCVF RCDFMT(QWHFDML) MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(END)) IF COND((&MLFTYP *EQ 'P') *AND (&MLNDTR *GT + 1000)) THEN(DO) RGZPFM FILE(LIBA/&MLFILE) MBR(&MLNAME) MONMSG MSGID(CPF9820 CPF2981 CPF3135) + EXEC(SNDPGMMSG MSG(&MSG) TOMSGQ(QSYSOPR)) enddo GOTO CMDLBL(LEVEL1) END: ENDPGM Note:- This program is going in Lockwait(LCKW) and the submited job never gets completed. 2) with the use of ALCOBJ :- pgm DCL VAR(&MSG) TYPE(*CHAR) LEN(132) VALUE('file not reorganized') DCLF FILE(JKJK1/F2) MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(END)) DSPFD FILE(lLIBA/*ALL) TYPE(*MBRLIST) + OUTPUT(*OUTFILE) FILEATR(*PF) + OUTFILE(LIBB/F2) LEVEL1: RCVF RCDFMT(QWHFDML) MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(END)) IF COND((&MLFTYP *EQ 'P') *AND (&MLNDTR *GT + 1000)) THEN(DO) ALCOBJ OBJ((LIBA/&MLFILE *FILE *SHRRD)) WAIT(10) MONMSG MSGID(CPF1002 CPF1085) EXEC(DO) GOTO CMDLBL(LEVEL1) ENDDO RGZPFM FILE(LIBA/&MLFILE) MBR(&MLNAME) MONMSG MSGID(CPF9820 CPF2981 CPF3135) + EXEC(SNDPGMMSG MSG(&MSG) TOMSGQ(QSYSOPR)) enddo GOTO CMDLBL(LEVEL1) END: ENDPGM Note:- this program runs for around 15 mins and completes successfully after submitting in qbatch. It also reorganize File F2 which is having all the physical files of production Lib.A .i checked the size of F2 before running this second program(ALCOBJ) and after running this pgm. I found that size of f2 got reduced. But this program simply avoids reorganize all the physical files which are being used by other system program at the same time.however I have been running this job in test env. only but what should i do to reorganize all pfs in prod lib. even if at the same time they are being used by other jobs as well. This is very important task i have to finish as soon as possible please help me by providing appropriate examples with coding or if possible then please help me by sending exact code to finish this requirement. ...Thanks much.
    1,485 pointsBadges:
    report
  • CharlieBrowne
    When you do the ALCOBJ you can determine what other job haas the file locked and send that in a message or just print it. You do need to be careful when you run this program. If you happen to start the reorg of a large file, your program will lock it and other jobs will fail when they try to access it. Is there a time when all users are off the system and no other batch jobs are running?
    41,370 pointsBadges:
    report
  • WoodEngineer
    The system requires an exclusing lock on a file before reorganizing it. This a function of the operating system. You can not reorg a file which is in use.
    6,295 pointsBadges:
    report
  • TomLiotta
    The system requires an exclusing lock on a file before reorganizing it. No longer totally true as of V5R3. With RGZPFM ALWCANCEL(*YES), the lock set by the reorg may only be *SHRUPD or *EXCLRD. Tom
    125,585 pointsBadges:
    report
  • 6r
    how to determine with alcobj which other job is trying to access that file object at the same time when its being used by rgzpfm command ? secondly this information i can check using wrkactjob command as well while this job is running in batch without alcobj by putting op .11 in front of that submitted job(cl pgm) name then it shows n no of objects as locked. thirdly there is a specific time like holiday or weekends when i wanna test this rgzpfm. please provide me the code or if possible modify my code to fulfill this requirement. ...thanks much
    1,485 pointsBadges:
    report
  • TomLiotta
    please provide me the code or if possible modify my code to fulfill this requirement. Would you not prefer better alternatives? Other things can be done that are easier and probably safer. Tom
    125,585 pointsBadges:
    report
  • WoodEngineer
    Thanks for the reminder, Tom. I had forgotten about that cool enhancement in V5R3.
    6,295 pointsBadges:
    report
  • 6r
    [...] 7. Can you help a member who wants to read all physical files in production library using CL program? [...]
    0 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