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)

#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);

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

This thread ...


Return to Archive home page | Return to MIDRANGE.COM home page