× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Thanks guys
I'm writing a project that sends 5250 streams to a display file that is
defined with DDS USRDFN record. It seems that the problem that I have is
that I don't know how to transfer 5250 control characters. I tried using
record I/O functions but it always returns errno = 3102. So, I was thinking
that by using binary streams I could make it work. Here is an example of
what I was trying to do (I was trying to make a print screen here). And here
is an example of how it is done by CL:
http://www.sentinex.com/getdsp.html

#include <errno.h>
#include <stdio.h>
#include <recio.h>
#include <signal.h>
#include <stdlib.h>

_RFILE   *fp;
void handler ( int );

int main(void)
{
    _RIOFB_T *rfb;
    char     buf[1918];

    signal (SIGALL, handler );

    if (( fp = _Ropen ( "GETDSPC","ar+" )) == NULL )
    {
        printf ( "Could not open the display file\n" );
        exit ( 1 );
    }

    _Rformat ( fp,"GET" );

    memset(buf,' ',1918);
    buf[0] = 00;
    buf[1] = 02;
    buf[2] = 10;
    buf[3] = 00;
    buf[4] = 73;
    buf[5] = 04;
    buf[6] = 62;

    errno = 0;
    rfb = _Rwriterd ( fp, &buf, 6 );

    _Rclose ( fp );
}

void handler ( int sig )
{

   printf ( "message = %7.7s\n", _EXCP_MSGID );
   printf ( "program continues \n" );
   signal ( SIGALL, handler );
}


----- Original Message ----- 
From: <c400-l-request@xxxxxxxxxxxx>
To: <c400-l@xxxxxxxxxxxx>
Sent: Friday, July 30, 2004 7:00 PM
Subject: C400-L Digest, Vol 2, Issue 48


