× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Below code is what I use to emulate System Subfile Messages: highlighted messages at the bottom of the display that you can scroll if there is a + next to it
Each SNDPGMMSG or QMHSNDPM sent to '*' will put a new message on top of the last one, if any, In the Program or Subfile Message Queue

The only thing you have to do is to initialize #SFLPGMQ with '*' in your program, Write #MSGR after any other overlays and before the ExFmt
Note that the SFLMSGRCD is for 27x132 display, but it can be any display line you wish

If you need +info, I suggest "Programming DDS for Display files" IBM pdf book (https://www.ibm.com/support/knowledgecenter/ssw_ibm_i)
I will not provide +more support


A**------------------------------------------------------------------------
A** RECORD:ERROR MESSAGE SUBFILE ------------------------------------------
A**------------------------------------------------------------------------
A R #SFLMSGR SFL
A SFLMSGRCD(27)
A #SFLMSGKEY SFLMSGKEY
A #SFLPGMQ SFLPGMQ(10)
A**------------------------------------------------------------------------
A** RECORD:ERROR MESSAGE CONTROL ------------------------------------------
A**------------------------------------------------------------------------
A R #MSGR SFLCTL(#SFLMSGR)
A OVERLAY
A SFLDSP
A SFLDSPCTL
A SFLINZ
A N99 SFLEND
A SFLSIZ(0002)
A SFLPAG(0001)
A #SFLPGMQ SFLPGMQ(10)




-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Patrik Schindler
Sent: Thursday, January 30, 2020 13:16
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Message line: Another approach?

Hello,

maybe there are other approaches to my message line issue? I'll describe what I want to achieve.

I have a program displaying records in a SFL. When using Option 2=Change, a SR (CHGREC) is executed which tries to CHAIN(E) to the record in question, so it is properly locked. The SFL is still visible on screen. If that succeeds, a detail-screen (in the same DSPF) is brought up via EXFMT which allows changing stuff.

If %STATUS of the PF (from the CHAIN mentioned above) yields 1218, the record has been locked by someone else. This makes the program call another SR (DSPREC) (which is normally called by using Option 5=Display). That SR does a CHAIN(EN), changes a few indicators to make the detail-screen appear readonly, and also does an EXFMT to actually display content.
The user has access to the data in question read only now, which is better than no access at all. This already works.

My goal is: I want the user to be notified my a message in the message line that the record has been opened read only, because it's already in use.

Since there are more error conditions (duplicate key, record not found, etc.), the DSPF has set a global ERRSFL keyword.

I had part success by (for a test) hard coding a WRITE to the details-record, setting the appropriate IN for the matching ERRMSGID to be shown and then do the EXFMT. But because ERRMSGID is tied to a field, that field is highlighted which is not what I want to achieve.

I'm happily awaiting proposals how to achieve "simply" showing a message as described above. :-) Thank you for your time and effort.

Oh, please refrain from discussions about the drawbacks of locks, people leaving their screen for long time, etc, because it's out of scope for this purely technical question. Thank you. :-)

:wq! PoC

PGP-Key: DDD3 4ABF 6413 38DE - https://www.pocnet.net/poc-key.asc

--
This is the RPG programming on IBM i (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: https://amazon.midrange.com

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.