0

I'm developing a tool program on IBM i that automates recompilation of objects (RPGLE, DSPF, CLLE) whenever changes occur. Everything works fine for RPG and CLLE, but I'm struggling with detecting when a Display File (DSPF) needs to be recompiled.

Here’s the situation:

After changing a Physical File (PF) using CHGPF, my tool recompiles the related RPGLE programs successfully.

However, some DSPF objects are also dependent on the same PF.

Each screen in a DSPF has its own format-level identifier, and when the PF changes, the DSPF might also need recompilation to avoid mismatches.

My questions:

Is there any field, attribute, or mechanism in the DSPF that automatically tracks PF changes or indicates whether the DSPF is out of sync with its referenced PFs?

Since a DSPF can have multiple screen formats (each with its own format-level identifier), is there a single identifier for the entire DSPF that can be used to detect changes and compare against the RPGLE program's compiled identifier to ensure synchronization?

select * from ckezy1.ALLPGM1 WHERE WHFNAM = 'NEW11';

DSPPGMREF *PGM

Display file

3 Answers 3

0

A DSPF is not at all tied to a PF. Just "importing" references to PFs in a DSPF is solely done on the source level, and not on the compiled object.

Contrary, any file being referenced in a program is tied to it, including after compilation. The automatically derived allocated variables (buffer addresses and sizes) must match. You get an error if you changed a file object being referenced by a program in an incompatible way, and start the program. This is called Level Checking. If you search Google for this term, plenty of information will be revealed. I intentionally do not link any such pages, because they will often become invalid quickly. IBM reorganizes their website quite often.

Note: Incompatible means, your changes imposed program related structures to change: Buffer sizes or field ordering. You can indeed change a DSPF without affecting the level check by just changing static text, or moving fields a little.

TL;DR: There is no direct way to track PF changes from any DSPF object attribute.

I assert you might apply the classical Unix make approach. Since you appear to use DDS for generation of your database objects, that should work fine. With this, you merely retrieve the time stamps of your objects, and basing source member names. If the source member is newer, the object needs to be regenerated. Also, if a dependent object's source timestamp is newer, the respective object needs to be generated.

Once, there was a free tool called tmkmake — being part of the example program library qusrtool —, which was supposed to help with this kind of tracking, but its main drawback was that it retrieved the timestamps just once. Timestamps of objects being generated during tmkmake doing its thing weren't reconsidered dynamically.

Personally, I'd try to implement such a logic in REXX, because it's an interpreted language which can be run directly from a source file. Contrary to CL, there is no compile step and no subsequent throwaway program object results. See strrexprc.

I'm also pretty sure, there are commercial packages available for professional development. IBM has withdrawn the source management part of PDM quite a while ago. I expect this to have created demand for a solution.

Sign up to request clarification or add additional context in comments.

Comments

0

The file level identifier for a file isn't relevant to compiled programs. As far as I know, the file level id isn't even compiled into the program.

All changes, such as changes to the constants in the display file, seem to affect the file level id, but the only changes that matter to compiled programs are changes to the fields in the record formats.

So you'd have to check the actual record level ids against what DSPPGMREF shows for the program.

Comments

0

In addition to the excellent answer given by @PoC, I would be very careful about just auto-recompiling a DSPF simply because a PF changed. It is definitely not required, and could break the DSPF. While a program can fail with a level check, a DSPF cannot (as a result of a PF change). Note a Program can also fail with a level check as a result of a DSPF change, but a DSPF is not tied to a PF in that way.

However, a DSPF can reference a PF to determine the length and type of fields on the screen. This happens at compile time. If a PF is changed to increase the length of a field, it could cause fields on a DSPF record to overlap, and that will break the DSPF. Depending on the situation, it could fail the DSPF compile, or maybe the field will disappear off the screen.

So it is best to just leave the DSPF alone, and not auto-compile it as a result of a PF change. You will have to add some code to auto-compile programs as a result of a DSPF change though.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.