I have tables defined in the Data Dictionary in PxPlus 2023 version that I need to replicate in the same dictionary.
All of the files are labeled beginning with 'Cx' where x is the company identifier. For example, the customer master file for Company 1 is 'C1ARCUST'.
I need to copy all of the elements in 'C1ARCUST' to 'C2ARCUST'. Everything is identical except for the number at position 2. I see where this is doable one file at a time under Copy but am wondering if the is a bulk copy utility do all of the C1 files at one time.
Thanks!
Tom
Here is a routine I use on Windows to copy all files in a directory.
You can tweak it to change the filenames.
40400 COPY_DIR:! ^0200
40410 local fr_file$,to_file$,file_list$,command$
40420 ! needs fully pathed source$ and dest$
40430 source$=sub(source$,"/","\")
40440 call "*dirtree",source$,file_list$,sep,0
40450 while not(nul(file_list$))
40460 fr_file$=file_list$(1,pos(sep=file_list$)-1),file_list$=file_list$(pos(sep=file_list$)+1)
40470 to_file$=sub(fr_file$,source$,dest$)
40472 module$=fr_file$(pos("\"=fr_file$,-2)+1,2)
40474 if pos(module$=module_skip_list$,2) then continue
40480 ! Create any sub directories needed
40490 for i=1 to pos("\"=to_file$,1,0)
40500 directory to_file$(1,pos("\"=to_file$,1,i)),err=*next
40510 next i
40520 erase to_file$,err=*next
40530 command$=env("comspec")+" /c copy "+fr_file$+" "+to_file$
40540 invoke wait hide command$
40550 wend
40560 return
Jim,
I may be looking at this incorrectly but it looks like this simply copies file 'A' to file 'B'.
What I need is to copy the file definition as contained in the files 'providex.dde and providex.ddf leaving the original data definition unchanged.
Tom
In the data dictionary, could you change the physical file from 'C1ARCUST' to an expression like "C"+%COMPANY$+"ARCUST"? Then if you set %COMPANY$ to "1" or "2" or whatever you can use the same data dictionary definition for both files.
Jane,
That's not a bad idea. The problem is that I would need to change the file open logic in 200 - 300 programs.
Would it be feasible to read 'providex.ddf' and 'providex.dde', modify the records containing 'C1' and create a new record for 'C2'?
Thanks!
Tom
I wouldn't recommend that approach as there is special logic for assigning the external keys for the ddf file.