> Send C400-L mailing list submissions to
> c400-l@xxxxxxxxxxxx
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://lists.midrange.com/mailman/listinfo/c400-l
> or, via email, send a message with subject or body 'help' to
> c400-l-request@xxxxxxxxxxxx
>
> You can reach the person managing the list at
> c400-l-owner@xxxxxxxxxxxx
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of C400-L digest..."
>
>
> Today's Topics:
>
>    1. Re: Example of using Display Files as binary stream files
>       (Vince Rowe)
>    2. Re: using display files in C (Boris)
>    3. Re: Re: using display files in C (phillip.groschwitz@xxxxxxxxx)
>    4. Re: Example of using Display Files as binary stream files
>       (Simon Coulter)
>    5. RE: Example of using Display Files as binary stream files
>       (Jevgeni Astanovski)
>    6. Re: Example of using Display Files as binary stream files
>       (Simon Coulter)
>
>
> ----------------------------------------------------------------------
>
> message: 1
> date: Thu, 29 Jul 2004 13:09:40 -0400
> from: Vince Rowe <vrowe@xxxxxxxxxxxxxxxx>
> subject: Re: [C400-L] Example of using Display Files as binary stream
> files
>
> Boris,
>
> I couldn't make it work, either, so I wrote the program in modules, one
module
> that reads/writes to the display file using RecordIO, and another that
uses
> embeded SQL to get data from DB2.  It's clumsy, but you cannot have
RecorIO
> and stream IO in the same module, apparently.
>
> Vince Rowe
> MIS
> Marietta Corp.
>
> On Thursday 29 July 2004 11:41 am, Boris wrote:
> > Hi All,
> > Does anybody have an example of using Display files with fopen,
fwrite...
> > functions? All I could find in the documentation that this is possible.
> >
> > Or an example of a C program writing into a USRDFN record.
> >
> > Any input is highly appreciated
> > Thanks
> > _______________________________________________
>
>
>
> ------------------------------
>
> message: 2
> date: Thu, 29 Jul 2004 21:04:43 +0200
> from: "Boris" <bbresc512@xxxxxxxxxx>
> subject: [C400-L] Re: using display files in C
>
> Hi Rob,
> thanks a lot for you input. After days of desperate trying I'm leaning to
> that exact direction, yet not ready to give up.
> I'm coming from windows/linux environment where C and Java has been all I
> need so far. I was trying to avoid learning another, very platform
oriented,
> language, especially while hearing in the background about how RPG may
> become obsolete.
>
> I just hope I will not be spending a lot of time trying to get C and RPG
> working together (for example parameter passing and type compatibility).
Is
> there any learning material or good books that you can point out?
>
> Thanks
> Boris.
> ----- Original Message ----- 
> From: <c400-l-request@xxxxxxxxxxxx>
> To: <c400-l@xxxxxxxxxxxx>
> Sent: Thursday, July 29, 2004 7:00 PM
> Subject: C400-L Digest, Vol 2, Issue 47
>
>
> > Send C400-L mailing list submissions to
> > c400-l@xxxxxxxxxxxx
> >
> > To subscribe or unsubscribe via the World Wide Web, visit
> > http://lists.midrange.com/mailman/listinfo/c400-l
> > or, via email, send a message with subject or body 'help' to
> > c400-l-request@xxxxxxxxxxxx
> >
> > You can reach the person managing the list at
> > c400-l-owner@xxxxxxxxxxxx
> >
> > When replying, please edit your Subject line so it is more specific
> > than "Re: Contents of C400-L digest..."
> >
> >
> > Today's Topics:
> >
> >    1. Example of using Display Files as binary stream files (Boris)
> >    2. RE: Example of using Display Files as binary stream files
> >       (Bob Crothers)
> >
> >
> > ----------------------------------------------------------------------
> >
> > message: 1
> > date: Thu, 29 Jul 2004 17:41:52 +0200
> > from: "Boris" <bbresc512@xxxxxxxxxx>
> > subject: [C400-L] Example of using Display Files as binary stream
> > files
> >
> > Hi All,
> > Does anybody have an example of using Display files with fopen,
fwrite...
> functions? All I could find in the documentation that this is possible.
> >
> > Or an example of a C program writing into a USRDFN record.
> >
> > Any input is highly appreciated
> > Thanks
> >
> > ------------------------------
> >
> > message: 2
> > date: Thu, 29 Jul 2004 10:18:42 -0500
> > from: "Bob Crothers" <bob@xxxxxxxxxxxxxx>
> > subject: RE: [C400-L] Example of using Display Files as binary stream
> > files
> >
> > Boris,
> >
> > This is where my lack of "purity" will shine thru.
> >
> > But, I prefer to use each tool for what it is best at.  C is very good
at
> > string manipulation, bit twiddling, buffer manipulation, and crazy
screwy
> > weird stuff.  RPG is no fun at all doing these kind of things.
> >
> > C sucks at working with "native" AS/400 externally described files
(device
> > or database).  On the other hand, RPG excels at doing these things!
> >
> > So, I use RPG modules to do the normal as/400 file manipulation and C to
> do
> > the "fun" stuff.
> >
> > Yes, you can use a hammer to drive a screw...but it wont be pretty and
> > generally makes a mess.
> >
> > JMHO,
> > Bob
> >
> > > -----Original Message-----
> > > From: c400-l-bounces@xxxxxxxxxxxx [mailto:c400-l-bounces@xxxxxxxxxxxx]
> On
> > > Behalf Of Boris
> > > Sent: Thursday, July 29, 2004 10:42 AM
> > > To: c400-l@xxxxxxxxxxxx
> > > Subject: [C400-L] Example of using Display Files as binary stream
files
> > >
> > > Hi All,
> > > Does anybody have an example of using Display files with fopen,
> fwrite...
> > > functions? All I could find in the documentation that this is
possible.
> > >
> > > Or an example of a C program writing into a USRDFN record.
> > >
> > > Any input is highly appreciated
> > > Thanks
> > > _______________________________________________
> > > This is the C programming iSeries / AS400 (C400-L) mailing list
> > > To post a message email: C400-L@xxxxxxxxxxxx
> > > To subscribe, unsubscribe, or change list options,
> > > visit: http://lists.midrange.com/mailman/listinfo/c400-l
> > > or email: C400-L-request@xxxxxxxxxxxx
> > > Before posting, please take a moment to review the archives
> > > at http://archive.midrange.com/c400-l.
> >
> >
> >
> > ------------------------------
> >
> > _______________________________________________
> > This is the C programming iSeries / AS400 (C400-L) digest list
> > To post a message email: C400-L@xxxxxxxxxxxx
> > To subscribe, unsubscribe, or change list options,
> > visit: http://lists.midrange.com/mailman/listinfo/c400-l
> > or email: C400-L-request@xxxxxxxxxxxx
> > Before posting, please take a moment to review the archives
> > at http://archive.midrange.com/c400-l.
> >
> >
> >
> > End of C400-L Digest, Vol 2, Issue 47
> > *************************************
> >
> > __________ NOD32 1.826 (20040729) Information __________
> >
> > This message was checked by NOD32 antivirus system.
> > http://www.nod32.com
> >
> >
>
>
>
> ------------------------------
>
> message: 3
> date: Thu, 29 Jul 2004 14:32:33 -0400
> from: phillip.groschwitz@xxxxxxxxx
> subject: Re: [C400-L] Re: using display files in C
>
>
> >I'm coming from windows/linux environment where C and Java has been all I
> >need so far. I was trying to avoid learning another, very platform
> oriented,
> >language,
>
> You could use embedded sql in C.  You'll need to learn a few things
> specific to the iSeries but not a whole language, and the sql code will be
> a lot more portable than the RPG code.
>
> >especially while hearing in the background about how RPG may
> >become obsolete.
>
> I doubt that'll happen anytime soon.
>
> >I just hope I will not be spending a lot of time trying to get C and RPG
> >working together (for example parameter passing and type compatibility).
> >Is there any learning material or good books that you can point out?
>
> This may be helpful:
> http://www.opensource400.org/callc.html
>
> The RPG400-L list may be helpful.
>
> Phil
>
>
>
>
> ------------------------------
>
> message: 4
> date: Fri, 30 Jul 2004 15:36:25 +1000
> from: Simon Coulter <shc@xxxxxxxxxxxxxxxxx>
> subject: Re: [C400-L] Example of using Display Files as binary stream
> files
>
>
> On 30/07/2004, at 1:41 AM, Boris wrote:
>
> > Does anybody have an example of using Display files with fopen,
> > fwrite... functions? All I could find in the documentation that this
> > is possible.
>
> Display files are record oriented files so use the _R functions not the
> stream functions. The ILE C Programmer's has examples. See Chapter 8
> Using Device Files in Your ILE C Programs
>
> Note: Section 8.4 says that fopen, fwrite, etc are only useful for
> message subfiles.
>
> Regards,
> Simon Coulter.
> --------------------------------------------------------------------
>     FlyByNight Software         AS/400 Technical Specialists
>
>     http://www.flybynight.com.au/
>     Phone: +61 3 9419 0175   Mobile: +61 0411 091 400        /"\
>     Fax:   +61 3 9419 0175                                   \ /
>                                                               X
>                   ASCII Ribbon campaign against HTML E-Mail  / \
> --------------------------------------------------------------------
>
>
>
>
> ------------------------------
>
> message: 5
> date: Fri, 30 Jul 2004 09:09:54 +0300
> from: "Jevgeni Astanovski" <J.Astanovski@xxxxxxxxxxxx>
> subject: RE: [C400-L] Example of using Display Files as binary stream
> files
>
> Can I ask you one thing, Boris?
> Why are you so definite in trying to use fopen and fwrite? _Ropen and
_Rwrite are intended to do the job.
> And they do it despite of what Bob is saying - its not driving a screw
with a hammer. Nothing but C programming.
>
> Another question is if display files can be read nad written as streams.
Is it really possible formally - I mean does OS/400 allow this sort of
tricks?
>
> Jevgeni.
>
>
>
> > -----Original Message-----
> > From: Boris [mailto:bbresc512@xxxxxxxxxx]
> > Sent: Thursday, July 29, 2004 6:42 PM
> > To: c400-l@xxxxxxxxxxxx
> > Subject: [C400-L] Example of using Display Files as binary
> > stream files
> >
> >
> > Hi All,
> > Does anybody have an example of using Display files with
> > fopen, fwrite... functions? All I could find in the
> > documentation that this is possible.
> >
> > Or an example of a C program writing into a USRDFN record.
> >
> > Any input is highly appreciated
> > Thanks
> > _______________________________________________
> > This is the C programming iSeries / AS400 (C400-L) mailing list
> > To post a message email: C400-L@xxxxxxxxxxxx
> > To subscribe, unsubscribe, or change list options,
> > visit: http://lists.midrange.com/mailman/listinfo/c400-l
> > or email: C400-L-request@xxxxxxxxxxxx
> > Before posting, please take a moment to review the archives
> > at http://archive.midrange.com/c400-l.
> >
> >
>
>
>
> ------------------------------
>
> message: 6
> date: Fri, 30 Jul 2004 16:36:40 +1000
> from: Simon Coulter <shc@xxxxxxxxxxxxxxxxx>
> subject: Re: [C400-L] Example of using Display Files as binary stream
> files
>
>
> On 30/07/2004, at 4:09 PM, Jevgeni Astanovski wrote:
>
> > Another question is if display files can be read nad written as
> > streams. Is it really possible formally - I mean does OS/400 allow
> > this sort of tricks?
>
> No. Only message sub-files can be treated as streams--though why anyone
> would want to is beyond me.
>
> Regards,
> Simon Coulter.
> --------------------------------------------------------------------
>     FlyByNight Software         AS/400 Technical Specialists
>
>     http://www.flybynight.com.au/
>     Phone: +61 3 9419 0175   Mobile: +61 0411 091 400        /"\
>     Fax:   +61 3 9419 0175                                   \ /
>                                                               X
>                   ASCII Ribbon campaign against HTML E-Mail  / \
> --------------------------------------------------------------------
>
>
>
>
> ------------------------------
>
> _______________________________________________
> This is the C programming iSeries / AS400 (C400-L) digest list
> To post a message email: C400-L@xxxxxxxxxxxx
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/mailman/listinfo/c400-l
> or email: C400-L-request@xxxxxxxxxxxx
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/c400-l.
>
>
>
> End of C400-L Digest, Vol 2, Issue 48
> *************************************
>
> __________ NOD32 1.827 (20040729) Information __________
>
> This message was checked by NOD32 antivirus system.
> http://www.nod32.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.