|
Ahha!! it is source code this is all about !!
in that case i use git and export all the source from any library with this
little gist:
The source can be found here:
https://gist.github.com/NielsLiisberg/97cc1ff39a4e219927a70078ec05df61
It is a simple stored procedure:
-- This is a tool to export all source physical filemembers on IBM i
-- to a git repo to keep track of changes over time
-- This requires the BASH stored procedure found on my gist:
-- https://gist.github.com/NielsLiisberg/7be6395b137b3379430782dc13d1a1e6
-------------------------------------------------------------------
-- Change the names to your names/repos/mail addr etc. and Run this once in
ACS :
call qusrsys.bash ('
mkdir /passivegit;
cd /passivegit;
git init;
git remote add origin git@xxxxxxxxxxxxxxxxx:
Liisberg/passive-git-myibmi.git;
git config --global user.email "nli@xxxxxxxxxxxxxxxx";
git config --global user.name "Niels Liisberg"
');
-- Change the ccsid and which libraries and files to your needs in the
following
-- and build this stored procedure in you own library ( here I am just
using QGPL)
create or replace procedure qgpl.export_source_to_git
set option dbgview=*source, output=*print, commit=*none, datfmt=*iso
begin
declare cmd varchar(4096);
declare err int;
declare sqlcode int;
declare lib char(10);
declare file char(10);
declare mbr char(10);
declare ext char(10);
declare ts char(19) ;
declare c1 cursor for
Select
TABLE_NAME ,
TABLE_SCHEMA,
TABLE_PARTITION,
source_type
from systables join TABLE (
QSYS2.PARTITION_STATISTICS(
cast (TABLE_SCHEMA as char(10)) , cast(TABLE_NAME as
char(10))
)
) a on 1=1
where file_type = 'S'
and system_table_schema not like 'Q%';
-- and system_table_schema = 'MYONLYLIB';
-- and TABLE_NAME = 'QMYONLYSRCE';
declare continue handler for sqlstate '38501' set err = 1 ;
set ts = to_char(now(), 'YYYY-MM-DD-HH24-MM-SS');
open c1;
fetch c1 into file, lib , mbr , ext ;
while sqlcode = 0 do
set err = 0;
if mbr is not null then
call qusrsys.bash ('mkdir -p /passivegit/' || rtrim(lower(lib))
|| '/' || rtrim(lower(file)) || ' 2>/dev/null');
if err = 0 then
set cmd = 'CPYTOSTMF FROMMBR(''/QSYS.LIB/'
|| rtrim(lib) || '.LIB/'
|| rtrim(file) || '.FILE/'
|| rtrim(mbr) || '.MBR'')'
|| ' TOSTMF('''
|| lower('/passivegit/')
|| lower(rtrim(lib)) || '/'
|| lower(rtrim(file)) || '/'
|| lower(rtrim(mbr)) || '.'
|| lower(rtrim(ifnull(ext,'UNKNOWN'))) || ''')
STMFOPT(*REPLACE) DBFCCSID(277) STMFCCSID(1208)';
call qcmdexc (cmd) ;
end if;
end if;
fetch c1 into file, lib , mbr , ext ;
end while;
call qusrsys.bash ('cd /passivegit;git add .;git commit -m "' || ts ||
'";git push');
end;
-- This is the call
call qgpl.export_source_to_git;
/* And you can now add this to the job-scheduler runnineach night:
RUNSQL SQL('call qgpl.export_source_to_git')
COMMIT(*NONE)
*/
On Wed, Jul 5, 2023 at 7:42 AM Birgitta Hauser <Hauser@xxxxxxxxxxxxxxx>
wrote:
... and even if it is to slow it could be included in an MQT(Materialized
Query Table), which can be refreshed manually (unfortunately theautomatic
REFRESH is not yet implemented).them
Mit freundlichen Grüßen / Best regards
Birgitta Hauser
Modernization – Education – Consulting on IBM i
IBM Champion since 2020
"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training
and keeping them!"recreation
"Train people well enough so they can leave, treat them well enough so
they don't want to. " (Richard Branson)
"Learning is experience … everything else is only information!" (Albert
Einstein)
-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Daniel
Gross
Sent: Tuesday, 4 July 2023 22:16
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: Regarding source physical file
Full Ack for "bad idea", but in fact, with today's SQL you can really
make
it very dynamic.
Just take a look at this GIST from Birgitta:
[1]gist-og-image.png
[2]List all Source Code Lines - for Scan
gist.github.com
Could easily be wrapped in a view or in a UDTF.
Daniel
Am 04.07.2023 um 19:34 schrieb Jon Paris <jon.paris@xxxxxxxxxxxxxx
:
Agreed Daniel, except that you would have to automate the
ofwrote:
the View/UDTF to account for new/deleted source members.
It is really just a bad idea.
Jon P.
On Jul 4, 2023, at 12:37 PM, Daniel Gross <daniel@xxxxxxxx>
source
Of course - WHY? Is a good question.
But I would create
a) a table function (UDTF)
or
b) a view
which consolidates all members in one “query”.
In this case there would be no “not-up-to-date” problem.
But I also see no real advantage of this - better place your
into IFS and use GIT and GREP and CAT and whatever you like.task
HTH
Daniel
Am 04.07.2023 um 18:26 schrieb Jon Paris <
jon.paris@xxxxxxxxxxxxxx>:
Haven't you had enough answers to this question already?
Of course you _CAN_ do it. It is a pretty simple programming
towith
create such a file. But what then? How do you update that file
when the source code of a program changes?
In all of your posts on this topic I have yet to see you explain
WHY
you want to do this and what benefit you think you will get. If
you
want it for the purposes of impact analysis then how do you plan
on
handling the potential impact of overrides? How do you deal
program calls when the calls are via a variable target?together
Not to mention that placing every source file from every library
together is probably not terribly useful as it will mush
programs from multiple applications. Far more useful toseparate
them by application surely?wrote:
And on and on.
Question For You Joe. Notice that among the many who have
responded
to your question not a single person has told you that they
already
do this, or that it is a good idea should give you a hint that
perhaps you are exploring a dead-end path. Why not tell us WHY
you
think you need this and let the hundreds of highly experienced
programmers who frequent this list offer you suggestions on
practical ways to achieve your objectives?
Jon P.
On Jul 3, 2023, at 3:41 AM, joe <joe.planet21@xxxxxxxxx>
code
Hi,
Is it possible to have all the source code placed in a single
file
for all
the source members which are present there in different
libraries
in to
corresponding source physical files?
And the output of that file should be like something if we do
sql/runqry
over it then should be able to see it's members separately i
mean
when one
member ends and another starts clearly with proper source
(from
readability like we read it separately individually to that
member
when we
do wrkmbrpdm and do option 5 to browse it from it's source
it'ssubscription
corresponding library and source physical file)
Any help in this regard would be highly appreciated.
Thanks
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any
subscription
related questions.
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any
related questions.--
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription
related questions.
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription
related
questions.
References
Visible links
1.
https://gist.github.com/BirgittaHauser/282b4f3f590da4b2774610b1b6ca7e58
2.
https://gist.github.com/BirgittaHauser/282b4f3f590da4b2774610b1b6ca7e58
--
This is the RPG programming on IBM i (RPG400-L) mailing list To post a
message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or
change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.
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.