Source Code Samples
A INDARA
A R PHONE
A CF03(03 'EXIT')
A 1 35'PHONE BOOK'
A DSPATR(HI)
A 7 28'Name:'
A NAME 11A I 7 34
A 9 25'Address:'
A ADDRESS 20A I 9 34
A 11 25'Phone #:'
A PHONE_NUM 8A I 11 34
A 23 34'F3 - EXIT'
DSPATR(HI)
/* This program uses response indicators to inform the program that */
/* F3 was pressed by a user to indicate that an input request */
/* finished. The response indicators are returned in a separate */
/* indicator area. */
#include <stdio.h>
#include <recio.h>
#include <stdlib.h>
typedef struct{
char name[11];
char address[20];
char phone_num[8];
}info;
#define IND_ON '1'
#define F3 2
int main(void)
{
_RFILE *fp;
_RIOFB_T *rfb;
info phone_list;
_SYSindara indicator_area;
if (( fp = _Ropen ( "*LIBL/T1520DD0", "ar+ indicators=y" )) == NULL )
{
printf ( "display file open failed\n" );
exit ( 1 );
}
_Rindara ( fp, indicator_area );
_Rformat ( fp, "PHONE" );
rfb = _Rwrite ( fp, "", 0 );
rfb = _Rreadn ( fp, &phone_list, sizeof(phone_list), __DFT );
if ( indicator_area[F3] == IND_ON )
{
printf ( "user pressed F3\n" );
}
_Rclose ( fp );
}
Note:
This program uses response indicators IND_ON '1'
and F3 2 to inform the ILE C program T1520ID2 that a user pressed
F3. The _Rindara() function accesses the separate
indicator buffer indicator_area associated with the externally described
file T1520DD0. The display file T1520DD0 is opened with the keyword indicators=yes to
return the indicator to a separate area.