× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



All I can find in V7R4 C++ manual is a LOAD ALL subfile program with no

ADD
Change
Delete

Capacity. Does anyone have a full subfile in C++

Thomas Burrows
/* This program uses _Ropen() to open subfile */
/* T1530DDG ad physical file T1520DDH */
/* The subfile is then initialized with records */
/* from the physical file */
/* Subfile records are written to the dispplng */
/* using the _Rwrited() function */

#include <stdio.h>
#include <stdlib.h>
#include <recio.h>
#define LEN 10;
#define NUM_RECS 20;
#define SUBFILENAME "*LIBL/T1520DDG"
#define PFILENAME "*LIBL/T1520DDH"

typedef struct
ä
char name^len!;
char phone^len!;
ü
pf_t;

#define RECLEN sizeof(pf_t)

init_subfile(pf, subf);

void init_subfile(_RFILE *, _RFILE *);

int main(void)ä

int num¬MAXLEN|; /* An array of digits. */
char letter??(MAXLEN??); /* An array of characters*/
/* Trigraphs replace the square brackets. */

_RFILE *pf;
_RFILE *subf;
/* Open the subfile and the physical file. */

if ((pf = _Ropen(PFILENAME, "rr")) == NULL)
ä
printf("can't open file %sÖn", PFILENAME);
exit(1);
ü
if ((subf = _Ropen(SUBFILENAME, "ar+")) == NULL)
ä
printf("can't open file %sÖn", SUBFILENAME);
exit(2);
ü
/* Initialize the subfile with records from the physical file */

init_subfile(pf, subf);


/* Write the subfile to the display by writing a record */

/* to the subfile control format. */

of main routine */ , "SFLCTL");
_Rwrite(subf, "", 0);
_Rreadn(subf, "", 0, __DFT);

/* Close the physical file and the subfile */

_Rclose(pf);
_Rclose(subf);

ü /*close of main routine */

void init_subfile(_RFILE *pf, _RFILE *subf)
ä
_RIOFB_T *fb;
int i;
pf_t record;

/* Select the subfile record format */

_Rformat(subf, "SFL");

for (i = 1; i <= NUM_RECS; i++)
/* open bracket level #1 */
ä
fb = _Rreadn(pf, &record, RECLEN, __DFT);

if (fb->num_bytes Ü= EOF)
/* open bracket level #2 */
ä
fb = _Rwrited(subf, &record, RECLEN, i);

if (fb->num_bytes Ü= RECLEN)
/* open bracket level #3 */
ä
printf("error occurred during writeÖn");
exit(3);
ü /* close bracket level #3 */
ü /* close bracket level #2 */
ü /* close bracket level #1 */
A DSPSIZ(24 80 *DS3)
A CF03(03 'F3')
A*
A R SFL SFL
A NAME 10A B 10 25
A PHONE 10A B +5
A*
A R SFLCTL SFLCTL(SFL)
A SFLPAG(5)
A SFLSIZ(26)
A SFLDSP
A SFLDSPCTL
A*
A 21 25'<PAGE DOWN> FOR NEXT PAGE'
A*
A 22 25'<PAGE UP> FOR PREVIOUS PAGE'
23 25'F3 - EXIT'
DSPATR(HI)
R ENTRY
NAME 10A
PHONE 10A

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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

This mailing list archive is Copyright 1997-2024 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.