|
Tim
In the past I have tended to use the technique that Paul suggests, however I
have started moving towards using message files and creating a message
definition for the command with replacement variables, for example
ADDMSGD MSGID(CMD0100) MSGF(mylib/mymsgf)
MSG('CRTBNDRPG PGM(&1/&2) SRCFILE(&3/&4) DBGVIEW(*LIST)')
FMT((*CHAR 10) (*CHAR 10) (*CHAR 10) (*CHAR 10))
Then in a CL program I can use:
CHGVAR &MSGDTA VALUE(&LIBR *CAT &MEMBER *CAT &LIBR *CAT &FILE)
RTVMSG MSGID(CMD0100) MSGF(mylib/mymsgf) MSGDTA(&MSGDTA)
MSG(&CMD) MSGLEN(&CMDLEN)
Alternatively, I can use a sub-procedure in a service program that places a
call to the QMHRTVM API (apologies for the spacing with the font):
p RtvMsg b Export
** Procedure interface
d RtvMsg pi 512
d MsgId 7 Value
d MsgF 20 Options(*NoPass)
d MsgDta 256 Options(*NoPass)
d RtvM0100 ds
d Byte_Rtn 9b 0
d Byte_Avl 9b 0
d Lgth_Msg_Rtn 9b 0
d Lgth_Msg_Avl 9b 0
d Lgth_Hlp_Rtn 9b 0
d Lgth_Hlp_Avl 9b 0
d Msg_Txt 512
d MsgFile s 20 Inz('SYSMSGF *LIBL')
d MsgLgth s 9b 0 Inz(%Size(RtvM0100))
d MsgFmt s 8 Inz('RTVM0100')
d Subst s 10 Inz('*NO')
d RtnFmt s 10 Inz('*NO')
d Rep s 256
d RepLgth s 9b 0 Inz(%Size(Rep))
c Reset ApiErr
c If %Parms > 1 and MsgF <> '*SAME'
c Eval MsgFile = MsgF
c EndIf
* If substitution data is passed then we need to include it when we
* retrieve the message description...
c If %Parms = 3
c Eval Rep = MsgDta
c Eval RepLgth = %Size(Rep)
c Eval Subst = '*YES'
c EndIf
c Call(e) 'QMHRTVM'
c Parm RtvM0100
c Parm MsgLgth
c Parm MsgFmt
c Parm MsgId
c Parm MsgFile
c Parm Rep
c Parm RepLgth
c Parm Subst
c Parm RtnFmt
c Parm ApiErr
c Return Msg_Txt
p RtvMsg e
Hope it helps
All the best
Jonathan
www.astradyne-uk.com
-----Original message-----
From: "Paul Morgan" pmorgan@xxxxxxxxxxxxxx
Date: Tue, 22 Feb 2005 22:20:20 +0000
To: midrange-l@xxxxxxxxxxxx
Subject: Re: cl replacment values.
> Tim,
>
> If you're building this command in a CL program use the *TCAT operator right
> after the library, member and file variables:
>
> CHGVAR VAR(&COMMAND) VALUE('CRTBNDRPG PGM(' *CAT &LIB *TCAT '/' *CAT &MEMBER
> *TCAT ') SRCFILE(' *CAT &LIB *TCAT '/' *CAT &FILE *TCAT ') DBGVIEW(*LIST)')
>
> If you're building the command string in RPG use the %TRIMR built in
> function (free format):
>
> Command = 'CRTBNDRPG PGM(' + %TrimR( Lib ) + '/' + %TrimR( Member ) + ')
> SRCFILE(' + %TrimR( Lib ) + '/' + %TrimR( File ) + ') DBGVIEW(*LIST)';
>
> Paul
>
> --
> Paul Morgan
> Senior Programmer Analyst - Retail
> J. Jill Group
> 100 Birch Pond Drive, PO Box 2009
> Tilton, NH 03276-2009
> Phone: (603) 266-2117
> Fax: (603) 266-2333
>
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.