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

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

Bob Crothers

-----Original Message-----
From: []On
Behalf Of Eugene Astanovsky
Sent: Monday, September 10, 2001 6:46 AM
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
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:
To subscribe, unsubscribe, or change list options,
or email:
Before posting, please take a moment to review the archives

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-2022 by 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.