|
Yes, Richard. It works the same way the defined function in "C" works. You can also use the define functions on the CRTBNDxxx and CRTxxxMOD commands to define them "on the fly". I use this to set conditions for different release options in software that I distribute. I use it mainly in demos and beta releases to set a stop date parameter, but I also use it especially for intrasystem communications. I have functions using Sockets routines, DDM files and Data Queues and ICFF files for binary or system to system functions. I can compile with one, two (any two) or all. The code looks like hell when it's finished because of all the /IF DEFINED statements, but it works. John -----Original Message----- From: Richard B Baird [mailto:rbaird@xxxxxxxxxxxxxxxxxxxxx] Sent: Friday, June 13, 2003 5:46 PM To: RPG programming on the AS400 / iSeries Subject: RE: /if, /define, binder language John, so what you're saying is that i might have the same code in several different copy books used in the same program and that, in the example you gave, it 'defines APIDS' the first time it copys, and won't copy the code again. Could you use it to only copy the prototypes you use in the program? for instance, if I have a copybook that has 20 prototypes, but I only use 2 of them, can I put this in my main program: /DEFINE STRING_FUNCT1 /DEFINE STRING_FUNCT2 /copy qrpgsrc,str_svcpgm and in my str_svcpgm copybook, say this: /IF DEFINED STRING_FUNCT1 ... source for prototype STRING_FUNCT1 /ENDIF /IF DEFINED STRING_FUNCT2 ... source for prototype STRING_FUNCT2 /ENDIF /IF DEFINED STRING_FUNCT3 ... source for prototype STRING_FUNCT3 /ENDIF which would cause it to stop copying at the 2nd prototype? am I on the right track here? Thanks, Rick ----original message---------- If you have a common routine or declaration, you can put the /copy in multiple members. It will not compile the code if the defined name is already defined. /IF NOT DEFINED(APIDS) /DEFINE APIDS ************************************************************* * Definition for error code data structure ************************************************************* * Api Error Data Structure (Copy of QUSEC, but renamed) D ApiErr DS D AeBytesProv 10I 0 Inz(%Size(ApiErr)) D AeBytesAvl 10I 0 D AeMsgId 7A D AeErrNum 1A D AeMsgDta 256A /ENDIF _______________________________________________ This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l. --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.489 / Virus Database: 288 - Release Date: 6/10/03 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.489 / Virus Database: 288 - Release Date: 6/10/03
As an Amazon Associate we earn from qualifying purchases.
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.