IBM i

IBM i 

A space for professionals working with IBM’s integrated OS for Power systems to exchange ideas, ask questions, and share expertise on topics like RPG and COBOL development, application modernization, open source integration, system administration, and business continuity.


#Power


#IBMi
#Power
 View Only

Oops! Changed a Line by Mistake in program? Here’s How to Fix the Modified Date

By Pavan Thute posted Mon June 09, 2025 02:04 AM

  

How to Change the Modification Date of Specific Program Lines in Source (IBMi)

Scenario:

Imagine you're editing an RPG program and accidentally make a change to line number 5. You realize the mistake and revert the code—but now the modification date for that line has been updated, even though the logic remains the same.

This can cause confusion during code reviews or audits, where modification dates are often used to track changes. You might wonder: "Can I reset the modification date of that line to the older one?"

Yes, you can! Here’s a simple way to roll back the modification date using SQL.

Consider below are the program details:
Library Name: PavanT
Source Physical File Name: QRPGLESRC
Program Member Name: PGM001

And User accidentally modified line 5 and, upon realizing it, rolled back the changes. But now modification date is changed as shown below

Steps to Update the Modification Date of a Specific Line:

Step 1:

Start SQL Session using command STRSQL

Step 2:

CREATE ALIAS QTEMP/MEMBER FOR PavanT/QRPGLESRC (PGM001)

This creates a temporary alias in QTEMP pointing to your source member, making it accessible for direct SQL updates.

Step 3:

Update the Date for the Specific Line

UPDATE QTEMP/MEMBER SET SRCDAT = 990101 WHERE SRCSEQ = 5;

Notes:

  • This technique updates the SRCDAT field (modification date) for the specified SRCSEQ (line number).

  • It should be used cautiously and preferably in non-production environments.

  • Backup your source member if needed before making direct SQL updates

Changing dates is just the beginning—with this method, you can build cool dev tools like automation scripts, impact analyzers, and more.

0 comments
31 views

Permalink