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



Hi,

Native I/O may be slower than native I/O, because you read record by record
and write record by record.
With copy file a complete block, i.e. a couple of rows might be copied (read
and written) at time.
If you want to replace native I/O with RPG, I'd either use QCMDEXC to
execute the CL-command CPYF or I'd use embedded SQL.

Just like Vern, I can't imagine why you want to replace a native CL with
RPG.
ILE means take the language which is the best to do the job.

Mit freundlichen Grüßen / Best regards

Birgitta Hauser

"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and loosing them? Not training them
and keeping them!"

-----Ursprüngliche Nachricht-----
Von: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] Im
Auftrag von donna lester
Gesendet: Tuesday, 30. September 2008 00:42
An: rpg400-l@xxxxxxxxxxxx
Betreff: Re writing CL in RPG

Hi
Below is my code. I am trying to replace copy commands program by writing
RPGLE.
Is this a good design , will this run faster? I would like to know your
opinions and suggestions.
Thank you for your time. The number of records in AFILE usually more than a
million.



LOOP: RCVF
MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(END))

CPYF FROMFILE(*LIBL/ABC.FILE) +
TOFILE(*LIBL/XYZ.MONY) MBROPT(*ADD) +
INCREL((*IF MID *EQ &YID) (*AND +
MNAME *EQ &YNAME) (*AND MACCT *EQ &YACCT))
CPYF FROMFILE(*LIBL/AFILE) +
TOFILE(*LIBL/BFILE) MBROPT(*ADD) +
INCREL((*IF PID *EQ &YID) (*AND +
PNAME *EQ &YNAME) (*AND PACCT *EQ &YACCT))

GOTO CMDLBL(LOOP)

END: CPYF FROMFILE(*LIBL/ABC.FILE) +
TOFILE(*LIBL/XYZ.MONY) MBROPT(*ADD) +
INCREL((*IF MID *EQ F))
TOFILE(*LIBL/XYZ.MONY) MBROPT(*ADD) +
INCREL((*IF MID *EQ F))
CPYF FROMFILE(*LIBL/AFILE) +
TOFILE(*LIBL/BFILE) MBROPT(*ADD) +
INCREL((*IF PID *EQ F))


=========================
* Copy data from ABCFILE by ID, NAME, Acct
C k_idnamacc Setll ABCFILE
C Read ABCFILE
C DoW Not %Eof(ABCFILE) and MID = YID
C and MNAME = YNAME and MACCT = YAcct
C Write XYZMNYREC

C Read ABCFILE
C EndDo

* copy data from AFILE by ID, NAME, Acct
C k_idnamacc Setll AFILE
C Read AFILE
C DoW Not %Eof(AFILE) and PID = YID
C and PNAME = YNAME and PACCT = YAcct
C Write XYZPOSREC
C Read AFILE
C EndDo
*
C Read GEUKACT
C Enddo
*
* Copy ABCFILE records for ID F
C 'F' Setll ABCFILE
C Read ABCFILE
C DoW Not %Eof(ABCFILE) and MID = 'F'
C Write XYZMNYREC
C Read ABCFILE
C EndDo
*
* Copy AFILE records for ID F
C 'F' Setll AFILE
C Read AFILE
C DoW Not %Eof(AFILE) and PID = 'F'
C Write XYZPOSREC
C Read AFILE
C EndDo
*
C Eval *inlr = *on


C *InzSr Begsr

C k_idnamacc KList
C KFld YID
C KFld YNAME
C KFld YACCT

C Endsr

Donna.




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.