I have 12 (monthly) identical files that I need to read based on the current month.
They look like this:
01 FILE01 VIEW OF ACCT01
02 ACCOUNT-NUMBER (N13)
*
*
01 FILE12 VIEW OF ACCT12
02 ACCOUNT-NUMBER (N13)
Dynamic code is not an option since I need the object in production.
First idea was to have a driver that wiould decide on 12 CALLNATs based on the current month from *DATX.
Now I am thinking about using COPYCODE as follows:
Natural needs to be able to determine the values at compiletime !
So a rewritten version could be possible with dynamic programming if you were allowed to use that.
I can’t quite see how you can avoid having a decide- statement or similar
like below.
regards Finn
DECIDE ON FIRST VALUE OF #MONTH
VALUE 1
INCLUDE TESTC ‘ACCT01’
VALUE 2
INCLUDE TESTC ‘ACCT02’
…
Note:
Because &n& is a valid part of an identifier, this notation may not be used as a copy code parameter substitution in other positions described above (i.e. abc&1& or &1&abc&2&). In other words, a string may only come after copy code parameters, not before or between.
In other words, it is legal to have something like:
We ate talking about 12 files that have each around 20M records and lots of keys. They were created over 20 years ago and still have some updates done by direct calls. An effort to consolidate all of them in one file would means changes on almost 50% of the application, as I have been told…