|
Chris wrote in RPG400-L: >I need to have a cl program pass a >variable to either a rpg or cl program. > >This variable is the file name that >the program needs to read from. I think we covered this ground before (a generic read has little practical application) but I thought I'd post some ReXX code that does a generic open/read. This displays records on the screen and has no error handling, but it answers the original poster's question. I am posting it here because a) It isn't RPG b) There isn't that much information about ReXX /* Open a generic file */ /* To use, put in QREXSRC, member READF and run the following CL: */ /* STRREXPRC SRCMBR(READF) PARM('READF QREXSRC *LIBL') */ /* Input arguments */ PARSE ARG frommbr fromfile fromlib rcdCount = 0 rcdLimit = 50 /* Override STDIN to the DB2 file */ 'OVRDBF FILE(STDIN) TOFILE(&FROMLIB/&FROMFILE) MBR(&FROMMBR)' /* Read a line from the file */ Read: PARSE PULL dtaInput rcdCount = rcdCount + 1 /* Record limit */ IF rcdCount > rcdLimit THEN DO SAY 'Record limit ('rcdLimit') reached' SIGNAL Exit END /* record is NULL at EOF */ IF dtaInput <> '' THEN DO SAY dtaInput SIGNAL Read END Say 'EOF reached' Exit: RETURN Buck Calabro Aptis; Albany, NY "We are what we repeatedly do. Excellence, then, is not an act, but a habit." --Aristotle Billing Concepts Corp., a NASDAQ Listed Company, Symbol: BILL +--- | 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 mailing list archive is Copyright 1997-2025 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.