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




You could something like the code below
sprintf(cmdString,"CPYF FROMFILE(%s/%s) TOFILE (FTPLIB/FILEX) FROMMBR(%s) TOMBR(%s) MBROPT(*REPLACE) FMTOPT(*NOCHK)\0", FRMBR,TOMBR);
system(cmdString);
Where the FRMMBR and TOMBR are Char 10 variables


Thanks
Tony > From: c400-l-request@xxxxxxxxxxxx> Subject: C400-L Digest, Vol 6, Issue 46> To: c400-l@xxxxxxxxxxxx> Date: Mon, 17 Nov 2008 12:00:02 -0600> > 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. Neater way of preparing call to system() (Olsson Erik)> 2. Re: Neater way of preparing call to system() (Terrence Enger)> 3. Re: Neater way of preparing call to system() (Ulrich, Kent)> 4. Re: Neater way of preparing call to system() (Jevgeni Astanovski)> 5. Re: Neater way of preparing call to system() (Lindbom, Joakim)> 6. Re: Neater way of preparing call to system() (Olsson Erik)> > > ----------------------------------------------------------------------> > message: 1> date: Mon, 17 Nov 2008 15:02:25 +0100> from: "Olsson Erik" <erik.eo.olsson@xxxxxxxxx>> subject: [C400-L] Neater way of preparing call to system()> > I need to issue a CPYF using system() that would look something like this> from RPG:> > cmdstring = 'CPYF FROMFILE(MYLIB/MYFILE) TOFILE+> (FTPLIB/FILEX) FROMMBR(' + %trimr(pmbr) +') +> TOMBR(' + %trimr(pmbr) + ') MBROPT(*REPLACE) FMTOPT(*NOCHK)';> > That is, the command is hard coded except for the member names, which can be> anywhere between 2 and 10 bytes.> Does anyone have any good suggestions for a C/C++ equivalent? The best I can> come up with at present includes a lot of inserts and appends and would take> several lines.> > Thanks,> Erik> > > ------------------------------> > message: 2> date: Mon, 17 Nov 2008 09:44:12 -0500> from: Terrence Enger <tenger@xxxxxxxxxxxxxxxx>> subject: Re: [C400-L] Neater way of preparing call to system()> > On Mon, 2008-11-17 at 15:02 +0100, Olsson Erik wrote:> > I need to issue a CPYF using system() that would look something like this> > from RPG:> > > > cmdstring = 'CPYF FROMFILE(MYLIB/MYFILE) TOFILE+> > (FTPLIB/FILEX) FROMMBR(' + %trimr(pmbr) +') +> > TOMBR(' + %trimr(pmbr) + ') MBROPT(*REPLACE) FMTOPT(*NOCHK)';> > > > That is, the command is hard coded except for the member names, which can be> > anywhere between 2 and 10 bytes.> > Does anyone have any good suggestions for a C/C++ equivalent? The best I can> > come up with at present includes a lot of inserts and appends and would take> > several lines.> > > > Thanks,> > Erik> > Erik,> > You might want to us sprintf() for pasting together the parts of your> command. Something like ...> > #include <stdio.h>> > int> main( int argc, char * argv[] )> {> char pmbr[] = "THING";> char cmdstring[256];> int written;> written = > sprintf( cmdstring> , "CPYF FROMFILE(MYLIB/MYFILE) TOFILE(FTPLIB/FILEX) "> "FROMMBR(%s) TOMBR(%s) MBROPT(*REPLACE) "> "FMTOPT(*NOCHK)"> , pmbr, pmbr );> printf( "command string, of length %i, is ...\n %s\n"> , written, cmdstring );> return 0;> } /* main() */> > Cheers,> Terry.> > > > > ------------------------------> > message: 3> date: Mon, 17 Nov 2008 09:45:03 -0500> from: "Ulrich, Kent" <Kent.Ulrich@xxxxxxx>> subject: Re: [C400-L] Neater way of preparing call to system()> > You could use something like:> sprintf(CommandString,> "CPYF" > " FROMFILE(MILIB/MYFILE)"> " TOFILE(FTPLIB/FILEX)"> " FROMMBR(%s)"> " TOMBR(%s)"> " MBROPT(*REPLACE)"> " FMTOPT(*NOCHK)", > FromMemberName,> ToMemberName);> > Kent> > > -----Original Message-----> From: c400-l-bounces+kent.ulrich=lfg.com@xxxxxxxxxxxx> [mailto:c400-l-bounces+kent.ulrich=lfg.com@xxxxxxxxxxxx]On Behalf Of> Olsson Erik> Sent: Monday, November 17, 2008 9:02 AM> To: C programming iSeries / AS400> Subject: [C400-L] Neater way of preparing call to system()> > > I need to issue a CPYF using system() that would look something like this> from RPG:> > cmdstring = 'CPYF FROMFILE(MYLIB/MYFILE) TOFILE+> (FTPLIB/FILEX) FROMMBR(' + %trimr(pmbr) +') +> TOMBR(' + %trimr(pmbr) + ') MBROPT(*REPLACE) FMTOPT(*NOCHK)';> > That is, the command is hard coded except for the member names, which can be> anywhere between 2 and 10 bytes.> Does anyone have any good suggestions for a C/C++ equivalent? The best I can> come up with at present includes a lot of inserts and appends and would take> several lines.> > Thanks,> Erik> -- > 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.> > > > > > Notice of Confidentiality: **This E-mail and any of its attachments may contain > Lincoln National Corporation proprietary information, which is privileged, confidential,> or subject to copyright belonging to the Lincoln National Corporation family of > companies. This E-mail is intended solely for the use of the individual or entity to > which it is addressed. If you are not the intended recipient of this E-mail, you are > hereby notified that any dissemination, distribution, copying, or action taken in > relation to the contents of and attachments to this E-mail is strictly prohibited > and may be unlawful. If you have received this E-mail in error, please notify the > sender immediately and permanently delete the original and any copy of this E-mail > and any printout. Thank You.**> > > > ------------------------------> > message: 4> date: Mon, 17 Nov 2008 16:50:27 +0200> from: Jevgeni Astanovski <Jevgeni.Astanovski@xxxxxxxxxxxx>> subject: Re: [C400-L] Neater way of preparing call to system()> > Hi Erik,> > there are 2 possibilities I used for that purpose:> 1. STRCPY.> Looks like this (extract from my program):> strcpy(szStr, "CRTDUPOBJ OBJ( ) FROMLIB( ) TOLIB(QTEMP) OBJTYPE(*FILE)") ;> memcpy(&szStr[34], KLIB, 7);> memcpy(&szStr[14], RepFileName, 10) ;> r1 = system(szStr) ;> I just leave empty spaces in the places, that receive values, because this CRTDUPOBJ is used more that once...> 2. SPRINTF> sprintf(szStr, "CRTDUPOBJ OBJ(%s) FROMLIB(%s) TOLIB(QTEMP) OBJTYPE(*FILE)", KLIB, RepFileName);> r1 = system(szStr) ;> Here you must be sure, that strings KLIB and RepFileName (in my example) must be zero-terminated, otherwise you are in trouble.> If these strings are not zero-terminated, you must zero terminate them.> Do you need a code example that does that (trims spaces from the right and adds 0x00)?> > HTH> Jevgeni.> > > > > -----Original Message-----> > From:> > c400-l-bounces+jevgeni.astanovski=sampopank.ee@xxxxxxxxxxxx> > [mailto:c400-l-bounces+jevgeni.astanovski=sampopank.ee@midrang> > e.com]On Behalf Of Olsson Erik> > Sent: Monday, November 17, 2008 4:02 PM> > To: C programming iSeries / AS400> > Subject: [C400-L] Neater way of preparing call to system()> >> >> > I need to issue a CPYF using system() that would look> > something like this> > from RPG:> >> > cmdstring = 'CPYF FROMFILE(MYLIB/MYFILE) TOFILE+> > (FTPLIB/FILEX) FROMMBR(' + %trimr(pmbr) +') +> > TOMBR(' + %trimr(pmbr) + ') MBROPT(*REPLACE)> > FMTOPT(*NOCHK)';> >> > That is, the command is hard coded except for the member> > names, which can be> > anywhere between 2 and 10 bytes.> > Does anyone have any good suggestions for a C/C++ equivalent?> > The best I can> > come up with at present includes a lot of inserts and appends> > and would take> > several lines.> >> > Thanks,> > Erik> > --> > 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: 5> date: Mon, 17 Nov 2008 16:37:50 +0100> from: "Lindbom, Joakim" <joakim.lindbom@xxxxxxxxxxxxx>> subject: Re: [C400-L] Neater way of preparing call to system()> > I normally use something like:> > sprintf (cmd, "RMVM %s/%s %s ", Lib, Obj, Member);> if (system (cmd) != 0) {> // some error handling> }> > In this case Lib, Obj and member are null terminated char arrays.> char Lib[11];> char Obj[11];> char Member[11];> char cmd[200];> > /Joakim> > -----Original Message-----> From: c400-l-bounces+joakim.lindbom=capgemini.com@xxxxxxxxxxxx [mailto:c400-l-bounces+joakim.lindbom=capgemini.com@xxxxxxxxxxxx] On Behalf Of Olsson Erik> Sent: den 17 november 2008 15:02> To: C programming iSeries / AS400> Subject: [C400-L] Neater way of preparing call to system()> > I need to issue a CPYF using system() that would look something like this> from RPG:> > cmdstring = 'CPYF FROMFILE(MYLIB/MYFILE) TOFILE+> (FTPLIB/FILEX) FROMMBR(' + %trimr(pmbr) +') +> TOMBR(' + %trimr(pmbr) + ') MBROPT(*REPLACE) FMTOPT(*NOCHK)';> > That is, the command is hard coded except for the member names, which can be> anywhere between 2 and 10 bytes.> Does anyone have any good suggestions for a C/C++ equivalent? The best I can> come up with at present includes a lot of inserts and appends and would take> several lines.> > Thanks,> Erik> --> 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.> > > Capgemini is a trading name used by the Capgemini Group of companies which includes Capgemini Sverige AB, a company registered in Sweden (number 556092-3053) whose registered office is at Gustavslundsv?gen 131 Box 825 - S-161 24 Bromma.> > > > > > > This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is > intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to > read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message > in error, please notify the sender immediately and delete all copies of this message.> > > > ------------------------------> > message: 6> date: Mon, 17 Nov 2008 17:39:40 +0100> from: "Olsson Erik" <erik.eo.olsson@xxxxxxxxx>> subject: Re: [C400-L] Neater way of preparing call to system()> > Thank you all. I'll go with the sprintf version.> > /Erik> > 2008/11/17 Lindbom, Joakim <joakim.lindbom@xxxxxxxxxxxxx>> > > I normally use something like:> >> > sprintf (cmd, "RMVM %s/%s %s ", Lib, Obj, Member);> > if (system (cmd) != 0) {> > // some error handling> > }> >> > In this case Lib, Obj and member are null terminated char arrays.> > char Lib[11];> > char Obj[11];> > char Member[11];> > char cmd[200];> >> > /Joakim> >> > -----Original Message-----> > From: c400-l-bounces+joakim.lindbom=capgemini.com@xxxxxxxxxxxx [mailto:> > c400-l-bounces+joakim.lindbom <c400-l-bounces%2Bjoakim.lindbom>=> > capgemini.com@xxxxxxxxxxxx] On Behalf Of Olsson Erik> > Sent: den 17 november 2008 15:02> > To: C programming iSeries / AS400> > Subject: [C400-L] Neater way of preparing call to system()> >> > I need to issue a CPYF using system() that would look something like this> > from RPG:> >> > cmdstring = 'CPYF FROMFILE(MYLIB/MYFILE) TOFILE+> > (FTPLIB/FILEX) FROMMBR(' + %trimr(pmbr) +') +> > TOMBR(' + %trimr(pmbr) + ') MBROPT(*REPLACE) FMTOPT(*NOCHK)';> >> > That is, the command is hard coded except for the member names, which can> > be> > anywhere between 2 and 10 bytes.> > Does anyone have any good suggestions for a C/C++ equivalent? The best I> > can> > come up with at present includes a lot of inserts and appends and would> > take> > several lines.> >> > Thanks,> > Erik> > --> > 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.> >> >> > Capgemini is a trading name used by the Capgemini Group of companies which> > includes Capgemini Sverige AB, a company registered in Sweden (number> > 556092-3053) whose registered office is at Gustavslundsv?gen 131 Box 825 -> > S-161 24 Bromma.> >> >> >> >> >> >> > This message contains information that may be privileged or confidential> > and is the property of the Capgemini Group. It is> > intended only for the person to whom it is addressed. If you are not the> > intended recipient, you are not authorized to> > read, print, retain, copy, disseminate, distribute, or use this message or> > any part thereof. If you receive this message> > in error, please notify the sender immediately and delete all copies of> > this message.> >> > --> > 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 6, Issue 46> *************************************
_________________________________________________________________
See how Windows® connects the people, information, and fun that are part of your life
http://clk.atdmt.com/MRT/go/119463819/direct/01/

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.