Having some issues with PUB400.COM per it be set up in German. Type 37
All the examples from library QCPPLE work.
But when I upload an example like READNC --- standing for read next changed
subfile record - I get lots of errors.
I am not understanding the subtle GERMAN characters that are in the code.
T1520subrz.TXT is a down load of "Thomas Raddatz" who i believe is the
ADMIN on PUB400.COM.
Thank you Mr. Raddatz for making this platform available.
When I uploaded code from a PDF that I copied into a TXT file and then
moved to READNC in my special source file QCSRC37
I get all sorts of strange errors per wrong GERMAN codes.
Have attached the source and the spool file
Mr. Raddatz original helped me with a subfile program I had entered in
myself. Later realized this source member file was in QCPPLE library.
Thomas Burrows
#include <stdio.h>
#include <stdlib.h>
#include <recio.h>
#define LEN 10
#define NUM_RECS 20
#define SUBFILENAME "MYLIB/T1677RD6"
#define PFILENAME "MYLIB/T1677RDB"
typedef struct
ä
char name¬LEN|;
char phone¬LEN|;
ü
pf_t;
#define RECLEN sizeof(pf_t)
void init_subfile(_RFILE *, _RFILE *);
int main(void)
ä
_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 */
/*************************************************/
init_subfile(pf, subf);
/*************************************************/
/* Write the subfile to the display by writing */
/* * a record to the subfile control format. */
/*************************************************/
_Rformat(subf, "SFLCTL");
_Rwrite(subf, "", 0);
_Rreadnc(subf, "", 0);
/*************************************************/
/* Close the physical file and the subfile. */
/*************************************************/
_Rclose(pf);
_Rclose(subf);
ü
/* 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 */
/* ------------------------------------------------------------ */
/* Hi Thomas, */
/* I fixed all compile errors and I assume, that */
/* the program now matches the source in the */
/* 'ILE C/C++ Programmer's Guide', page 223 */
/* downloaded from URL: */
/*
https://www.ibm.com/docs/en/ssw_ibm_i_74/rzarh/sc092712.pdf */
/* */
/* Feel free to check the changes with the following command: */
/* CMPPFM NEWFILE(COBOLKID1/QCSRC37) NEWMBR(T1520SUBRZ) */
/* OLDFILE(COBOLKID1/QCSRC37) OLDMBR(T1520SUBBK) */
/* RPTTYPE(*CHANGE) OPTION(*WIDE) */
/* ------------------------------------------------------------ */
/* CRTBNDC PGM(COBOLKID1/T1520SUBRZ) SRCFILE(COBOLKID1/QCSRC37) */
/* OUTPUT(*PRINT) */
/* ------------------------------------------------------------ */
/* CRTCMOD MODULE(COBOLKID1/T1520SUBRZ) */
/* SRCFILE(COBOLKID1/QCSRC37) OUTPUT(*PRINT) */
/* DBGVIEW(*LIST) TERASPACE(*YES) STGMDL(*INHERIT) */
/* ------------------------------------------------------------ */
#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)
void init_subfile(_RFILE *, _RFILE *);
int main(void)
{
_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. */
_Rformat(subf,"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 */
}
As an Amazon Associate we earn from qualifying purchases.