Eugene,

Your problem is the ERRMSG keyword.  That is causing the "Error2"
message to be displayed, but it does not update the rest of the screen.

To do what you want, I suspect you will have to write the screen with
IN61 off, this will update the CUSTNAME field.  Then write it again
(with no intervening read) with IN61 on.  This will activate the ERRMSG
text.

However, normally when using ERRMSG you would not try and update other
data on the screen.

Regards,
Bob Crothers

-----Original Message-----
From: c400-l-admin@midrange.com [mailto:c400-l-admin@midrange.com]On
Behalf Of Eugene Astanovsky
Sent: Monday, September 10, 2001 6:46 AM
To: C400-L@midrange.com
Subject: [C400-L] Mess with display files...

This is a multi-part message in MIME format.
--
[ Picked text/plain from multipart/alternative ]
Can someone find some 10 minutes to explain me, what am I doing wrong?
I have a trivial display file named Y20DMD5:

A                                      DSPSIZ(24 80 *DS3)
A                                      CF03(03 'EXIT')
A          R CHRG
A                                  3  2'Customer . . .'
A            CUSCPNC        6A  B  3 17COLOR(WHT)
A  61                                  ERRMSG('Error2')
A            CUSNAME       35A  O  3 28
A                                 23  2'F3=Exit'
A                                      COLOR(TRQ)

Then I have a trivial C program :

#include <stdio.h>
#include <stdlib.h>
#include <recio.h>
#include <string.h>

#pragma mapinc("hdrf", "*LIBL/Y20DMD5(CHRG)", "both", "_P", "D1", "D1")
#include "hdrf"
#define INPUT_T  D1_CHRG_i_t
#define OUTPUT_T D1_CHRG_o_t

#define IND_ON '1'
#define IND_OFF '0'

int main(void)
{
  _RFILE *fp ;
  _RIOFB_T *rfb ;
  INPUT_T ScreenIn ;
  OUTPUT_T ScreenOut ;

  if ((fp = _Ropen("*LIBL/Y20DMD5", "rr+") ) == NULL)
    return(0) ;

  _Rformat (fp, "CHRG") ;
  ScreenOut.IN61 = IND_OFF ;
  memset(ScreenOut.CUSCPNC, ' ', 6) ;
  memset(ScreenOut.CUSNAME, ' ', 35) ;

  while (1)
  {
    rfb = _Rwrite(fp, &ScreenOut, sizeof(OUTPUT_T)) ;
    rfb = _Rreadn(fp, &ScreenIn, sizeof(INPUT_T), __DFT) ;
    ScreenOut.IN61 = IND_OFF ;
    if ((ScreenIn.IN03 == IND_ON))
    {
      _Rclose(fp) ;
      return(0) ;
    }
    memset(ScreenOut.CUSNAME, 'A', 35) ;
    ScreenOut.IN61 = IND_ON ;
    memcpy(ScreenOut.CUSCPNC, ScreenIn.CUSCPNC, 6) ;
  }
}

It shows a customer prompt and when I enter customer it shows "Error1"
on an error bar, but for some strange reason does not show, that the
CUSNAME field has new value!
At the same time, if I remove the row, setting IN61 to ON, everything
is OK.
What I want, is that it shows changed CUSNAME field AND ALSO an error
text.
Any advise will be highly appreciated!

Thanks in advance,

Jevgeni Astanovski.

--

_______________________________________________
This is the C programming iSeries / AS400 (C400-L) mailing list
To post a message email: C400-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/c400-l
or email: C400-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/c400-l.



This thread ...

Replies:

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

This mailing list archive is Copyright 1997-2019 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 here. If you have questions about this, please contact [javascript protected email address].