Skip to main content

Copying logical files to another library, avoiding errors


Problem:

I was copying logical files (LF) to another library,  when I faced this problem; the copied LF was still pointing to a physical file (PF) in another library. My search brought me to the following article. Its wonderful how you can still learn something new even after years of experience.

https://www.itjungle.com/2004/09/08/crtdupobj-and-logical-files/

I hope this article is useful to you and saves you lots of difficult problems in your work. We RPG programmers use lots of logical files to read and update data. Its difficult to trace errors where our programs are referring to data in libraries not even on the library list!.

Happy coding!!!

Comments

Popular posts from this blog

AS400 resources on the web

The AS/400 system thru iSeries and System I, has come a long way. With regular contributions from the growing community of AS/400 RPG, COBOL, ILE programmers, there maybe a solution to most of your issues. www.search400.com ,  search400.techtarget.com A good knowledge base for AS400 related information, Question and Answers, tutorials, news. I use it regularly. www.midrange.com In their own words " Your best source for IBM i / System i / iSeries / AS/400 Information on the Internet ". Please make your own judgement. www.code400.com This is a site dedicated to AS/400 programmers! Have fun coding! www.itjungle.com This site now has AS/400 programmers posting information.  

AS400 Database Trigger Programs ADDPFTRG

iSeries/ AS400/ System i programming allows a very useful feature called Triggers. It allows you to execute programs based on data changes in a database file. Use the command ADDPFTRG to add triggers to any database file. Recently, I used trigger to create a history/ audit trail for a Client Locations file which does not have any history. Trigger was preferred over direct program changes because One small program does the job well. Least impact and least testing involved! It saves me time and effort having to add code in a dozen places. It saves on testing time because of large number of changes. The performance overhead is negligible. Follow this link to a useful article on Trigger programming http://www.tylogix.com/Articles/TriggerTechniquesRevisited.htm .