|
Hi, Baba:
On Tue, 1 Jun 1999, Baba Rahiman wrote:
> We are unable to get printable/readable normal character form, while
> reading record in Physical file using _Ropen()/_Rreadn() on ILE C/400-(
> V3R1M0).
> Sample code:
> int main(void)
> {
> char record??(20??);
> _RFILE *fb;_RIOFB_T *fbt;
> fb = _Ropen("PHname","rr");
> fbt = _Rreadn(fb,record,sizeof(record),__DFT);
> printf(" %s \n ",record);
> }
> Problem: We're not able to print on screen if it is packed_decimal
> data type
Assuming you want to stick with internal definitions, here is what you
need. The following assums a 15-byte character field, and a PD (9,2)
field.
#include <decimal.h>
typedef struct {
char Field1[20];
decimal Number(9,2);
} PRec_t ;
int main(int argc, char *argv[])
{
PRec_t DataRec;
_RFILE *fb;
_RIOFB_T *fbt;
fb = _Ropen("PHname","rr");
fbt = _Rreadn(fb,DataRec,sizeof(DataRec),__DFT);
printf(" %s %D(9,2)\n ",DataRec.Field1, DataRec.Number);
}
HTH
--
Dennis Lovelady Simpsonville, SC
Fayetteville, GA
mail: dennis@lovelady.com dennis.e.lovelady@ac.com
URL: http://lovelady.piedmont.net
ICQ: 5734860
--
"Man invented language to satisfy his need to complain."
-- Lily Tomlin
(I'm assuming that C language is not included in that statment.)
+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.