• Subject: Re: problem in printing packed decimal in ILE C/400
  • From: "Simon Coulter" <shc@xxxxxxxxxxxxxxxxx>
  • Date: Wed, 09 Jun 99 22:01:09 +1000


Baba wrote:

> > 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
>

Well of course it doesn't work!  You are reading the file into a 20-byte 
character field and 
printing it as a string of bytes.  C doesn't understand about packed data so %s 
simply attempts 
to print the character representation of the byte.  Most packed numeric data 
results in 
unprintable characters.  The C Reference manual contains examples of how to 
process an 
externally described file containing packed data.  Read the bloody thing!

Are you a student with no AS/400 knowledge or are you working for an Indian 
body shop and 
getting farmed out for projects for which you have no skill.  There seem to 
have been a lot of 
these lately.  If the former then read the manaul before asking for help,  if 
the latter then 
get some formal training.

Regards,
Simon Coulter.

«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»
«» FlyByNight Software         AS/400 Technical Specialists       «»
«» Eclipse the competition - run your business on an IBM AS/400.  «»
«»                                                                «»
«» Phone: +61 3 9419 0175      Mobile: +61 0411 091 400           «»
«» Fax:   +61 3 9419 0175      mailto: shc@flybynight.com.au      «»
«»                                                                «»
«» Windoze should not be open at Warp speed.                      «»
«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»
//--- forwarded letter -------------------------------------------------------
> X-Mailer: Microsoft Internet E-Mail/MAPI - 8.0.0.4211
> Date: Tue, 01 Jun 99 14:12:25 +0200
> From: "Baba Rahiman" <baba.rahiman@kiosk.ch>
> To: "'midrange-l@midrange.com'" <midrange-l@midrange.com>
> Reply-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
>       
>       
>       any suggestions?
> 
> regards,
> baba
> 
> +---
> | 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 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 thread ...


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.