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



Here is some RPG code to get message text.

// USAGE

// Message file names
D cMsgLib C Const('*LIBL ')
D cMsgF1 C Const('MSGF1 ')
D cMsgF2 C Const('MSGF2 ')
D cMsgLvl1 C Const('1')
D cMsgLvl2 C Const('2')

R04MSG = RtvMsgTxt('MSG0004':cMsgF2:cMsgLib:cMsgLvl1)

//###################################################//
P RtvMsgTxt B

//************************************************************************
// API Call: QMHRTVM Retrieve Message text

//************************************************************************




D RtvMsgTxt PI 1024
D RMsgId 7 Const
D RMsgFle 10 Const
D RMsgLib 10 Const
D RMsgLvl 1 Const

// Retrieve Message Description API Prototype
D Get_Message PR ExtPgm('QMHRTVM')
D 4000 Options(*VarSize)
D 10I 0 Const
D 8 Const
D 7
D 20 Const
D 32765 Options(*VarSize)
D 10I 0 Const
D 10 Const
D 10 Const
D 8192 Options(*VarSize)
D 10
D 9B 0
D 9B 0

// Define Variables for QMHRTVM API call:
// --------------------------------------
// Return variables
D MessageInfo DS 4000
D Data 1 4000
D OSMSG 65 68B 0
D LMsgR 69 72B 0
D LMsgA 73 76B 0
D OSMSGH 77 80B 0
D LMsgHR 81 84B 0
D LMsgHA 85 88B 0

// Required input variables
D MessageLen S 10I 0
D MessageForm S 8
D MessageIden S 7
D MessageFile S 20
D Replacement S 32765
D ReplaceLen S 10I 0
D ReplaceSub S 10
D ReturnCtl S 10

D RetrieveOpt S 10
D ConvToCCSID S 9B 0
D ReplDtaCCSID S 9B 0

D Return_Text S 1024

D ErrorCode DS Qualified
D BytesProv 4B 0 Inz(0)
D BytesAvail 8B 0 Inz(0)
D ExceptionId 7
D Reserved 1
D ExceptionDta 512
/FREE

// Load API parameter fields
MessageInfo = *blanks;
MessageLen = 4000;
MessageForm = 'RTVM0300';
MessageIden = RMsgId;
MessageFile = RMsgFle + RMsgLib;
Replacement = *blanks;
ReplaceLen = %Len(Replacement);
ReplaceSub = '*YES';
ReturnCtl = '*YES';
RetrieveOpt = '*MSGID';
ConvToCCSID = 0;
ReplDtaCCSID = 0;

// Retrieve message description
Get_Message(MessageInfo :
MessageLen :
MessageForm :
MessageIden :
MessageFile :
Replacement :
ReplaceLen :
ReplaceSub :
ReturnCtl :
ErrorCode :
RetrieveOpt :
ConvToCCSID :
ReplDtaCCSID);

// Process Return variables
Return_Text = *blanks;

// If no errors, determine the correct portion of the message text
If ErrorCode.BytesProv = 0;
Select;
When RMsgLvl = '1';
Return_Text = %Subst(data:OSMSG+1:LMsgA); // Msg Lvl 1
When RMsgLvl = '2';
Return_Text = %Subst(data:OSMSGH+1:LMsgHA); // Msg Lvl 2
EndSl;
Else;
Return_Text = 'Get_Message failed.';
EndIf;

// Return to calling point
Return Return_Text;

/END-FREE
P E



From: "Birgitta Hauser" <Hauser@xxxxxxxxxxxxxxx>
To: "'RPG programming on the IBM i \(AS/400 and iSeries\)'" <
rpg400-l@xxxxxxxxxxxx>
Cc:
Date: Sun, 19 Jan 2014 09:58:36 +0100
Subject: AW: RPG retrieval of MSGID text
Hi,

You only want the following textes to be translated into French or German?
If so, the German translation is:
Opt Message ID Severity Message Text
UTLCF03 0 F3=Exit --> F3=Verlassen
UT12001 0 Center text in field --> Text im Feld
zentrieren
UT12002 0 Type text to be centered: --> Text zum
Zentrieren erfassen
UT12003 0 & friends --> &Freunde
UT12004 0 German --> Deutsch
UT12005 0 English --> Englisch
UT12007 0 French --> Französisch
UT12050 0 -= Center Text in field =- --> -= Text im Feld
zentrieren =-

As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.