|
Baba, Here's a snippet from one of my "test" programs. Field TOTAL is packed(9,2) I found this information in the C manual and some help from the list :-) #include <stdio.h> #include <stdlib.h> #include <recio.h> #include <decimal.h> #include <xxcvt.h> /* Options are: */ /* input - include input only fields */ /* _P - create packed (unaligned) struct */ /* d - create decimal fields for packed numbers */ /* p - create char array fields for packed numbers */ #pragma mapinc("master","BUCK/MASTER(RMASTER)","input","_P d") #include "master" int main(void) { _RFILE *fp; _XXOPFB_T *opfb; BUCK_MASTER_RMASTER_i_t ddsbuf; /* Open the file for processing in arrival sequence. */ if (( fp = _Ropen ( "BUCK/MASTER", "rr, arrseq=Y" )) == NULL ) { printf ( "Open failed\n" ); exit ( 1 ); } /* Get the library and file names of the file opened. */ opfb = _Ropnfbk ( fp ); printf ( "Library: %10.10s\nFile: %10.10s\n", opfb->library_name, opfb->file_name); printf ( "recl=%d\n", (fp->buf_length) ); /* Get the first record. */ _Rreadf ( fp, &ddsbuf, sizeof(ddsbuf), __DFT ); printf("TOTAL = %D(*,*)\n", digitsof(ddsbuf.TOTAL), precisionof(ddsbuf.TOTAL), ddsbuf.TOTAL); > -----Original Message----- > From: Baba Rahiman > Sent: Tuesday, June 01, 1999 8:12 AM > To: 'midrange-l@midrange.com' > Subject: problem in printing packed decimal in ILE C/400 > > Hi everybody, > > > > 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 > +--- | 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.