1,025 pts.
 AS400 – COPYBOOK
I have changed Copy Book which is used in two programs. I have defined the Copybook Using /COPY LIBRARY/QRPGLESRC CPYBK1. Is there any possiblity to change Library and Source Physical File Name Dynamically?

Software/Hardware used:
ASKED: February 22, 2011  1:58 PM
UPDATED: February 23, 2011  4:24 PM

Answer Wiki:
Without a whole lot of work, you cannot change FILENAME. But, if you do not specify the LIBRARy, it will use *LIBL. I'd be interested to know why you would want to do this. It seems like it could cause a potential problem down the line, ==================================================================== CharlieBrown, In a Change Management Environment when Promoting either the copybook and/or the programs from a Developers Library up to Test and/or Production, you would want the Libraries to change dynamically based on the library list. Hope this helps, Bill Poulin ========= Thanks BIl I should have mentioned that. We use MKS so that happens all the time.
Last Wiki Answer Submitted:  February 23, 2011  4:24 pm  by  wpoulin   2,480 pts.
All Answer Wiki Contributors:  wpoulin   2,480 pts. , CharlieBrowne   32,855 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Is there any possiblity to change Library and Source Physical File Name Dynamically?

When do you want to change it?

You can change it at run-time by using condition names in the DEFINE() parameter and coding your /COPY members with Conditional Compilation Directives. You can code your /COPY member to supply different values that depend what you supply in the DEFINE() parameter.

In your case you could have one /COPY member that would supply either a nested /COPY statement for LIBRARYA or another one for LIBRARYB. By nesting /COPY statements and choosing different ones under different conditions, you can get any final result you need.

But that has to happen at compile-time.

There is no way to affect a /COPY statement at any other time.

Tom

 108,055 pts.

 

Typo correction –

You can change it at run-time by using…

Should be:

You can change it at compile-time by using…

Tom

 108,055 pts.