Problem solve Get help with specific problems with your technologies, process and projects.

Display a simple text window without using a display file

This tip shows you a how the UIM Display Long Text API provides a way to display a simple text window.

The UIM Display Long Text (QUILNGTX) API provides a handy way to display a simple text window without requiring a display file. Text can be as simple as "Press after pouring some coffee" or as complex as you can fit into 16MB. The text is automatically word-wrapped and scrollable, though unfortunately there are no formatting options -- it is a block of text with no paragraph or line-breaks. Text may be constructed on the fly.

The sample CL code shows retrieving the text from the second-level text of a message in a message file. The window title is automatically taken from the first-level text of a supplied message ID. This API can sometimes remove the need to waste your only DCLF for a display file in a CL program.

	      pgm    ( +
         &pMsgId     +
         &pMsgF      +
         &pMsgFLib   +

   dcl   &pMsgId          *char     7
   dcl   &pMsgF           *char    10
   dcl   &pMsgFLib        *char    10

   dcl   &@yes            *lgl           value( '1' )
   dcl   &@no             *lgl           value( '0' )

   dcl   &msgf            *char     10
   dcl   &msgflib         *char     10
   dcl   &msgID           *char      7
   dcl   &msgtxtlen       *dec   ( 5 0 )

/* Variables for QUILNGTX API          */
   dcl   &LngTxt          *char    999
   dcl   &TxtLen          *char      4
   dcl   &TxtTitl         *char      7
   dcl   &TxtMsgf         *char     20
   dcl   &ErrCode         *char      4

   chgvar   &msgId               &pMsgId
   chgvar   &msgf                &pMsgF
   chgvar   &msgflib             &pMsgFLib

   /* Say something useful.                            */

   chgvar   &TxtTitl             &msgId

   Qsys/rtvmsg      &msgId             +
                msgf( &msgflib/&msgf ) +
                seclvl( &LngTxt )      +
                seclvllen( &msgtxtlen )

   chgvar   %bin( &TxtLen 1 4 )  &msgtxtlen
   chgvar   &TxtMsgf           ( &msgf *cat &msgflib )

   call   QUILNGTX    (   +
                        &LngTxt  +
                        &TxtLen  +
                        &TxtTitl +
                        &TxtMsgf +
                        &ErrCode +


   Qsys/rmvmsg     msgq( *PGMQ ) clear( *ALL ) rmvexcp( *NO )
   monmsg    ( cpf0000 mch0000 )



Dig Deeper on iSeries CL programming

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.