× 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.



Hello Booth,

You can use the Retrieve Message (QMHRTVM) API to retrieve the message description details, including the message text:
http://pic.dhe.ibm.com/infocenter/iseries/v7r1m0/topic/apis/QMHRTVM.htm

Here's a (somewhat) brief example wrapping the QMHRTVM API in a subprocedure:

**-- API error data structure:
D ERRC0100 Ds Qualified
D BytPrv 10i 0 Inz( %Size( ERRC0100 ))
D BytAvl 10i 0
D MsgId 7a
D 1a
D MsgDta 256a

**-- Retrieve message:
D RtvMsg Pr ExtPgm( 'QMHRTVM' )
D RcvVar 32767a Options( *VarSize )
D RcvVarLen 10i 0 Const
D FmtNam 10a Const
D MsgId 7a Const
D MsgFq 20a Const
D MsgDta 512a Const Options( *VarSize )
D MsgDtaLen 10i 0 Const
D RplSubVal 10a Const
D RtnFmtChr 10a Const
D Error 32767a Options( *VarSize )
D RtvOpt 10a Const Options( *NoPass )
D CvtCcsId 10i 0 Const Options( *NoPass )
D RplCcsId 10i 0 Const Options( *NoPass )

**-- Retrieve message text:
D RtvMsgTxt Pr 1024a Varying
D PxMsgId 7a Value
D PxMsgFil 10a Value
D PxMsgFilLib 10a Value
D PxMsgDta 1024a Const Varying
D Options( *NoPass: *Trim )

**-- Retrieve message text:
P RtvMsgTxt B Export
D Pi 1024a Varying
D PxMsgId 7a Value
D PxMsgFil 10a Value
D PxMsgFilLib 10a Value
D PxMsgDta 1024a Const Varying
D Options( *NoPass: *Trim )

**-- Local variables:
D MsgDta s 1024a Varying
**-- Local constants:
D NULL c ''
D RPL_SUB_VAL c '*YES'
D IGN_FMT_CTL c '*NO'
D JOB_CCSID c 0
**-- Return structure:
D RTVM0100 Ds Qualified
D BytRtn 10i 0
D BytAvl 10i 0
D RtnMsgLen 10i 0
D RtnMsgAvl 10i 0
D RtnHlpLen 10i 0
D RtnHlpAvl 10i 0
D Msg 1024a

/Free

If %Parms >= 4;
MsgDta = PxMsgDta;
EndIf;

RtvMsg( RTVM0100
: %Size( RTVM0100 )
:'RTVM0100'
: PxMsgId
: PxMsgFil + PxMsgFilLib
: MsgDta
: %Len( MsgDta )
: RPL_SUB_VAL
: IGN_FMT_CTL
: ERRC0100
);

If ERRC0100.BytAvl = *Zero;
Return %SubSt( RTVM0100.Msg: 1: RTVM0100.RtnMsgLen );

Else;
Return NULL;
EndIf;

/End-Free

P RtvMsgTxt E

To retrieve message ID UTL1204 from message file FILENAME in library *LIBL, you then simply code:

MsgTxt = RtvMsgTxt( 'UTL2004': 'FILENAME': '*LIBL' );

The above code can also be found here:
http://code.midrange.com/5d06614086.html

Just in case anyone is faced with the task of converting display file constants and literals in order to support multiple languages in an application, I wrote a Convert Display File Constants (CVTDSPFCNS) command some time ago that might be of assistance in the process:
http://iprodeveloper.com/rpg-programming/apis-example-user-index-apis-part-two

Cheers,
Carsten

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Booth Martin
Sent: 18. januar 2014 08:02
To: RPG programming on the IBM i / System i
Subject: RPG retrieval of MSGID text

Tonight I have been playing with the problem of different users needing different languages. Using MSGFs is working well, however I am stumbling on one aspect. (Besides the one of only knowing one language, of course.)

Populating a field in the DDS works well enough, however I also need to populate a field in an RPG program with a specific message from a specific message file.

Something like:
wText = MSGID(*LIBL/FILENAME UTL12004)

where UTL12004 is the level 1 text in a specific MSGF.

Any ideas?

This communication is intended only for use by the addressee.It may contain confidential or privilegedinformation.
If you receive this communication unintentionally, please inform us immediately and delete this e-mail and any attachments.
Warning: Although we have taken reasonable precautions to ensure no viruses are present in this email, we cannot accept
responsibility for any loss or damage arising from the use of this email or attachments.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.