Home > AS/400 Tips > iSeries programmer tips > Where's the source?
iSeries 400 Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

ISERIES PROGRAMMER TIPS

Where's the source?


Jeff Worthington
09.10.2002
Rating: -3.87- (out of 5) Hall of fame tip of the month winner


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


Here is the scenario:

You are a new programmer or consultant and you are assigned a seemingly simple change to an existing program. With your skills it will be a piece of cake. What is the first thing you do? You have to find the source.

Let's make it even more fun and say that the previous programmer(s) left two weeks before you arrived and left vague notes that seem to be printed out with a DBCS font. Apparently there are multiple versions or source in various libraries on the system. Never fear, one thing you can do is use the DSPPGM command (if it's a program). But that does not guarantee the source is there. Maybe the program was compiled on another machine and moved over, maybe the source file has moved or been deleted (in which case you are out of luck, but you would hate to go looking for something that isn't there.) And if it's a display file, forget about finding an easy way to pinpoint the source by looking at the compiled object.

At this point I could probably make a good advertisement for my favorite 'for profit' utility "Pathfinder" by Hawkeye Information Systems, but if you are a consultant you have to be a little more self-sufficient and not always count on your quality utility to be there for you. Remember, there are no answers on the certification test that you can write "just use Hawkeye".

Now what? Endless hours of hunting in each source file you happen to stumble across? Well, if you are like me you think there must be a more logical approach, and you would rather just take the time to find out where the entire source is anyway. Which is going to save you tons of time in the future, and maybe even make you a hero.

Yes, there is something you can do. I created an outfile of all source members by using a simple command and a query tool to filter just the 'source' from my initial findings.

First try "DSPPGM PROGNAME". Look for the source file parameter in the display. See if the source is really there.

If you can't find the source and it's a CL program, you can always RTVCLSRC to get the code (without those helpful comments).

Finally, here is what I did:

1. Source members actually exist in physical files, so you can list information on all physical files and the source files will be in there. Do this by executing the following command -- in batch would be a good idea.

DSPFD FILE(*ALLUSR/*ALL) TYPE(*MBRLIST) OUTPUT(*OUTFILE) FILEATR(*PF) OUTFILE(QGPL/SOURCEMBR)

2. Now you have an outfile named 'SOURCEMBR' with some 32 fields of information in it. One of those fields is MLSEU, which is the "Source Type" field. (There is also an MLSEU2 field for S/38 code) You can filter your selections even further by using your favorite query method of SQL, IBM Query, OPNQRYF, or even CPYF to select field MLSEU not equal to blanks:

OPNQRYF FILE((QGPL/SOURCEMBR)) QRYSLT('MLSEU *NE " "')

You would want to sort by the MLNAME field which is the source member name.

Now you have a file listing of every source member name and the library it exists in. You can now pinpoint EXACTLY where the source is, and if there are multiple copies it will help you determine which is most current. There is other information in this file and I've listed the fields below. You can see how many records (MLNRCD) in the source file as well as the last change date (MLCHGD). Here is a field listing:

 
Field Name   Field Description        
MLRCEN       Retrieval century:  0=19x
MLRDAT       Retrieval date: year/mont
MLRTIM       Retrieval time: hour/minu
MLFILE       File                     
MLLIB        Library                  
MLFTYP       P=PF, L=LF, R=DDM PF, S=D
MLFILA       File attribute: *PHY or *
MLMXD        Reserved                 
MLFATR       File attribute:  PF, LF, 
MLSYSN       System Name (Source Syste
MLASP        Auxiliary storage pool ID
MLRES        Reserved                 
MLNOMB       Number of members         
MLNAME       Member                    
MLNRCD       Current number of records 
MLNDTR       Number of deleted records 
MLSIZE       Data space and index size 
MLSEU        Source type for S/38 View 
MLCCEN       Member creation century:  
MLCDAT       Member creation date: yea 
MLCHGC       Last change century: 0=19 
MLCHGD       Last change date: year/mo 
MLCHGT       Last change time: hour/mi 
MLMTXT       Text 'description'        
MLSEU2       Source type               
MLUCEN       Last Used Century: 0=19xx 
MLUDAT       Last Used Date: year/mont 
MLUCNT       Days Used Count           
MLTCEN       Usage Data Reset Century: 
MLTDAT       Usage Data Reset Date: ye 
MLSIZ2       Data Space and Index size
MLSTFR       Member storage freed Y=Ye 

One additional tip: I had multiple iSeries' and was able to do this on each machine, then FTP'd the files to one machine where they were combined and then queried. There is another field in the SOURCEMBR file called MLSYSN, which is the system name.

Good luck! Hope this helps you all out there! - Jeff

==================================
MORE INFORMATION ON THIS TOPIC
==================================

The Best Web Links: tips, tutorials and more.

Ask your programming questions--or help out your peers by answering them--in our live discussion forums.

Ask the Experts yourself: Our application development gurus are waiting to answer your programming questions.


Rate this Tip
To rate tips, you must be a member of Search400.com.
Register now to start rating these tips. Log in if you are already a member.




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
iSeries CL programming
Taking advantage of CL advancements, starting with V5R3
Checking in on your IBM i authorization lists
Running PHP open source applications: NOBODY needs authority
Simplify the process of converting a spool file from iSeries into an Excel spreadsheet
CL program for daily backups
An automated CL method of moving a query from AS/400 to Excel
Changing user password expiration
Eight steps for creating program documentation using AS/400 utilities
DAYSPAST CLLE program for AS/400: Compares object creation date with today's date
Advanced Job Scheduler help

RPG iSeries programming
Enhancing RPG with external SQL stored procedures
Introduction to SQLRPGLE on IBM i: Making a report
Making the most of RPG data handling on IBM i
IBM i shop boosts online sales with RPG-based Web platform
Migrating from RPG to EGL on IBM i
Allow access to data from a stored procedure result set using COBOL or RPG
EGL Rich UI on IBM i: Do you Dojo?
Programming for the Web on the IBM i, what is possible
A taste of COMMON: ILE, IBM releases, Web applications and new products
Documenting nested program structures on the AS/400

iSeries programmer tips
Enhancing RPG with external SQL stored procedures
Tracking data changes on IBM i with triggers
Introduction to SQLRPGLE on IBM i: Making a report
Implementing a browser interface in COBOL: Displaying database fields
Taking advantage of CL advancements, starting with V5R3
TAATOOL: Useful tools for programmers on IBM i
Implementing a browser interface in COBOL: Creating your graphic Web page
Implementing a browser interface in COBOL: Getting started
Making the most of RPG data handling on IBM i
Groovy programming on IBM i

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
Report Program Generator  (Search400.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



iSeries Security - Security Tools, Physical Security and System Security
HomeNewsTopicsITKnowledge ExchangeTipsBlogsAsk the ExpertsMultimediaWhite PapersProducts
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts