Let's be honest, if you are running on a 400, your time is running out. We have a number of very efficient platform migration mechanisms to get you on a more modern platform - and perhaps one that can move to the cloud.
I do like the AS/400, I get on that thing and can do all the admin tasks I need - but it's done. I have a client that wants to move all their AS/400 data to some "datalake" and then farm it with custom queries. I do NOT recommend this as an approach, as you will spend all of your time reverse engineering the data and logic to understand what you had.
I recommend putting the data on ice, in a database that you've probably paid for... then if you need to access or search the data, use the familiar JDE interface. Cloud is perfect for this, your footprint in terms of $$ is miniscule and you can bring the system up - as and when you need. This is the perfect choice for archival or retuirement.
Anyway, back to the post. This is for when I do it next time.
What I will tell you about the script below, is that it works - yay
Save it as a .vbs file (mine is called downloadDataPRODDTA) and run with
>wscript.exe /h:cscript //E:vbscript downloadDataPRODDTA.vbs
The thing about this is that it was running on an old server (oh, did I mention the AS/400)? The old server.
Note that my script is a little more complex, in terms of the files that it uses for t he download, as it is only grabbing the tables with data, this is easy - you can search my blog for how to create the datacounts file.
drop table proddta.rowcounts;
commit;
create table proddta.rowcounts (table_name varchar (120), AS400_count integer, oracle_count integer) ;
insert into proddta.rowcounts (
select table_name, 0, 0
from qsys2.systables t1
where table_schema = 'PRODDTA');
''Run the results of this
select 'UPDATE PRODDTA.ROWCOUNTS set AS400_count = ( SELECT COUNT(1) FROM ' || 'PRODDTA.' || table_name || ' ' || ') WHERE table_name = ''' || table_name || ''';'
from qsys2.systables t1
where table_schema = 'PRODDTA' ;
The following will give you a nice summary
select table_name, simd, AS400_count
from proddta.rowcounts, ol7333.f9860
where ltrim(rtrim(siobnm)) = ltrim(rtrim(table_name))
and AS400_count > 0 order by AS400_count desc
Now you are ready to start the export of tables that have rows. Note that some have blobs and they do not behave so they have also been excluded.
1.5GB is taking about 15 minutes on this old dog - so it's doing okay.
No comments:
Post a Comment