Want To Influence IBM i’s Direction? Consider Joining An Advisory Council

Want To Influence IBM i’s Direction? Consider Joining An Advisory Council

December 12, 2022

Alex Woodie

Do you want to make your mark on the future of IBM i? If so, there may be a volunteer position available to you on one the two advisory councils run by COMMON and COMMON Europe, which play important roles in advising IBM what new features and technologies should be added to the platform.

Members of the COMMON Americas Advisory Council (CAAC) and the COMMON Europe Advisory Council (CEAC) play an important role shaping what new features and functionality are added to the IBM i platform. The two councils work closely with IBM to review and prioritize customer requirements submitted through IBM Ideas (previously the request for enhancement, or RFE) program. They also function as a sounding board for new ideas generated internally by IBM architects.

Being a CAAC member not only gives you a firsthand look into what IBM has in store for future releases of the IBM i operating system and related products, but it also allows you to influence the direction of the platform directly with IBM. This is done through monthly interactions with IBM architects via Zoom meetings on specific topics, as well as the twice-a-year ventures to the IBM Lab in Rochester, Minnesota.

The CAAC recently concluded its annual fall meeting in Rochester, which also involved several members of CEAC (it was only the second joint CAAC-CEAC meeting ever). The three-day meetings in Rochester provide even more time for give-and-take with the IBM architects as well the various product managers and developers that create the platform.

Much of the time of being a CAAC member is spent going through Ideas, according to CAAC member Mike McArdle, who joined the council in 2018. CAAC has three subcommittees – one each for application development, the database and IFS, and systems operations – that meet via Zoom once a month for an hour at a time. The subcommittees go over customer requirements submitted through IBM Ideas to determine if they are actually good ideas that would benefit real-world IBM i shops, and if so, what priority they should be given.

“We take the list and try to get through 10 a week,” says McArdle, who sits on all three subcommittees. “We have a top 20 list that we try to come up with for IBM every year. We find ideas in the subcommittees and then bring them to our master group and let everybody get in on it, because we don’t want to find out our top 20 is all app dev or all sys admin stuff. We want to be balanced and want to give them a balanced look at what they want to be working on.”

The top 20 lists help IBM to understand what the most pressing issues are facing its IBM i customers, and are helpful in kicking off additional conversations between IBM and the CAAC and CEAC about how best to solve them. Sometimes, IBM will take another approach to solving an issue brought up by the customer, and the give-and-take with CAAC and CEAC helps to flesh out the possibilities, says IBM’s Alison Butterill, the IBM i product manager.

“As they come forward with ideas, we often go back and say ‘Here’s what we’re thinking of. Here’s how we think we’re going to be able to implement it. Does that match what you guys thought the idea was, what was the crux of the idea?’” Butterill says. “And that way we can make sure we’re in sync with what the CAAC or the CEAC think was really the baseline. And then we start talking about, well, if we do it this way, then maybe we can add these things or do that or something else, or it’s in line with the strategic direction.”

IBM i Merlin came together organically as the result of several customer requirements around having a lightweight, Web-based development tool cohabitating with modernization tools inside of a container. The delivery vehicle that ultimately became Merlin was the brainchild of IBM architects, not necessarily the result of direct request to the IBM Ideas or RFE program for something like Merlin.

“We definitely got guidance” on Merlin, Butterill says. “We even get guidance on things like packaging and pricing and marketing . . . It’s really a brainstorming session, if you will.”

The new geospatial analytics functions added to Db2 for i with IBM i 7.5 TR1 is another example of an internally generated idea – in this case from Db2 for i database architect Scott Forstie’s team – that CAAC and CEAC provided some feedback for.

“If we’re having some of these wild and crazy ideas, as we often do, it gives us a sounding board,” Butterill says. “More than once, we have said ‘This is what we’re thinking of doing’ and they’ll say ‘Well, could you do it like this, so that we can do something else?’ It’s really a two-way street here.”

CAAC just had a milestone last week: It finally got caught up on all the IBM Ideas, McArdle says. “The community gives us such new and cool ideas that reviewing them all takes time. And keeping up is difficult.”

The CAAC can have 16 members, according to COMMON’s charter, but it currently has only 11, which means it could absorb four or five additional members, says McArdle, who joined the council in 2018. “We’re always shorthanded,” he says.

McArdle, whose day job is working as an instructor at Western Technical College in La Crosse, Wisconsin, occupies the CAAC position reserved for the education community. The charter calls for up to four people on the CAAC to be business partners, ISVs or consultants, while the remaining CAAC members represent their own company. Two members may be COMMON board members.

It can be difficult to find new CAAC members. The group is picky about whom it chooses; it doesn’t want just anybody. “This group should have a balance of business, management, hardware, and software skills,” according to the CAAC webpage on the COMMON website.

The CAAC recently lost two folks who were both very experienced with operating the server, which is one of the attributes that the CAAC looks for in filling its council. “You want somebody on the CAAC who has his hands in the water, working with the product on a daily basis,” McArdle says. “I don’t really fulfill that role because I’m more of a theoretical guy.”

One of the hardest parts of filling the CAAC positions is getting the okay from the new member’s company or organization. Going through the customer requirements and meeting monthly takes time, as do the bi-annual trips to Rochester (which CAAC pays for).

“The hard part is getting company commitment, more than anything else. This is a chunk of time,” McArdle says. “Our perception is that everybody who works in the IT world is working 70-hour weeks. So this is a commitment of time on their part. But they love doing it once they get inside and start to do it.”

The CEAC is in a similar boat as CAAC, Butterill says. While the CEAC is arranged slightly differently – it has two IBMers advising it due to the differences in customs among the different countries in Europe versus just one IBMer advising CAAC – there is also a need for enthusiastic, committed IBM i professionals to vet customer ideas, provide feedback to IBM, and shape the future of the platform.

IBM i may not be an open source product that is developed and controlled by its community users, as Linux is. But that doesn’t mean the IBM i community doesn’t have a big role to play in driving the product forward. In fact, IBM counts on active participation by the community to help keep IBM i vital and responsive to its customers’ needs. That is why the IBM Ideas Portal, the two COMMON advisory councils, CAAC and CEAC – as well as the ISV Advisory Council and the Large User Group – are so critical to the future of IBM i.

“One of the things that sets IBM i apart from many other places at IBM is this partnership we have with the community,” Butterill says. “We spend a lot of time, as do community members like Mike, in making sure that the product reflects what our customers’ need. That’s why they help, because they like to point to something [and say] ‘I had a hand in that.”’

If you are a COMMON member and would like to join the CAAC, you can submit an application here.

RELATED STORIES

IBM Welcomes COMMON Advisory Councils to Rochester

LUG Looks to Grow Membership

ISV Advisory Council: Untold Secrets And Free Advice

Capture Point Restore: The Perfect Companion For High Availability

Capture Point Restore: The Perfect Companion For High Availability

December 12, 2022

Ash Giddings

Businesses are constantly challenged by cyberattacks, coupled by their ever-increasing diverse nature. Ransomware and malicious data deletion or corruption can originate from both inside or outside of the business and staying out of the headlines by preventing attacks or at worst limiting the impact is high on the agenda for many.

There’s seemingly never a day goes by without a prominent attack being reported, damaging both the tangible capabilities to conduct business at the time, combined with intangible ongoing damage to business reputation that these destructive incidents invariably bring.

Many businesses have wisely invested in high availability for their IBM i environments, with these solutions such as Maxava HA, normally built on the efficiencies provided by remote journaling. These solutions are, rightly so, the go-to choice when looking to implement an added layer of resilience in an age when both intentional data corruption and inadvertent data loss are on the rise. But is having a high availability solution enough?

A good high availability solution largely goes unnoticed by replicating data from a designated source machine to a chosen target or targets and will include both self-monitoring and self-healing. If corruption occurs on the source or production machine, the high availability solution will, quite rightly, replicate that corruption to the target resulting in corrupt data on multiple servers, making recovery problematic. This is where Maxava Capture Point Restore (CPR) fits in.

Capture Point Restore provides the ability to capture a selection of critical data at designated points or times, and archive it, all transparent to the underlying application and without impacting the users. The capture point can be configured to automatically occur at chosen times – for example every 4 hours – or prior to major events such as an overnight update or invoicing run. The archive can be stored literally anywhere, locally on another IBM i, or even another platform altogether; anywhere where FTP access is capable.

For some businesses storing archives in the cloud may be an attractive option, potentially going some way towards satisfying regulatory compliance. Increasingly popular are backup architectures looking to implement a 3-2-1 rule; that is 3 copies of data to 2 different types of media along with 1 offsite location. Retention rules can be defined making Capture Point Restore a vital cog by storing data sets offsite.

Another use for Capture Point Restore might be Business Intelligence, capturing a subset of data before restoring it to an alternative server for reporting purposes and away from the demands of production workload.

For those running older versions of the operating system, Maxava Capture Point Restore will run on V5R3 and all later versions of the operating system, while both internal and external disk is supported. For some it offers a way of implementing a simple, lightweight form of protection for legacy applications. Both archiving and recovering from previous archives are made simple by way of a graphical user interface.

Maxava Capture Point Restore complements Maxava HA, will work with an alternative HA solution or run totally independently to help provide confidence that business critical data can be recovered should the need arise.

For more information on Maxava Capture Point Restore, the perfect companion for high availability, or for a free trial please visit: https://www.maxava.com/capture-point-restore-ibm-i

Ash Giddings is a product manager at Maxava and an IBM Champion 2022.

This content is sponsored by Maxava.

RELATED STORIES

Myth Buster: Changing Your HA/DR Software Is Not Hard Work!

IBM Knows Your System, So You Already Know Its Cloud

The Case For Software-Based IBM i HA/DR

In The IBM i Trenches With: IBM Champion Ash Giddings

Why Modernize Your Legacy Monitoring?

Maxava Monitor Mi8 And The Cloud Fuels Expansion

Maxava Adds New Products, Partners, And Users Around The World

A Smattering Of Power Systems Announcements

A Smattering Of Power Systems Announcements

December 12, 2022

Timothy Prickett Morgan

We keep saying that IBM is winding down its announcement stream as 2022 comes to a close, but there is still a trickle of things being announced by Big Blue, both new products and withdrawals, that relate to the Power Systems platform and its adjacent external storage.

First of all, in announcement letter 122-134, IBM is allowing customers – as promised back at the COMMON POWERUp event in October – to run the AIX and Linux operating systems on that special configuration of the Power 1022s machine that has two four-core Power10 dual chip modules (DCMs) in the box instead of a single eight-core Power10 single chip module (SCM).

This machine, which we wrote about here, is interesting in that it allows the resulting entry server to have twice as much I/O for the same amount of compute throughput, which is a clever differentiation that also allows IBM to make the most of all of the Power10 chips and packages coming off the fab lines at foundry partner Samsung. In this case, IBM is allowing for one or two of the Power10 DCMs to be installed, so it can have four or eight cores activated. With the IBM i variant, you have to take a pair of four-core DCMs and you have to activate all eight of the cores. As with the IBM i variant, it is important to remember that this server CPU feature complex does not have an upgrade path. You buy it, that’s it.

In the same announcement, IBM made the Power S1022s with two four-core Power10s eligible for the IBM i Solution Edition, which provides discounts and credits when customers buy selected systems software from Big Blue and application software from third party software vendors. You can see the IBM i Solution Edition bundles at this link. IBM is still showing the Power9 server configurations on its Web site, but there are obviously Power10 setups that can be sold as well, including the Power S1022s.

The AIX and Linux support and the Solution Edition eligibility for this Power S1022s configuration were both available on December 9.

Not that this affects IBM i-only Power Systems shops, because IBM i is not supported on the Power E1050 server, in announcement letter 122-135, Big Blue has reinstated the selling of the feature #EJ10 PCI-Express 3.0 SAS tape/DVD adapter card, which was withdrawn from the catalog on September 13.

In announcement letter 922-139, IBM is also telling the HPC community that it is going to stop selling the Nvidia “Volta” V100 GPU accelerators for the Power AC922 supercomputer node. This stands to reason, since Nvidia launched the V100s in 2018 and the “Ampere” A100s in 2020, and in has just started selling its “Hopper” H100 generation launched earlier this year. IBM has given up on chasing exascale-class supercomputer deals, and this has important implications for the Power Systems line. The first is, IBM has lower revenues than it might otherwise have had over a three year HPC system upgrade cycle that it has participated in for decades. And the second is that the Power Systems line is inherently more profitable, particularly in systems where GPUs represent most of the floating point computation in the system. No one makes money selling large HPC systems to the national HPC labs – they break even at best. So in a funny way, IBM is better off without this business, at least in the short term. In the long term, the many generations of Power-based HPC systems that IBM sold largely to the United States government and to several nations in the European Union helped pay for the research and development for Power processors and memory and I/O systems. Any proper accounting of the true costs and benefits of chasing the HPC business would have to take this into account. The upshot is that IBM is now focusing on developing systems that suit the needs of its AIX, IBM i, and Linux customers, which is a good thing.

In announcement letter 222-360, IBM is updating its Copy Services Manager storage middleware to release 6.3.5. Copy Services Manager is a configuration and monitoring tool that manages the various copy services on IBM’s DS8000 series SANs, its SAN Volume Controller and Spectrum Virtualize storage virtualization platforms, its XIV storage clusters, and its FlashSystem A9000 all-flash arrays. The Copy Services Manager provides a single pane of glass to manage the different but often similar copy services that are native to these platforms and specifically supports Metro Mirror, FlashCopy, and SafeGuarded Copy across these storage platforms in addition to Global Mirror functions on the DS8000 and SVC platforms. Copy Services Manager 6.3.5 will be available on December 16.

RELATED STORIES

A Few More Power Systems Updates Before 2022 Ends

Various Power Systems Software Tweaks Besides The TR Updates

Power S1022s Tweaked To Do Native IBM i With More I/O

Security, Automation, and Cloud Top Midrange IT Priorities, Study Says

Power Private Cloud Gets More Cloudy With Pricing Tweaks

Building A More Perfect IBM i Cloud On Power10 Iron

IBM Preconfigures Power System Racks Running Oracle Database

Sundry Power Systems Cloud Announcements

IBM Extends Dynamic Capacity Pricing Scheme To Its Cloud

Big Blue Rolls Out Red Hat Power Stack

Resilience In The Platform, Resilience In The Business

IBM Brings Flexible Utility Pricing To Private Power Systems

How IBM Stacks Power Cloud Up Against AWS And Azure

Pricing Revealed For IBM i Slices On IBM Cloud

IBM i PTF Guide, Volume 24, Number 50

IBM i PTF Guide, Volume 24, Number 50

December 12, 2022

Doug Bidwell

It is another week of interesting security vulnerabilities in the IBM i world, so brace yourself for some research and patching. There are a slew of vulnerabilities that affect the Hardware Management Console for Power Systems, which means any of you IBM i shops that are using relatively large Power machines. There are five new ones, above and beyond the ones we have covered in recent weeks.

First, there is Security Bulletin: Vulnerability in Bind (CVE-2021-25219) affects Power HMC, which you can read about here.

Affected Product(s) Version(s)
HMC V10.1.1010.0 V10.1.1010.0 and later
HMC V9.2.950.0 V9.2.950.0 and later
Product VRMF APAR Remediation/Fix
Power HMC V9.2.950.0 SP3 ppc MB04373 MH01944
Power HMC V9.2.950.0 SP3 x86 MB04372 MH01943
Power HMC V10.1.1020.0 SP1 ppc MB04363 MF70302
Power HMC V10.1.1020.0 SP1 x86 MB04362 MF70301

Second, there is Security Bulletin: Vulnerabilities in Apache HTTP (CVE-2021-33193 and CVE-2021-44224) affects Power HMC, which you can see more about at this link. Same affected versions and APARs to remediate and fix.

Third, there is Security Bulletin: Vulnerability in Apache HTTP (CVE-2020-13950) affects Power HMC, which you can find out more about there. It has the same affected versions and remediations and fixes.

Fourth, there is Security Bulletin: Vulnerability in Kernel (CVE-2021-45485) affects Power HMC, which you can read more about here.

Affected Product(s) Version(s)
HMC V10.1.1010.0 V10.1.1010.0 and later
HMC V9.2.950.0 V9.2.950.0 and later
Product VRMF APAR Remediation/Fix
Power HMC V9.2.950.0 SP3 ppc MB04331 MH01925
Power HMC V9.2.950.0 SP3 x86 MB04330 MH01924
Power HMC V10.1.1020.0 SP1 ppc MB04335 MF69724
Power HMC V10.1.1020.0 SP1 x86 MB04334 MF69722

And finally, number five, there is Security Bulletin: Vulnerability in Kernel (CVE-2022-1012) affects Power HMC, which you can find out more about at this link and which has the same affected versions and fixes.

You should also check out the HMC V10 R2 M1030 Recovery Media – for 7063 Hardware, which you can see more about at this link.

Now, here is the rundown of PTF Groups by IBM i release level since we last published:

PTF Groups 7.5:

IBM DB2 Mirror for i
IBM MQ for IBM i – v9.2.0/v9.3.0
SAP
QMGTOOLS

PTF Groups 7.4:

MQ for IBM i – v9.0.0/v9.1.0/v9.2.0/v9.3.0
Memo to Users
What’s New!
SAP
QMGTOOLS

PTF Groups 7.3:

MQ for IBM i – v7.1.0/v8.0.0/V9.0.0/V9.1/V9.2
SAP
QMGTOOLS

PTF Groups 7.2:

New (or Updated) links added to the ‘Links’ tab in the guide this week:

New (or Updated) links added to the ‘QMGtools’ tab in the guide this week:

New (or Updated) links added to the ‘ACS_NAV’ tab in the guide this week:

New (or Updated) links added to the ‘Prtr Links’ tab in the guide this week:

Tips/Definitions: How long has it been since you did a SAVE 21?

The Guide at a glance: There are no new defectives this week (12/10/22). Here is the defective PTF rundown, which is the last defective for each release:

Defect Defective APAR Fixing
Date PTF PTF
——– ——– ——- ——-
7.5 11/22/22 SI81328 SE78918 SI81867 (When available)
7.4 12/01/22 MF69086 MA49947 MF70500 (When available)
7.3 12/01/22 MF69085 MA49947 MF70499 (When available)
7.2 12/08/21 SI77634 SE73420 SI78039 (Read the link in the guide!)

Be sure to access the link in the Guide for further details.

Below is the usual archive of the IBM i PTF Guide to help you work through the PTFs in chronological order:

December 10, 2022: Volume 24, Number 51

December 3, 2022: Volume 24, Number 49

November 26, 2022: Volume 24, Number 48

November 19, 2022: Volume 24, Number 47

November 12, 2022: Volume 24, Number 46

November 5, 2022: Volume 24, Number 45

October 29, 2022: Volume 24, Number 44

October 22, 2022: Volume 24, Number 43

October 15, 2022: Volume 24, Number 42

October 8, 2022: Volume 24, Number 41

October 1, 2022: Volume 24, Number 40

September 24, 2022: Volume 24, Number 39

September 17, 2022: Volume 24, Number 38

September 10, 2022: Volume 24, Number 37

September 3, 2022: Volume 24, Number 36

August 27, 2022: Volume 24, Number 35

August 20, 2022: Volume 24, Number 34

August 13, 2022: Volume 24, Number 33

August 6, 2022: Volume 24, Number 32

July 30, 2022: Volume 24, Number 31

July 23, 2022: Volume 24, Number 30

July 16, 2022: Volume 24, Number 29

July 9, 2022: Volume 24, Number 28

June 25, 2022: Volume 24, Number 26

June 18, 2022: Volume 24, Number 25

June 11, 2022: Volume 24, Number 24

June 4, 2022: Volume 24, Number 23

May 28, 2022: Volume 24, Number 22

May 25, 2022: Volume 24, Number 21

May 14, 2022: Volume 24, Number 20

May 7, 2022: Volume 24, Number 19

April 30, 2022: Volume 24, Number 18

April 23, 2022: Volume 24, Number 17

April 16, 2022: Volume 24, Number 16

April 2, 2022: Volume 24, Number 14

March 26, 2022: Volume 24, Number 13

March 19, 2022: Volume 24, Number 12

March 12, 2022: Volume 24, Number 11

March 5, 2022: Volume 24, Number 10

February 26, 2022: Volume 24, Number 9

February 19, 2022: Volume 24, Number 8

February 12, 2022: Volume 24, Number 7

February 5, 2022: Volume 24, Number 6

January 29, 2022: Volume 24, Number 5

January 22, 2022: Volume 24, Number 4

January 15, 2022: Volume 24, Number 3

January 8, 2022: Volume 24, Number 2

January 1, 2022: Volume 24, Number 1

December 6, 2021: Volume 23, Number 48

November 20, 2021: Volume 23, Number 47

November 13, 2021: Volume 23, Number 46

November 6, 2021: Volume 23, Number 45

October 30, 2021: Volume 23, Number 44

October 23, 2021: Volume 23, Number 43

October 16, 2021: Volume 23, Number 42

October 9, 2021: Volume 23, Number 41

October 2, 2021: Volume 23, Number 40

September 25, 2021: Volume 23, Number 39

September 18, 2021: Volume 23, Number 38

September 11, 2021: Volume 23, Number 37

September 4, 2021: Volume 23, Number 36

August 28, 2021: Volume 23, Number 35

August 21, 2021: Volume 23, Number 34

August 14, 2021: Volume 23, Number 33

August 7, 2021: Volume 23, Number 32

July 31, 2021: Volume 23, Number 31

July 24, 2021: Volume 23, Number 30

July 17, 2021: Volume 23, Number 29

July 10, 2021: Volume 23, Number 28

July 3, 2021: Volume 23, Number 27

June 26, 2021: Volume 23, Number 26

June 19, 2021: Volume 23, Number 25

June 12, 2021: Volume 23, Number 24

June 5, 2021: Volume 23, Number 23

June 5, 2021: Volume 23, Number 22

May 22, 2021: Volume 23, Number 21

May 15, 2021: Volume 23, Number 20

May 8, 2021: Volume 23, Number 19

May 1, 2021: Volume 23, Number 18

April 24, 2021: Volume 23, Number 17

April 17, 2021: Volume 23, Number 16

April 10, 2021: Volume 23, Number 15

April 3, 2021: Volume 23, Number 14

March 27, 2021: Volume 23, Number 13

March 20, 2021: Volume 23, Number 12

March 13, 2021: Volume 23, Number 11

March 6, 2021: Volume 23, Number 10

February 27, 2021: Volume 23, Number 9

February 20, 2021: Volume 23, Number 8

February 13, 2021: Volume 23, Number 7

February 6, 2021: Volume 23, Number 6

January 31, 2021: Volume 23, Number 5

January 23, 2021: Volume 23, Number 4

January 16, 2021: Volume 23, Number 3

January 9, 2021: Volume 23, Number 2

January 2, 2021: Volume 23, Number 1

December 26, 2020: Volume 22, Number 52

December 19, 2020: Volume 22, Number 51

December 12, 2020: Volume 22, Number 50

December 5, 2020: Volume 22, Number 49

Export source code to IFS

Last Updated on 11 December 2022 by Roberto De Pedrini

Colleagues and customers are increasingly asking to copy the sources of their programs stored on members of source files to IFS in order to be able to compile them using the SRCSTMF parameter available for ILE program/module creation commands or to use them, via network shares, from applications on other platforms (Windows or Linux).

CPYSRC2IFS, this is the name of the command, simplifies this export activity also supplying some information on the treated members and on the performed activity.

The command allows you to copy the members of a source file or the members of all source files of a library selected by a pattern into an IFS directory:

Copy source file member to IFS (CPYSRC2IFS)

Immettere le scelte e premere Invio.

File . . . . . . . . . . . . . . Nome, *ALL
Library . . . . . . . . . . . *LIBL Nome, *LIBL, *CURLIB
Member . . . . . . . . . . . . . Valore carattere, *
Library ASP device name . . . . *SYSBAS Nome, *SYSBAS
Directory . . . . . . . . . . .
Create directory . . . . . . . . *NO *NO, *YES
STMF extension . . . . . . . . . *DFT Valore carattere, *DFT…
STMF CCSID . . . . . . . . . . . *PCASCII 1-65533, *PCASCII, *STDASCII
End of line characters . . . . . *CRLF Valore carattere, *CRLF…
Authority . . . . . . . . . . . *INDIR *INDIR, *DFT, *FILE…
STMF description . . . . . . . . *NO *NO, *YES
Report (CSV format) . . . . . . *NO *NO, *YES
Count physical SLOC (CBL/RPG) . *NO *NO, *YES

Below is a brief description of the parameters:

FROMFILE: specifies the source file (and library) containing the members to be exported to IFS; using *ALL as file name it is possible to select all the source files of the indicated library (in this case, for each source file of the library, a job is submitted which first creates a directory called as the source file to be processed under the directory indicated in the parameter TODIR then copies the selected members there);

MBR: specify the members to export (‘*‘ is used as a wildcard and can be used in any position and even more than once, for example: MBR(‘*B*A*’));

LIBASPDEV: specifies the ASP device where the library containing the source file to be exported is located;

TODIR: specifies the path of the IFS directory where to copy the members;

CRTDIR: specifies whether to create (*YES) or not (*NO, default) the destination directory (indicated in the TODIR parameter);

STMFEXT: Specifies the extension to use to complete the target stream file name; it is possible to expressly indicate it (STMFEXT(‘.txt’), for example) or choose between: *DFT (default), to use the .MBR extension, *NONE, to have no extension and *TYPE to use the content of the TYPE field (origin type) of the member;

STMFCCSID: Specifies the CCSID of the stream file; *PCASCII is the default value (CCSID = 1252), alternatively you can use *STDASCII (CCSID = 819) or a CCSID between 1 and 65533 (the values used by the CPYTOSTMF command);

ENDLINFMT: specifies end-of-line characters; *CRLF is the default value, alternatively you can specify *LF, *CR, *LFCR, *FIXED (the values used by the CPYTOSTMF command);

AUTH: Specifies the policy used to assign authority to copied objects; the possible values are *INDIR (default value), *DFT, *FILE, *FILEINDIR (also in this case these are the values used by the CPYTOSTMF command);

REPORT: Specifies whether or not to create a report in CSV (Comma-Separated Values) format of the exported members, called “#Report-JOBNUMBERJOBUSER_JOBNAME.csv“, containing some information about the member such as: library, source file, member, description, type, number of records, creation timestamp, last modification timestamp, byte size of the generated stream file and allocated space in bytes always of the generated stream file (“LIBRARY”;”FILE”;”MEMBER”;”TYPE”;”TEXT”;”NBRRCD”;”CRT_TIMESTAMP”;”LAST_CHG_TIMESTAMP”;”IFS_SIZE”;”IFS_ALLOC”)

STMFTXT: specifies whether to report (*YES) or not (*NO, default value) the description of the member of the source file in the description of the destination stream file;

SLOC: specifies, only if REPORT(*YES), whether or not to estimate the amount of physical code lines (ie without comment lines) for Cobol and RPG sources. In this case the columns of the report file become: “LIBRARY”;”FILE”;”MEMBER”;”TYPE”;”TEXT”;”NBRRCD”;”PHYSICAL_SLOC”;”CRT_TIMESTAMP”;”LAST_CHG_TIMESTAMP”;”IFS_SIZE” ;”IFS_ALLOC”

In addition to the report in CSV format, at the end of the execution, the command displays a summary of what has been done in terms of number of members processed, total records of members processed, size of stream files created (in bytes) and space allocated for them stream file (in bytes). Here is an example:

Member processed: 1.003 – Records: 607.422 – IFS size (byte): 25.457.910
– IFS allocated size (byte): 40.460.288

Before proceeding with the compilation of the program (CRTBNDCL command) it is necessary to create three files with the following commands:

RUNSQL SQL(‘CREATE TABLE QTEMP/PFSRCLIST AS (SELECT DBXFIL FROM QADBXREF) WITH NO DATA’) +
COMMIT(*NONE)
RUNSQL SQL(‘CREATE TABLE QTEMP/MBRLIST (MBNAME CHAR(10), MBSEU2 CHAR(10), MBMTXT CHAR(50), +
MBNRCD DECIMAL(10, 0), MBCCEN CHAR(1), MBCDAT CHAR(6), MBCTIM CHAR(6), MBUPDC CHAR(1), +
MBUPDD CHAR(6), MBUPDT CHAR(6))’) COMMIT(*NONE)
RUNSQL SQL(‘CREATE TABLE QTEMP/SLOC (NUMBER NUMERIC(10, 0))’) COMMIT(*NONE)

So, if we want to export to the /src/prj1 directory (to be created by the command), in Windows “format,” all the program sources contained in the members of the physical source files in the PRJ1LIB library, including their description, and we also want the activity report to be generated, including the estimation of the physical lines of code for Cobol and RPG language programs, we need to type the following command (in italics the parameters using the default values of the command):

CPYSRC2IFS FROMFILE(PRJ1LIB/*ALL) MBR(*) TODIR(‘/src/prj1’) CRTDIR(*YES) STMFEXT(*TYPE) +
STMFCCSID(*PCASCII) ENDLINFMT(*CRLF) AUT(*INDIR) STMFTXT(*YES) REPORT(*YES) SLOC(*YES)

Below are the sources of the CLLE command and program:

CMD PROMPT(‘Copy source file member to IFS’)

PARM KWD(FROMFILE) TYPE(FILE) MIN(1) PROMPT(‘File’ 1)

PARM KWD(TODIR) TYPE(*PNAME) LEN(128) MIN(1) EXPR(*YES) +
PROMPT(‘Directory’ 4)

PARM KWD(MBR) TYPE(*CHAR) LEN(10) DFT(*) SPCVAL((*)) +
EXPR(*YES) PROMPT(‘Member’ 2)

PARM KWD(LIBASPDEV) TYPE(*NAME) LEN(10) DFT(*SYSBAS) +
SPCVAL((*SYSBAS)) EXPR(*YES) PROMPT(‘Library ASP +
device name’ 3)

PARM KWD(CRTDIR) TYPE(*CHAR) LEN(4) RSTD(*YES) DFT(*NO) +
VALUES(*NO *YES) EXPR(*YES) PROMPT(‘Create +
directory’ 5)

PARM KWD(STMFEXT) TYPE(*CHAR) LEN(10) DFT(*DFT) +
SPCVAL((*DFT) (*NONE) (*TYPE)) EXPR(*YES) +
PROMPT(‘STMF extension’ 6)

PARM KWD(STMFCCSID) TYPE(*INT4) DFT(*PCASCII) RANGE(1 +
65533) SPCVAL((*PCASCII 1252) (*STDASCII 850)) +
EXPR(*YES) PROMPT(‘STMF CCSID’ 7)

PARM KWD(ENDLINFMT) TYPE(*CHAR) LEN(6) DFT(*CRLF) +
SPCVAL((*CRLF) (*LF) (*CR) (*LFCR) (*FIXED)) +
EXPR(*YES) PROMPT(‘End of line characters’ 8)

PARM KWD(AUT) TYPE(*CHAR) LEN(10) RSTD(*YES) +
DFT(*INDIR) VALUES(*INDIR *DFT *FILE *INDIRFILE) +
EXPR(*YES) PROMPT(‘Authority’ 9)

PARM KWD(STMFTXT) TYPE(*CHAR) LEN(4) RSTD(*YES) +
DFT(*NO) VALUES(*NO *YES) EXPR(*YES) +
PROMPT(‘STMF description’ 10)

PARM KWD(REPORT) TYPE(*CHAR) LEN(4) RSTD(*YES) DFT(*NO) +
VALUES(*NO *YES) EXPR(*YES) PROMPT(‘Report (CSV +
format)’ 11)

PARM KWD(SLOC) TYPE(*CHAR) LEN(4) RSTD(*YES) DFT(*NO) +
VALUES(*NO *YES) EXPR(*YES) PMTCTL(LOC) +
PROMPT(‘Count physical SLOC (CBL/RPG)’ 12)

FILE: QUAL TYPE(*NAME) LEN(10) SPCVAL((*ALL)) EXPR(*YES)
QUAL TYPE(*NAME) LEN(10) DFT(*LIBL) SPCVAL((*LIBL) +
(*CURLIB)) EXPR(*YES) PROMPT(‘Library’)

LOC: PMTCTL CTL(REPORT) COND((*EQ *YES)) NBRTRUE(*ALL)

PGM PARM(&PFROMFILE &PTODIR &PMBR &PLIBASPDEV &PCRTDIR +
&PSTMFEXT &PSTMFCCSID &PENDLINFMT &PAUT +
&PSTMFTXT &PREPORT &PSLOC)

/* Parameters */
DCL VAR(&PFROMFILE) TYPE(*CHAR) LEN(20)
DCL VAR(&FROMFILE) TYPE(*CHAR) STG(*DEFINED) LEN(10) +
DEFVAR(&PFROMFILE 1)
DCL VAR(&FROMLIB) TYPE(*CHAR) STG(*DEFINED) LEN(10) +
DEFVAR(&PFROMFILE 11)
DCL VAR(&PTODIR) TYPE(*CHAR) LEN(128)
DCL VAR(&PMBR) TYPE(*CHAR) LEN(10)
DCL VAR(&PLIBASPDEV) TYPE(*CHAR) LEN(10)
DCL VAR(&PCRTDIR) TYPE(*CHAR) LEN(4)
DCL VAR(&PSTMFEXT) TYPE(*CHAR) LEN(10)
DCL VAR(&PSTMFCCSID) TYPE(*INT) LEN(4)
DCL VAR(&PENDLINFMT) TYPE(*CHAR) LEN(6)
DCL VAR(&PAUT) TYPE(*CHAR) LEN(10)
DCL VAR(&PSTMFTXT) TYPE(*CHAR) LEN(4)
DCL VAR(&PREPORT) TYPE(*CHAR) LEN(4)
DCL VAR(&PSLOC) TYPE(*CHAR) LEN(4)

/* Variables */
DCL VAR(&OBJATR) TYPE(*CHAR) LEN(10)
DCL VAR(&NBRSELMBR) TYPE(*DEC) LEN(10 0)
DCL VAR(&NBRSELPFS) TYPE(*DEC) LEN(10 0)
DCL VAR(&ASPPATH) TYPE(*CHAR) LEN(11)
DCL VAR(&MBRPATH) TYPE(*CHAR) LEN(256)
DCL VAR(&TODIR) TYPE(*CHAR) LEN(128)
DCL VAR(&STMFEXT) TYPE(*CHAR) LEN(10)
DCL VAR(&STMF) TYPE(*CHAR) LEN(256)
DCL VAR(&REPORT) TYPE(*CHAR) LEN(256)
DCL VAR(&MBRCRTCEN) TYPE(*CHAR) LEN(2)
DCL VAR(&MBRCRTDAT) TYPE(*CHAR) LEN(10)
DCL VAR(&MBRCRTTIM) TYPE(*CHAR) LEN(8)
DCL VAR(&MBRCRTTS) TYPE(*CHAR) LEN(26)
DCL VAR(&MBRCHGCEN) TYPE(*CHAR) LEN(2)
DCL VAR(&MBRCHGDAT) TYPE(*CHAR) LEN(10)
DCL VAR(&MBRCHGTIM) TYPE(*CHAR) LEN(8)
DCL VAR(&MBRCHGTS) TYPE(*CHAR) LEN(26)
DCL VAR(&MBRCNTX) TYPE(*DEC) LEN(10 0)
DCL VAR(&MBRCNT) TYPE(*DEC) LEN(10 0)
DCL VAR(&MBRCNTCHAR) TYPE(*CHAR) LEN(19) /* +
xxx.xxx.xxx.xxx.xxx */
DCL VAR(&RCDCNT) TYPE(*DEC) LEN(10 0)
DCL VAR(&RCDCNTCHAR) TYPE(*CHAR) LEN(19) /* +
xxx.xxx.xxx.xxx.xxx */
DCL VAR(&IFSSIZ) TYPE(*INT) LEN(8)
DCL VAR(&IFSSIZCHAR) TYPE(*CHAR) LEN(19) /* +
xxx.xxx.xxx.xxx.xxx */
DCL VAR(&IFSALC) TYPE(*INT) LEN(8)
DCL VAR(&IFSALCCHAR) TYPE(*CHAR) LEN(19) /* +
xxx.xxx.xxx.xxx.xxx */
DCL VAR(&SLOCCNT) TYPE(*DEC) LEN(10 0)
DCL VAR(&SLOCCNTCHR) TYPE(*CHAR) LEN(19) /* +
xxx.xxx.xxx.xxx.xxx */
DCL VAR(&SLOC) TYPE(*LGL) LEN(1)

/* Files */
DCLF FILE(PFSRCLIST) OPNID(PFSRC)
DCLF FILE(SLOC) OPNID(SLOC)
DCLF FILE(MBRLIST) OPNID(MBRINFO)

/* stat64 */
DCL VAR(&STATRTNVAL) TYPE(*INT) LEN(4)
DCL VAR(&STATPATH) TYPE(*CHAR) LEN(256)
DCL VAR(&STATBUFFER) TYPE(*CHAR) LEN(4096)
DCL VAR(&STATOBJSIZ) TYPE(*INT) STG(*DEFINED) LEN(8) +
DEFVAR(&STATBUFFER 17)
DCL VAR(&STATALCSIZ) TYPE(*UINT) STG(*DEFINED) LEN(8) +
DEFVAR(&STATBUFFER 49)
DCL VAR(&STATOBJTYP) TYPE(*CHAR) STG(*DEFINED) LEN(10) +
DEFVAR(&STATBUFFER 61)

/* strlen */
DCL VAR(&STRTMP) TYPE(*CHAR) LEN(32767)
DCL VAR(&LENINT) TYPE(*UINT) LEN(4)

/* SUBR(VFYPFSRC): Start *********************************************/
DCL VAR(&VFYPFSRC) TYPE(*INT) LEN(4)

/* QDBRTVFD */
DCL VAR(&FILD0100) TYPE(*CHAR) LEN(400)
DCL VAR(&QDBFHFLG) TYPE(*CHAR) STG(*DEFINED) LEN(1) +
DEFVAR(&FILD0100 9)
DCL VAR(&QDBFHMNUM) TYPE(*INT) STG(*DEFINED) LEN(2) +
DEFVAR(&FILD0100 48)
DCL VAR(&FILD0100L) TYPE(*INT) LEN(4) VALUE(400)
DCL VAR(&QDBFOUT) TYPE(*CHAR) LEN(20)
DCL VAR(&QDBFIN) TYPE(*CHAR) LEN(20)
DCL VAR(&QDBFRCDFMT) TYPE(*CHAR) LEN(10)
DCL VAR(&QDBFOVR) TYPE(*CHAR) LEN(1)
DCL VAR(&QDBFSYS) TYPE(*CHAR) LEN(10)
DCL VAR(&QDBFFMTTYP) TYPE(*CHAR) LEN(10)

DCL VAR(&BIT_2_ON) TYPE(*LGL) LEN(1)
DCL VAR(&BIT_4_ON) TYPE(*LGL) LEN(1)
DCL VAR(&BIT_POS) TYPE(*INT) LEN(4)
DCL VAR(&FILEATRB) TYPE(*CHAR) LEN(2)
DCL VAR(&FILETYPE) TYPE(*CHAR) LEN(3)
DCL VAR(&NBRALLMBR) TYPE(*INT) LEN(2)
/* SUBR(VFYPFSRC): End ***********************************************/

/* SUBR(EDTNUM): Start ***********************************************/
DCL VAR(&EDTNUM) TYPE(*INT) LEN(4)

/* QECCVTEC, QECEDT */
DCL VAR(&SIZEDEC) TYPE(*DEC) LEN(15 0)
DCL VAR(&SIZECHAR) TYPE(*CHAR) LEN(19) /* +
xxx.xxx.xxx.xxx.xxx */
DCL VAR(&EDTMASK) TYPE(*CHAR) LEN(256)
DCL VAR(&EDTMASKLEN) TYPE(*CHAR) LEN(4)
DCL VAR(&RCVVARLEN) TYPE(*CHAR) LEN(4)
DCL VAR(&ZROBAL) TYPE(*CHAR) LEN(1)
DCL VAR(&EDTCODE) TYPE(*CHAR) LEN(1) VALUE(‘1’)
DCL VAR(&CURRENCY) TYPE(*CHAR) LEN(1)
DCL VAR(&SRCVARPCSN) TYPE(*CHAR) LEN(4)
DCL VAR(&SRCVARDEC) TYPE(*CHAR) LEN(4)
/* SUBR(EDTNUM): End *************************************************/

/* SUBR(DUPQUOTE): Start *********************************************/
DCL VAR(&DUPQUOTE) TYPE(*INT) LEN(4)

DCL VAR(&TEXTIN) TYPE(*CHAR) LEN(50)
DCL VAR(&TEXTOUT) TYPE(*CHAR) LEN(100)
DCL VAR(&TEXT_I) TYPE(*UINT) LEN(2)
DCL VAR(&TEXT_J) TYPE(*UINT) LEN(2)
/* SUBR(DUPQUOTE): End ***********************************************/

/* RUNSQL */
DCL VAR(&SQL) TYPE(*CHAR) LEN(5000)

/* API Error & SUBR(RSTAPIERR): Start ********************************/
DCL VAR(&RSTAPIERR) TYPE(*INT) LEN(4)

DCL VAR(&APINAME) TYPE(*CHAR) LEN(10)
DCL VAR(&PRCNAME) TYPE(*CHAR) LEN(256) /* CALLPRC */
DCL VAR(&APIERROR) TYPE(*CHAR) LEN(528)
DCL VAR(&AEBYTPRO) TYPE(*INT) STG(*DEFINED) LEN(4) +
DEFVAR(&APIERROR 1)
DCL VAR(&AEBYTAVL) TYPE(*INT) STG(*DEFINED) LEN(4) +
DEFVAR(&APIERROR 5)
DCL VAR(&AEEXCPID) TYPE(*CHAR) STG(*DEFINED) LEN(7) +
DEFVAR(&APIERROR 9)
DCL VAR(&AEEXCPDTA) TYPE(*CHAR) STG(*DEFINED) LEN(512) +
DEFVAR(&APIERROR 17)
/* API Error & SUBR(RSTAPIERR): End **********************************/

/* _MATPGMNM */
DCL VAR(&DATA) TYPE(*CHAR) LEN(80)
DCL VAR(&PGMNAME) TYPE(*CHAR) LEN(10)
DCL VAR(&PGMLIB) TYPE(*CHAR) LEN(10)

/* RTVJOBA */
DCL VAR(&JOBNAME) TYPE(*CHAR) LEN(10)
DCL VAR(&JOBUSER) TYPE(*CHAR) LEN(10)
DCL VAR(&JOBNBR) TYPE(*CHAR) LEN(6)
DCL VAR(&JOBTYPE) TYPE(*CHAR) LEN(1) /* 0=Batch 1=Inter */

/* RCVMSG & SNDPGMMSG */
DCL VAR(&CMDNAME) TYPE(*CHAR) LEN(10)
DCL VAR(&ERROR) TYPE(*LGL) VALUE(‘0’)
DCL VAR(&PGMERROR) TYPE(*LGL) VALUE(‘0’)
DCL VAR(&SUBRNAME) TYPE(*CHAR) LEN(10)
DCL VAR(&ERRORTEXT) TYPE(*CHAR) LEN(100)
DCL VAR(&MSGID) TYPE(*CHAR) LEN(7)
DCL VAR(&MSGDTA) TYPE(*CHAR) LEN(512)
DCL VAR(&MSGDTALEN) TYPE(*DEC) LEN(5 0)
DCL VAR(&MSG) TYPE(*CHAR) LEN(1024)
DCL VAR(&MSGLEN) TYPE(*DEC) LEN(5 0)
DCL VAR(&SECLVL) TYPE(*CHAR) LEN(1024)
DCL VAR(&SECLVLLEN) TYPE(*DEC) LEN(5 0)
DCL VAR(&MSGF) TYPE(*CHAR) LEN(10)
DCL VAR(&MSGFLIB) TYPE(*CHAR) LEN(10)
DCL VAR(&MSGKEY) TYPE(*CHAR) LEN(4)
DCL VAR(&MSGKEYRQS) TYPE(*CHAR) LEN(4)
DCL VAR(&MSGTYPE) TYPE(*CHAR) LEN(7)
DCL VAR(&RTNTYPE) TYPE(*CHAR) LEN(2)
DCL VAR(&SENDER) TYPE(*CHAR) LEN(80)
DCL VAR(&SD_PGMSDR) TYPE(*CHAR) STG(*DEFINED) LEN(10) +
DEFVAR(&SENDER 27)

/* Constants */
DCL VAR(&LOOP) TYPE(*LGL) VALUE(‘1’)
DCL VAR(&NULL) TYPE(*CHAR) LEN(1) VALUE(X’00’)
DCL VAR(&QUOTE) TYPE(*CHAR) LEN(1) VALUE(X’7D’)

/* Global monitor for any error messages */
MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(ERROR))

/* Retrieve program name & library */
CHGVAR VAR(%BIN(&DATA 1 4)) VALUE(80)
CHGVAR VAR(%BIN(&DATA 5 4)) VALUE(80)
CHGVAR VAR(%BIN(&DATA 9 4)) VALUE(0)
CHGVAR VAR(%BIN(&DATA 13 4)) VALUE(0)
CALLPRC PRC(‘_MATPGMNM’) PARM((&DATA))
CHGVAR VAR(&PGMNAME) VALUE(%SST(&DATA 51 10))
CHGVAR VAR(&PGMLIB) VALUE(%SST(&DATA 19 10))

/* Retrieve job attributes */
RTVJOBA JOB(&JOBNAME) USER(&JOBUSER) NBR(&JOBNBR) +
TYPE(&JOBTYPE)

IF COND(&FROMFILE *NE ‘*ALL’) THEN(DO)

/* Check library and file */
RTVOBJD OBJ(&FROMLIB/&FROMFILE) OBJTYPE(*FILE) +
OBJATR(&OBJATR)
MONMSG MSGID(CPF9810) EXEC(DO) /* Library &1 not found. */
CHGVAR VAR(&MSGID) VALUE(‘CPF9897’)
CHGVAR VAR(&MSGDTA) VALUE(‘Library’ *BCAT &FROMLIB +
*BCAT ‘not found.’)
SNDPGMMSG MSGID(&MSGID) MSGF(QCPFMSG) MSGDTA(&MSGDTA) +
TOPGMQ(*PRV (*)) TOMSGQ(*TOPGMQ) MSGTYPE(*DIAG)
GOTO CMDLBL(CLEANUP)
ENDDO /* MSGID(CPF9810) */
MONMSG MSGID(CPF9812) EXEC(DO) /* File &1 in library +
&2 not found. */
CHGVAR VAR(&MSGID) VALUE(‘CPF9897’)
CHGVAR VAR(&MSGDTA) VALUE(‘File’ *BCAT &FROMFILE +
*BCAT ‘not found in library’ *BCAT +
&FROMLIB *TCAT ‘.’)
SNDPGMMSG MSGID(&MSGID) MSGF(QCPFMSG) MSGDTA(&MSGDTA) +
TOPGMQ(*PRV (*)) TOMSGQ(*TOPGMQ) MSGTYPE(*DIAG)
GOTO CMDLBL(CLEANUP)
ENDDO /* MSGID(CPF9801) */

IF COND(&OBJATR *NE ‘PF’) THEN(DO)
CHGVAR VAR(&MSGID) VALUE(‘CPF9897’)
CHGVAR VAR(&MSGDTA) VALUE(‘File’ *BCAT &FROMFILE +
*BCAT ‘in library’ *BCAT &FROMLIB *BCAT +
‘is not a physical file (‘ *CAT &OBJATR +
*TCAT ‘).’)
SNDPGMMSG MSGID(&MSGID) MSGF(QCPFMSG) MSGDTA(&MSGDTA) +
TOPGMQ(*PRV (*)) TOMSGQ(*TOPGMQ) MSGTYPE(*DIAG)
GOTO CMDLBL(CLEANUP)
ENDDO /* COND(&OBJATR *NE ‘PF’) */

/* Check file type */
CHGVAR VAR(&QDBFIN) VALUE(&PFROMFILE)
CHGVAR VAR(&QDBFOVR) VALUE(‘0’)
CHGVAR VAR(&QDBFSYS) VALUE(‘*LCL’)

CALLSUBR SUBR(VFYPFSRC) RTNVAL(&VFYPFSRC)

IF COND(&VFYPFSRC *NE 0) THEN(DO)
GOTO CMDLBL(ERROR)
ENDDO /* COND(&VFYPFSRC *NE 0) */

IF COND((&FILEATRB *NE ‘PF’) *OR (&FILETYPE *NE +
‘SRC’)) THEN(DO)
CHGVAR VAR(&MSGID) VALUE(‘CPF9897’)
CHGVAR VAR(&MSGDTA) VALUE(‘File’ *BCAT &FROMFILE +
*BCAT ‘in library’ *BCAT &FROMLIB *BCAT +
‘is not a source physical file (‘ *CAT +
&FILEATRB *CAT ‘-‘ *CAT &FILETYPE *CAT ‘).’)
SNDPGMMSG MSGID(&MSGID) MSGF(QCPFMSG) MSGDTA(&MSGDTA) +
TOPGMQ(*PRV (*)) TOMSGQ(*TOPGMQ) MSGTYPE(*DIAG)
GOTO CMDLBL(CLEANUP)
ENDDO /* COND((&FILEATRB *NE ‘PF’) *OR (&FILETYPE *NE +
‘SRC’) */

ENDDO /* COND(&FROMFILE *NE ‘*ALL’) */

/* Check TODIR parameter */
CHGVAR VAR(&STATPATH) VALUE(&PTODIR *TCAT &NULL)

CALLPRC PRC(‘stat64’) PARM((&STATPATH) (&STATBUFFER)) +
RTNVAL(&STATRTNVAL)

IF COND(&STATRTNVAL *NE 0) THEN(DO)
IF COND(&PCRTDIR *EQ ‘*YES’) THEN(DO)
CRTDIR DIR(&PTODIR) DTAAUT(*INDIR) OBJAUT(*INDIR)
ENDDO /* COND(&PCRTDIR *EQ ‘*YES’) */
ELSE CMD(DO)
CHGVAR VAR(&MSGID) VALUE(‘CPFA0A9’) /* Object not +
found */
CALLPRC PRC(‘strlen’) PARM((&STATPATH)) RTNVAL(&LENINT)
CHGVAR VAR(%BIN(&MSGDTA 1 4)) VALUE(&LENINT)
CHGVAR VAR(%SST(&MSGDTA 5 &LENINT)) +
VALUE(%SST(&PTODIR 1 &LENINT))
SNDPGMMSG MSGID(&MSGID) MSGF(QCPFMSG) MSGDTA(&MSGDTA) +
TOPGMQ(*PRV (*)) TOMSGQ(*TOPGMQ) MSGTYPE(*DIAG)
GOTO CMDLBL(CLEANUP)
ENDDO /* COND(&PCRTDIR *NE ‘*YES’) */
ENDDO /* COND(&STATRTNVAL *NE 0) */
ELSE CMD(DO)
IF COND(&STATOBJTYP *NE ‘*DIR’) THEN(DO)
CHGVAR VAR(&MSGID) VALUE(‘CPF9897’)
CHGVAR VAR(&MSGDTA) VALUE(‘TODIR parameter must be +
a directory (‘ *CAT &QUOTE *CAT +
&STATOBJTYP *TCAT &QUOTE *CAT ‘).’)
SNDPGMMSG MSGID(&MSGID) MSGF(QCPFMSG) MSGDTA(&MSGDTA) +
TOPGMQ(*PRV (*)) TOMSGQ(*TOPGMQ) MSGTYPE(*DIAG)
GOTO CMDLBL(CLEANUP)
ENDDO /* COND(&STATOBJTYP *NE ‘*DIR’) */
ENDDO /* COND(&STATRTNVAL *EQ 0) */

/* Check last &PTODIR char */
CALLPRC PRC(‘strlen’) PARM((&STATPATH)) RTNVAL(&LENINT)

IF COND(%SST(&STATPATH &LENINT 1) *NE ‘/’) THEN(DO)
CHGVAR VAR(&TODIR) VALUE(&PTODIR *TCAT ‘/’)
ENDDO /* COND(%SST(&STATPATH &LENINT 1) *NE ‘/’) */
ELSE CMD(DO)
CHGVAR VAR(&TODIR) VALUE(&PTODIR)
ENDDO /* COND(%SST(&STATPATH &LENINT 1) *EQ ‘/’) */

/* Work with multiple PF-SRC */
IF COND(&FROMFILE *EQ ‘*ALL’) THEN(DO)

/* Extract PF-SRC to be processed */
DLTF FILE(QTEMP/PFSRCLIST)
MONMSG MSGID(CPF2105) /* Object &1 in &2 type *&3 not +
found */

CHGVAR VAR(&SQL) VALUE(‘CREATE TABLE QTEMP/PFSRCLIST +
AS (SELECT DBXFIL FROM QADBXREF WHERE DBXTYP +
= ”S” AND DBXLIB = ”’ *CAT &FROMLIB *TCAT +
”’ ORDER BY DBXFIL) WITH DATA’)

RUNSQL SQL(&SQL) COMMIT(*NONE)

/* Check PF-SRC to be processed */
RTVMBRD FILE(QTEMP/PFSRCLIST) MBR(*FIRST) +
NBRCURRCD(&NBRSELPFS)

IF COND(&NBRSELPFS *EQ 0) THEN(DO)
CHGVAR VAR(&MSGID) VALUE(‘CPF9897’)
CHGVAR VAR(&MSGDTA) VALUE(‘No PF-SRC found in +
library’ *BCAT &FROMLIB *TCAT ‘.’)
SNDPGMMSG MSGID(&MSGID) MSGF(QCPFMSG) MSGDTA(&MSGDTA) +
TOPGMQ(*PRV (*)) TOMSGQ(*TOPGMQ) MSGTYPE(*DIAG)
GOTO CMDLBL(CLEANUP)
ENDDO /* COND(&NBRSELPFS *EQ 0) */

/* Read PF-SRC file */
OVRDBF FILE(PFSRCLIST) TOFILE(QTEMP/PFSRCLIST) +
MBR(*FIRST) LVLCHK(*NO) OVRSCOPE(*CALLLVL) +
SHARE(*NO)

DOWHILE COND(&LOOP)
RCVF OPNID(PFSRC)
MONMSG MSGID(CPF0864) EXEC(LEAVE)
SBMJOB CMD(CPYSRC2IFS +
FROMFILE(&FROMLIB/&PFSRC_DBXFIL) +
MBR(&PMBR) LIBASPDEV(&PLIBASPDEV) +
TODIR(&TODIR *TCAT &PFSRC_DBXFIL) +
CRTDIR(&PCRTDIR) STMFEXT(&PSTMFEXT) +
STMFCCSID(&PSTMFCCSID) +
ENDLINFMT(&PENDLINFMT) AUT(&PAUT) +
STMFTXT(&PSTMFTXT) REPORT(&PREPORT) +
SLOC(&PSLOC)) JOB(&PFSRC_DBXFIL)
ENDDO /* WHILE */

GOTO CMDLBL(CLEANUP)

ENDDO /* COND(&FROMFILE *EQ ‘*ALL’) */

/* Set STMF extension (1) */
SELECT
WHEN COND(&PSTMFEXT *EQ ‘*NONE’) THEN(DO)
CHGVAR VAR(&STMFEXT) VALUE(‘ ‘)
ENDDO /* COND(&PSTMFEXT *EQ ‘*NONE’) */
WHEN COND(&PSTMFEXT *EQ ‘*DFT’) THEN(DO)
CHGVAR VAR(&STMFEXT) VALUE(‘.MBR’)
ENDDO /* COND(&PSTMFEXT *EQ ‘*DFT’) */
OTHERWISE CMD(DO)
IF COND(%SST(&PSTMFEXT 1 1) *EQ ‘.’) THEN(DO)
CHGVAR VAR(&STMFEXT) VALUE(&PSTMFEXT)
ENDDO /* COND(%SST(&PSTMFEXT 1 1) *EQ ‘.’) */
ELSE CMD(DO)
CHGVAR VAR(&STMFEXT) VALUE(‘.’ *CAT &PSTMFEXT)
ENDDO /* COND(%SST(&PSTMFEXT 1 1) *NE ‘.’) */
ENDDO /* OTHERWISE */
ENDSELECT

/* Set MBR path (1) */
IF COND(&PLIBASPDEV *EQ ‘*SYSBAS’) THEN(DO)
CHGVAR VAR(&ASPPATH) VALUE(‘ ‘)
ENDDO /* COND(&PLIBASPDEV *EQ ‘*SYSBAS’) */
ELSE CMD(DO)
CHGVAR VAR(&ASPPATH) VALUE(‘/’ *CAT &PLIBASPDEV)
ENDDO /* COND(&PLIBASPDEV *NE ‘*SYSBAS’) */

/* Build member list in output file */
DLTF FILE(QTEMP/MEMBERLIST)
MONMSG MSGID(CPF2105) /* Object &1 in &2 type *&3 not found */

DSPFD FILE(&FROMLIB/&FROMFILE) TYPE(*MBR) +
OUTPUT(*OUTFILE) OUTFILE(QTEMP/MEMBERLIST) +
OUTMBR(*FIRST *REPLACE)

/* Extract members to be processed */
DLTF FILE(QTEMP/MBRLIST)
MONMSG MSGID(CPF2105) /* Object &1 in &2 type *&3 not found */

CHGVAR VAR(&SQL) VALUE(‘CREATE TABLE QTEMP.MBRLIST AS +
(SELECT MBNAME, MBSEU2, MBMTXT, MBNRCD, MBCCEN, +
MBCDAT, MBCTIM, MBUPDC, MBUPDD, MBUPDT FROM +
QTEMP.MEMBERLIST WHERE MBNAME NOT LIKE ” %” +
AND MBNAME LIKE REPLACE(”’ *CAT &PMBR *TCAT +
”’, ”*”, ”%”) ORDER BY MBNAME) WITH DATA’)

RUNSQL SQL(&SQL) COMMIT(*NONE)

/* Check the number of members to be processed */
RTVMBRD FILE(QTEMP/MBRLIST) MBR(*FIRST) NBRCURRCD(&NBRSELMBR)

IF COND(&NBRSELMBR *EQ 0) THEN(DO)
IF COND((&JOBTYPE *EQ ‘1’) *AND (&PCRTDIR *EQ +
‘*YES’)) THEN(DO)
RMVDIR DIR(&PTODIR) SUBTREE(*NONE)
ENDDO /* COND((&JOBTYPE *EQ ‘1’) *AND (&PCRTDIR *EQ +
‘*YES’)) */
CHGVAR VAR(&MSGID) VALUE(‘CPF9897’)
CHGVAR VAR(&MSGDTA) VALUE(‘No members selected.’)
SNDPGMMSG MSGID(&MSGID) MSGF(QCPFMSG) MSGDTA(&MSGDTA) +
TOPGMQ(*PRV (*)) TOMSGQ(*TOPGMQ) MSGTYPE(*DIAG)
GOTO CMDLBL(CLEANUP)
ENDDO /* COND(&NBRSELMBR *EQ 0) */

/* Create report file */
IF COND(&PREPORT *EQ ‘*YES’) THEN(DO)

DLTF FILE(QTEMP/REPORT)
MONMSG MSGID(CPF2105) /* Object &1 in &2 type *&3 not +
found */

CRTPF FILE(QTEMP/REPORT) RCDLEN(200)

IF COND(&PSLOC *EQ ‘*NO’) THEN(DO)
CHGVAR VAR(&SQL) VALUE(‘INSERT INTO QTEMP.REPORT +
VALUES(””LIBRARY”;”FILE”;”MEMBER”;”TYPE”;”T+
EXT”;”NBR_RCD”;”CRT_TIMESTAMP”;”LAST_CHG_TIM+
ESTAMP”;”IFS_SIZE”;”IFS_ALLOC””)’)
ENDDO /* COND(&PSLOC *EQ ‘*NO’) */
ELSE CMD(DO)
CHGVAR VAR(&SQL) VALUE(‘INSERT INTO QTEMP.REPORT +
VALUES(””LIBRARY”;”FILE”;”MEMBER”;”TYPE”;”T+
EXT”;”NBRRCD”;”PHYSICAL_SLOC”;”CRT_TIMESTAMP+
“;”LAST_CHG_TIMESTAMP”;”IFS_SIZE”;”IFS_ALLOC+
“”)’)
ENDDO /* COND(&PSLOC *NE ‘*NO’) */

RUNSQL SQL(&SQL) COMMIT(*NONE)

CHGVAR VAR(&REPORT) VALUE(&TODIR *TCAT ‘#Report_’ *CAT +
&JOBNBR *TCAT ‘-‘ *CAT &JOBUSER *TCAT ‘-‘ +
*CAT &JOBNAME *TCAT ‘.csv’)

RMVLNK OBJLNK(&STMF)
MONMSG MSGID(CPFA0A9)

/* Create temporary file to estimate physical SLOC for Cobol and RPG */
IF COND(&PSLOC *EQ ‘*YES’) THEN(DO)

DLTF FILE(QTEMP/SLOC)
MONMSG MSGID(CPF2105)

CHGVAR VAR(&SQL) VALUE(‘CREATE TABLE QTEMP/SLOC +
(NUMBER NUMERIC(10, 0))’)

RUNSQL SQL(&SQL) COMMIT(*NONE)

CHGVAR VAR(&SQL) VALUE(‘INSERT INTO +
QTEMP/SLOC(NUMBER) VALUES(0)’)

RUNSQL SQL(&SQL) COMMIT(*NONE)

OVRDBF FILE(SLOC) TOFILE(QTEMP/SLOC) MBR(*FIRST) +
LVLCHK(*NO) OVRSCOPE(*CALLLVL)

ENDDO /* COND(&PSLOC *EQ ‘*YES’) */

ENDDO /* COND(&PREPORT *EQ ‘*YES’) */

/* Read member list file */
OVRDBF FILE(MBRLIST) TOFILE(QTEMP/MBRLIST) MBR(*FIRST) +
LVLCHK(*NO) OVRSCOPE(*CALLLVL) SHARE(*NO)

DOWHILE COND(&LOOP)

RCVF OPNID(MBRINFO)
MONMSG MSGID(CPF0864) EXEC(LEAVE)

/* Count members */
CHGVAR VAR(&MBRCNTX) VALUE(&MBRCNTX + 1)

/* Send *INFO or *STATUS message indicating the member being processed */
CHGVAR VAR(&MSGDTA) VALUE(‘Processing MBR(‘ *CAT +
&MBRINFO_MBNAME *TCAT ‘) TYPE(‘ *CAT +
&MBRINFO_MBSEU2 *TCAT ‘) NBRRCD(‘ *CAT +
%CHAR(&MBRINFO_MBNRCD) *TCAT ‘) [‘ *CAT +
%CHAR(&MBRCNTX) *TCAT ‘/’ *CAT +
%CHAR(&NBRSELMBR) *TCAT ‘|’ *CAT +
%CHAR(&NBRALLMBR) *TCAT ‘]’)

IF COND(&JOBTYPE *EQ ‘0’) THEN(DO) /* Batch */
SNDPGMMSG MSGID(CPI8859) MSGF(QCPFMSG) MSGDTA(&MSGDTA) +
TOPGMQ(*PRV (*)) TOMSGQ(*TOPGMQ) MSGTYPE(*INFO)
ENDDO /* COND(&JOBTYPE *EQ ‘0’) */
ELSE CMD(DO) /* Interactive */
SNDPGMMSG MSGID(CPI8859) MSGF(QCPFMSG) MSGDTA(&MSGDTA) +
TOPGMQ(*EXT) TOMSGQ(*TOPGMQ) MSGTYPE(*STATUS)
ENDDO /* COND(&JOBTYPE *NE ‘0’) */

/* Set MBR path (2) */
CHGVAR VAR(&MBRPATH) VALUE(&ASPPATH *TCAT ‘/QSYS.LIB/’ +
*CAT &FROMLIB *TCAT ‘.LIB/’ *CAT &FROMFILE +
*TCAT ‘.FILE/’ *CAT &MBRINFO_MBNAME *TCAT ‘.MBR’)

/* Set STMF extension (2) & STMF path */
IF COND(&PSTMFEXT *NE ‘*TYPE’) THEN(DO)
CHGVAR VAR(&STMF) VALUE(&TODIR *TCAT +
&MBRINFO_MBNAME *TCAT &STMFEXT)
ENDDO /* COND(&PSTMFEXT *NE ‘*TYPE’) */
ELSE CMD(DO)
IF COND(&MBRINFO_MBSEU2 *NE ‘ ‘) THEN(DO)
CHGVAR VAR(&STMF) VALUE(&TODIR *TCAT +
&MBRINFO_MBNAME *TCAT ‘.’ *CAT +
&MBRINFO_MBSEU2)
ENDDO /* COND(&MBRINFO_MBSEU2 *NE ‘ ‘) */
ELSE CMD(DO)
CHGVAR VAR(&STMF) VALUE(&TODIR *TCAT &MBRINFO_MBNAME)
ENDDO /* COND(&MBRINFO_MBSEU2 *EQ ‘ ‘) */

ENDDO /* COND(&PSTMFEXT *EQ ‘*TYPE’) */

/* Copy MBR to STMF */
CPYTOSTMF FROMMBR(&MBRPATH) TOSTMF(&STMF) +
STMFOPT(*REPLACE) CVTDTA(*AUTO) +
DBFCCSID(*FILE) STMFCCSID(&PSTMFCCSID) +
ENDLINFMT(&PENDLINFMT) AUT(&PAUT)

/* Set STMF description */
IF COND(&PSTMFTXT *EQ ‘*YES’) THEN(DO)
CHGATR OBJ(&STMF) ATR(*TEXT) VALUE(*NONE) +
TEXT(&MBRINFO_MBMTXT)
ENDDO /* COND(&PSTMFTXT *EQ ‘*YES’) */

/* Count members */
CHGVAR VAR(&MBRCNT) VALUE(&MBRCNT + 1)

/* Count records */
CHGVAR VAR(&RCDCNT) VALUE(&RCDCNT + &MBRINFO_MBNRCD)

/* Retrieve STMF information */
CHGVAR VAR(&STATPATH) VALUE(&STMF *TCAT &NULL)
CALLPRC PRC(‘stat64’) PARM((&STATPATH) (&STATBUFFER)) +
RTNVAL(&STATRTNVAL)
IF COND(&STATRTNVAL *EQ 0) THEN(DO)
CHGVAR VAR(&IFSSIZ) VALUE(&IFSSIZ + &STATOBJSIZ)
CHGVAR VAR(&IFSALC) VALUE(&IFSALC + &STATALCSIZ)
ENDDO /* COND(&STATRTNVAL *EQ 0) */
ELSE CMD(DO)
CHGVAR VAR(&PRCNAME) VALUE(‘stat64’)
CHGVAR VAR(&SUBRNAME) VALUE(‘MAIN’)
CHGVAR VAR(&ERRORTEXT) VALUE(‘ (PRC’ *BCAT &PRCNAME +
*BCAT ‘in’ *BCAT &SUBRNAME *TCAT ‘)’)
GOTO CMDLBL(ERROR)
ENDDO /* COND(&STATRTNVAL *NE 0) */

/* Update report file */
IF COND(&PREPORT *EQ ‘*YES’) THEN(DO)

CHGVAR VAR(&TEXTIN) VALUE(&MBRINFO_MBMTXT)
CALLSUBR SUBR(DUPQUOTE) RTNVAL(&DUPQUOTE)

IF COND(&MBRINFO_MBCCEN *EQ ‘0’) THEN(DO)
CHGVAR VAR(&MBRCRTCEN) VALUE(’19’)
ENDDO /* COND(&MBRINFO_MBCCEN *EQ ‘0’) */
ELSE CMD(DO)
CHGVAR VAR(&MBRCRTCEN) VALUE(’20’)
ENDDO /* COND(&MBRINFO_MBCCEN *NE ‘0’) */

CHGVAR VAR(&MBRCRTDAT) VALUE(&MBRCRTCEN *CAT +
%SST(&MBRINFO_MBCDAT 1 2) *CAT ‘-‘ *CAT +
%SST(&MBRINFO_MBCDAT 3 2) *CAT ‘-‘ *CAT +
%SST(&MBRINFO_MBCDAT 5 2))

CHGVAR VAR(&MBRCRTTIM) VALUE(%SST(&MBRINFO_MBCTIM 1 +
2) *CAT ‘.’ *CAT %SST(&MBRINFO_MBCTIM 3 2) +
*CAT ‘.’ *CAT %SST(&MBRINFO_MBCTIM 5 2))

CHGVAR VAR(&MBRCRTTS) VALUE(&MBRCRTDAT *CAT ‘-‘ +
*CAT &MBRCRTTIM *CAT ‘.000000’)

IF COND(&MBRINFO_MBUPDC *EQ ‘0’) THEN(DO)
CHGVAR VAR(&MBRCHGCEN) VALUE(’19’)
ENDDO /* COND(&MBRINFO_MBUPDC *EQ ‘0’) */
ELSE CMD(DO)
CHGVAR VAR(&MBRCHGCEN) VALUE(’20’)
ENDDO /* COND(&MBRINFO_MBUPDC *NE ‘0’) */

CHGVAR VAR(&MBRCHGDAT) VALUE(&MBRCHGCEN *CAT +
%SST(&MBRINFO_MBUPDD 1 2) *CAT ‘-‘ *CAT +
%SST(&MBRINFO_MBUPDD 3 2) *CAT ‘-‘ *CAT +
%SST(&MBRINFO_MBUPDD 5 2))

CHGVAR VAR(&MBRCHGTIM) VALUE(%SST(&MBRINFO_MBUPDT 1 +
2) *CAT ‘.’ *CAT %SST(&MBRINFO_MBUPDT 3 2) +
*CAT ‘.’ *CAT %SST(&MBRINFO_MBUPDT 5 2))

CHGVAR VAR(&MBRCHGTS) VALUE(&MBRCHGDAT *CAT ‘-‘ +
*CAT &MBRCHGTIM *CAT ‘.000000’)

/* Estimate physical SLOC for Cobol and RPG */
IF COND(&PSLOC *EQ ‘*YES’) THEN(DO)

SELECT
WHEN COND((%SCAN(‘CBL’ &MBRINFO_MBSEU2) *GT +
0) *OR (%SCAN(‘CBL’ &PSTMFEXT) *GT +
0)) THEN(DO)
CHGVAR VAR(&SQL) VALUE(‘UPDATE QTEMP/SLOC +
SET NUMBER = (SELECT COUNT(*) +
FROM +
TABLE(QSYS2.IFS_READ(PATH_NAME => +
”’ *CAT &STMF *TCAT ”’, +
END_OF_LINE => ”’ *CAT +
%SST(&PENDLINFMT 2 5) *TCAT ”’)) +
WHERE LINE LIKE ”_%” AND NOT +
REGEXP_LIKE(LINE, ”^.{6}*.*”) +
AND NOT REGEXP_LIKE(LINE, +
”^.{6}s.*processs.*”, ”i”))’)
CHGVAR VAR(&SLOC) VALUE(‘1’)
ENDDO /* COND((%SCAN(‘CBL’ &MBRINFO_MBSEU2) +
*LE 0) *OR (%SCAN(‘CBL’ &PSTMFEXT) +
*LE 0)) */
WHEN COND((%SCAN(‘RPG’ &MBRINFO_MBSEU2) *GT +
0) *OR (%SCAN(‘RPG’ &PSTMFEXT) *GT +
0)) THEN(DO)
CHGVAR VAR(&SQL) VALUE(‘UPDATE QTEMP/SLOC +
SET NUMBER = (SELECT COUNT(*) +
FROM +
TABLE(QSYS2.IFS_READ(PATH_NAME => +
”’ *CAT &STMF *TCAT ”’, +
END_OF_LINE => ”’ *CAT +
%SST(&PENDLINFMT 2 5) *TCAT ”’)) +
WHERE LINE LIKE ”_%” AND NOT +
REGEXP_LIKE(LINE, ”^**free”, +
”i”) AND NOT REGEXP_LIKE(LINE, +
”^s*ctl-opts.*”, ”i”) AND +
NOT REGEXP_LIKE(LINE, +
”^s*//(.)*”) AND NOT +
REGEXP_LIKE(LINE, +
”^s*/[a-zA-Z]”, ”i”) AND +
NOT REGEXP_LIKE(LINE, +
”^.{6}*((?!;).)*$”))’)
CHGVAR VAR(&ampSLOC) VALUE(‘1’)
ENDDO /* COND((%SCAN(‘RPG’ &ampMBRINFO_MBSEU2) +
*GT 0) *OR (%SCAN(‘RPG’ &ampPSTMFEXT) +
*GT 0)) */
OTHERWISE CMD(DO)
CHGVAR VAR(&ampSLOC) VALUE(‘0’)
ENDDO /* OTHERWISE */
ENDSELECT

IF COND(&ampSLOC) THEN(DO)
RUNSQL SQL(&ampSQL) COMMIT(*NONE)
RCVF OPNID(SLOC)
CLOSE OPNID(SLOC) /* RCVF */
CHGVAR VAR(&ampSQL) VALUE(‘INSERT INTO +
QTEMP.REPORT VALUES(””‘ *CAT +
&ampFROMLIB *TCAT ‘”;”‘ *CAT &ampFROMFILE +
*TCAT ‘”;”‘ *CAT &ampMBRINFO_MBNAME +
*TCAT ‘”;”‘ *CAT &ampMBRINFO_MBSEU2 +
*TCAT ‘”;”‘ *CAT &ampTEXTOUT *TCAT +
‘”;”‘ *CAT %CHAR(&ampMBRINFO_MBNRCD) +
*TCAT ‘”;”‘ *CAT %CHAR(&ampSLOC_NUMBER) +
*TCAT ‘”;”‘ *CAT &ampMBRCRTTS *TCAT +
‘”;”‘ *CAT &ampMBRCHGTS *TCAT ‘”;”‘ +
*CAT %CHAR(&ampSTATOBJSIZ) *TCAT ‘”;”‘ +
*CAT %CHAR(&ampSTATALCSIZ) *TCAT ‘””)’)
ENDDO /* COND(&ampSLOC) */
ELSE CMD(DO)
CHGVAR VAR(&ampSLOC_NUMBER) VALUE(0)
CHGVAR VAR(&ampSQL) VALUE(‘INSERT INTO +
QTEMP.REPORT VALUES(””‘ *CAT +
&ampFROMLIB *TCAT ‘”;”‘ *CAT &ampFROMFILE +
*TCAT ‘”;”‘ *CAT &ampMBRINFO_MBNAME +
*TCAT ‘”;”‘ *CAT &ampMBRINFO_MBSEU2 +
*TCAT ‘”;”‘ *CAT &ampTEXTOUT *TCAT +
‘”;”‘ *CAT %CHAR(&ampMBRINFO_MBNRCD) +
*TCAT ‘”;” “;”‘ *CAT &ampMBRCRTTS *TCAT +
‘”;”‘ *CAT &ampMBRCHGTS *TCAT ‘”;”‘ +
*CAT %CHAR(&ampSTATOBJSIZ) *TCAT ‘”;”‘ +
*CAT %CHAR(&ampSTATALCSIZ) *TCAT ‘””)’)
ENDDO /* COND(*NOT &ampSLOC) */
CHGVAR VAR(&ampSLOCCNT) VALUE(&ampSLOCCNT + &ampSLOC_NUMBER)

ENDDO /* COND(&ampPSLOC *EQ ‘*YES’) */

ELSE CMD(DO)

CHGVAR VAR(&ampSQL) VALUE(‘INSERT INTO QTEMP.REPORT +
VALUES(””‘ *CAT &ampFROMLIB *TCAT ‘”;”‘ +
*CAT &ampFROMFILE *TCAT ‘”;”‘ *CAT +
&ampMBRINFO_MBNAME *TCAT ‘”;”‘ *CAT +
&ampMBRINFO_MBSEU2 *TCAT ‘”;”‘ *CAT +
&ampTEXTOUT *TCAT ‘”;”‘ *CAT +
%CHAR(&ampMBRINFO_MBNRCD) *TCAT ‘”;”‘ *CAT +
&ampMBRCRTTS *TCAT ‘”;”‘ *CAT &ampMBRCHGTS +
*TCAT ‘”;”‘ *CAT %CHAR(&ampSTATOBJSIZ) +
*TCAT ‘”;”‘ *CAT %CHAR(&ampSTATALCSIZ) +
*TCAT ‘””)’)

ENDDO /* COND(&ampPSLOC *NE ‘*YES’) */

RUNSQL SQL(&ampSQL) COMMIT(*NONE)

ENDDO /* COND(&ampPREPORT *EQ ‘*YES’) */

ENDDO /* DOWHILE */

/* Display run statistics */
CHGVAR VAR(&ampSIZEDEC) VALUE(&ampMBRCNT)
CALLSUBR SUBR(EDTNUM) RTNVAL(&ampEDTNUM)
IF COND(&ampEDTNUM *EQ 0) THEN(DO)
CHGVAR VAR(&ampMBRCNTCHAR) VALUE(&ampSIZECHAR)
ENDDO /* COND(&ampEDTNUM *EQ 0) */
ELSE CMD(DO)
CHGVAR VAR(&ampMBRCNTCHAR) VALUE(‘0’)
ENDDO /* COND(&ampEDTNUM *NE 0) */

CHGVAR VAR(&ampSIZEDEC) VALUE(&ampRCDCNT)
CALLSUBR SUBR(EDTNUM) RTNVAL(&ampEDTNUM)
IF COND(&ampEDTNUM *EQ 0) THEN(DO)
CHGVAR VAR(&ampRCDCNTCHAR) VALUE(&ampSIZECHAR)
ENDDO /* COND(&ampEDTNUM *EQ 0) */
ELSE CMD(DO)
CHGVAR VAR(&ampRCDCNTCHAR) VALUE(‘0’)
ENDDO /* COND(&ampEDTNUM *NE 0) */

CHGVAR VAR(&ampSIZEDEC) VALUE(&ampIFSSIZ)
CALLSUBR SUBR(EDTNUM) RTNVAL(&ampEDTNUM)
IF COND(&ampEDTNUM *EQ 0) THEN(DO)
CHGVAR VAR(&ampIFSSIZCHAR) VALUE(&ampSIZECHAR)
ENDDO /* COND(&ampEDTNUM *EQ 0) */
ELSE CMD(DO)
CHGVAR VAR(&ampIFSSIZCHAR) VALUE(‘0’)
ENDDO /* COND(&ampEDTNUM *NE 0) */

CHGVAR VAR(&ampSIZEDEC) VALUE(&ampIFSALC)
CALLSUBR SUBR(EDTNUM) RTNVAL(&ampEDTNUM)
IF COND(&ampEDTNUM *EQ 0) THEN(DO)
CHGVAR VAR(&ampIFSALCCHAR) VALUE(&ampSIZECHAR)
ENDDO /* COND(&ampEDTNUM *EQ 0) */
ELSE CMD(DO)
CHGVAR VAR(&ampIFSALCCHAR) VALUE(‘0’)
ENDDO /* COND(&ampEDTNUM *NE 0) */

IF COND(&ampPSLOC *EQ ‘*YES’) THEN(DO)
CHGVAR VAR(&ampSIZEDEC) VALUE(&ampSLOCCNT)
CALLSUBR SUBR(EDTNUM) RTNVAL(&ampEDTNUM)
IF COND(&ampEDTNUM *EQ 0) THEN(DO)
CHGVAR VAR(&ampSLOCCNTCHR) VALUE(&ampSIZECHAR)
ENDDO /* COND(&ampEDTNUM *EQ 0) */
ELSE CMD(DO)
CHGVAR VAR(&ampSLOCCNTCHR) VALUE(‘0’)
ENDDO /* COND(&ampEDTNUM *NE 0) */
ENDDO /* COND(&ampPSLOC *EQ ‘*YES’) */

/* Create CSV report */
IF COND(&ampPREPORT *EQ ‘*YES’) THEN(DO)

IF COND(&ampPSLOC *EQ ‘*NO’) THEN(DO)
CHGVAR VAR(&ampSQL) VALUE(‘INSERT INTO QTEMP.REPORT +
VALUES(”””;””;”‘ *CAT %CHAR(&ampMBRCNT) +
*TCAT ‘”;””;””;”‘ *CAT %CHAR(&ampRCDCNT) +
*TCAT ‘”;””;””;”‘ *CAT %CHAR(&ampIFSSIZ) +
*TCAT ‘”;”‘ *CAT %CHAR(&ampIFSALC) *TCAT ‘””)’)
ENDDO /* COND(&ampPSLOC *EQ ‘*NO’) */
ELSE CMD(DO)
CHGVAR VAR(&ampSQL) VALUE(‘INSERT INTO QTEMP.REPORT +
VALUES(”””;””;”‘ *CAT %CHAR(&ampMBRCNT) +
*TCAT ‘”;””;””;”‘ *CAT %CHAR(&ampRCDCNT) +
*TCAT ‘”;”‘ *CAT %CHAR(&ampSLOCCNT) *TCAT +
‘”;””;””;”‘ *CAT %CHAR(&ampIFSSIZ) *TCAT +
‘”;”‘ *CAT %CHAR(&ampIFSALC) *TCAT ‘””)’)
ENDDO /* COND(&ampPSLOC *NE ‘*NO’) */

RUNSQL SQL(&ampSQL) COMMIT(*NONE)

CPYTOSTMF +
FROMMBR(‘/QSYS.LIB/QTEMP.LIB/REPORT.FILE/REPORT+
.MBR’) TOSTMF(&ampREPORT) STMFOPT(*REPLACE) +
CVTDTA(*AUTO) DBFCCSID(*FILE) +
STMFCCSID(&ampPSTMFCCSID) ENDLINFMT(&ampPENDLINFMT) +
AUT(&ampPAUT)

DLTF FILE(QTEMP/REPORT)
MONMSG MSGID(CPF0000)

ENDDO /* COND(&ampPREPORT *EQ ‘*YES’) */

IF COND(&ampPSLOC *EQ ‘*NO’) THEN(DO)
CHGVAR VAR(&ampMSGDTA) VALUE(‘Member processed:’ *BCAT +
%TRIML(&ampMBRCNTCHAR) *BCAT ‘- Records:’ *BCAT +
%TRIML(&ampRCDCNTCHAR) *BCAT ‘- IFS size +
(byte):’ *BCAT %TRIML(&ampIFSSIZCHAR) *BCAT ‘- +
IFS allocated size (byte):’ *BCAT +
%TRIML(&ampIFSALCCHAR))
ENDDO /* COND(&ampPSLOC *EQ ‘*NO’) */
ELSE CMD(DO)
CHGVAR VAR(&ampMSGDTA) VALUE(‘Member processed:’ *BCAT +
%TRIML(&ampMBRCNTCHAR) *BCAT ‘- Records:’ *BCAT +
%TRIML(&ampRCDCNTCHAR) *BCAT ‘- Cobol SLOC:’ +
*BCAT %TRIML(&ampSLOCCNTCHR) *BCAT ‘- IFS size +
(byte):’ *BCAT %TRIML(&ampIFSSIZCHAR) *BCAT ‘- +
IFS allocated size (byte):’ *BCAT +
%TRIML(&ampIFSALCCHAR))
ENDDO /* COND(&ampPSLOC *NE ‘*NO’) */

SNDPGMMSG MSGID(CPI8859) MSGF(QCPFMSG) MSGDTA(&ampMSGDTA) +
TOPGMQ(*PRV (*)) TOMSGQ(*TOPGMQ) MSGTYPE(*INFO)

GOTO CMDLBL(CLEANUP)

ERROR:
RCVMSG PGMQ(*SAME) MSGTYPE(*LAST) RMV(*YES) MSG(&ampMSG) +
MSGLEN(&ampMSGLEN) SECLVL(&ampSECLVL) +
SECLVLLEN(&ampSECLVLLEN) MSGDTA(&ampMSGDTA) +
MSGDTALEN(&ampMSGDTALEN) MSGID(&ampMSGID) +
RTNTYPE(&ampRTNTYPE) MSGF(&ampMSGF) SNDMSGFLIB(&ampMSGFLIB)

CHGVAR VAR(&ampPGMERROR) VALUE(‘1’)

CLEANUP:
DLTF FILE(QTEMP/MEMBERLIST)
MONMSG MSGID(CPF0000)

CLOSE OPNID(PFSRC) /* RCVF */
MONMSG MSGID(CPF0000)

CLOSE OPNID(SLOC) /* RCVF */
MONMSG MSGID(CPF0000)

CLOSE OPNID(MBRINFO) /* RCVF */
MONMSG MSGID(CPF0000)

DLTOVR FILE(*ALL) LVL(*) /* OVRDBF */
MONMSG MSGID(CPF0000)

DLTF FILE(QTEMP/PFSRCLIST)
MONMSG MSGID(CPF0000)

DLTF FILE(QTEMP/SLOC)
MONMSG MSGID(CPF0000)

DLTF FILE(QTEMP/MBRLIST)
MONMSG MSGID(CPF0000)

/* Goto exit */
IF COND(&ampPGMERROR *EQ ‘0’) THEN(DO)
GOTO CMDLBL(RETURN)
ENDDO /* COND(&ampPGMERROR *EQ ‘0’) */

/* Call error subroutine */
CALLSUBR SUBR(ERROR)

RETURN:
RETURN

/* SUBR(VFYPFSRC): Start *********************************************/

VFYPFSRC: SUBR SUBR(VFYPFSRC)

CHGVAR VAR(&ampSUBRNAME) VALUE(‘VFYPFSRC’)
CHGVAR VAR(&ampVFYPFSRC) VALUE(0)

CHGVAR VAR(&ampQDBFFMTTYP) VALUE(‘*INT’)

CALLSUBR SUBR(RSTAPIERR) RTNVAL(&ampRSTAPIERR)

CALL PGM(QDBRTVFD) PARM(&ampFILD0100 &ampFILD0100L +
&ampQDBFOUT ‘FILD0100’ &ampQDBFIN &ampQDBFRCDFMT +
&ampQDBFOVR &ampQDBFSYS &ampQDBFFMTTYP &ampAPIERROR)

IF COND(&ampAEBYTAVL *NE 0) THEN(DO)
SNDPGMMSG MSGID(&ampAEEXCPID) MSGF(QCPFMSG) +
MSGDTA(&ampAEEXCPDTA) TOPGMQ(*SAME (*)) +
TOMSGQ(*TOPGMQ) MSGTYPE(*DIAG)
CHGVAR VAR(&ampAPINAME) VALUE(‘QDBRTVFD’)
CHGVAR VAR(&ampERRORTEXT) VALUE(‘ (API’ *BCAT &ampAPINAME +
*BCAT ‘in’ *BCAT &ampSUBRNAME *TCAT ‘)’)
CHGVAR VAR(&ampVFYPFSRC) VALUE(-1)
ENDDO /* COND(&ampAEBYTAVL *NE 0) */
ELSE CMD(DO)
/* Test type of file: On -&gt LF, Off -&gt PF */
CHGVAR VAR(&ampBIT_POS) VALUE(2)
CALLPRC PRC(‘_TSTBTS’) PARM((&ampQDBFHFLG) (&ampBIT_POS +
*BYVAL)) RTNVAL(&ampBIT_POS)
CHGVAR VAR(&ampBIT_2_ON) VALUE(&ampBIT_POS *EQ 1)
/* Test FILETYPE: On -&gt SRC, Off -&gt DTA */
CHGVAR VAR(&ampBIT_POS) VALUE(4)
CALLPRC PRC(‘_TSTBTS’) PARM((&ampQDBFHFLG) (&ampBIT_POS +
*BYVAL)) RTNVAL(&ampBIT_POS)
CHGVAR VAR(&ampBIT_4_ON) VALUE(&ampBIT_POS *EQ 1)
IF COND(&ampBIT_2_ON) THEN(DO)
CHGVAR VAR(&ampFILEATRB) VALUE(‘LF’)
ENDDO
ELSE CMD(DO)
CHGVAR VAR(&ampFILEATRB) VALUE(‘PF’)
ENDDO
IF COND(&ampBIT_4_ON) THEN(DO)
CHGVAR VAR(&ampFILETYPE) VALUE(‘SRC’)
ENDDO
ELSE CMD(DO)
CHGVAR VAR(&ampFILETYPE) VALUE(‘DTA’)
ENDDO
CHGVAR VAR(&ampNBRALLMBR) VALUE(&ampQDBFHMNUM)
CHGVAR VAR(&ampVFYPFSRC) VALUE(0)
ENDDO /* COND(&ampAEBYTAVL *EQ 0) */

ENDSUBR RTNVAL(&ampVFYPFSRC)

/* SUBR(VFYPFSRC): End ***********************************************/

/* SUBR(DUPQUOTE): Start *********************************************/

DUPQUOTE: SUBR SUBR(DUPQUOTE)

CHGVAR VAR(&ampSUBRNAME) VALUE(‘DUPQUOTE’)
CHGVAR VAR(&ampDUPQUOTE) VALUE(0)

CHGVAR VAR(&ampTEXTOUT) VALUE(‘ ‘)
CHGVAR VAR(&ampTEXT_J) VALUE(1)

DOFOR VAR(&ampTEXT_I) FROM(1) TO(%SIZE(&ampTEXTIN))
IF COND(%SST(&ampTEXTIN &ampTEXT_I 1) *NE &ampQUOTE) THEN(DO)
CHGVAR VAR(%SST(&ampTEXTOUT &ampTEXT_J 1)) +
VALUE(%SST(&ampTEXTIN &ampTEXT_I 1))
CHGVAR VAR(&ampTEXT_J) VALUE(&ampTEXT_J + 1)
ENDDO /* COND(%SST(&ampTEXTIN &ampTEXT_I 1) *NE &ampQUOTE) */
ELSE CMD(DO)
CHGVAR VAR(%SST(&ampTEXTOUT &ampTEXT_J 2)) +
VALUE(&ampQUOTE *CAT &ampQUOTE *CAT &ampQUOTE +
*CAT &ampQUOTE)
CHGVAR VAR(&ampTEXT_J) VALUE(&ampTEXT_J + 2)
ENDDO /* COND(%SST(&ampTEXTIN &ampTEXT_I 1) *EQ &ampQUOTE) */
IF COND(&ampTEXT_J *GT %SIZE(&ampTEXTOUT)) THEN(DO)
LEAVE
ENDDO /* COND(&ampTEXT_J *GT %SIZE(&ampTEXTOUT)) */
ENDDO /* DOFOR */

ENDSUBR RTNVAL(&ampDUPQUOTE)

/* SUBR(DUPQUOTE): End ***********************************************/

/* SUBR(EDTNUM): Start ***********************************************/

EDTNUM: SUBR SUBR(EDTNUM)

CHGVAR VAR(&ampSUBRNAME) VALUE(‘EDTNUM’)
CHGVAR VAR(&ampEDTNUM) VALUE(0)

CHGVAR VAR(%BIN(&ampSRCVARPCSN)) VALUE(15)

CHGVAR VAR(%BIN(&ampSRCVARDEC)) VALUE(0)

CALL PGM(QECCVTEC) PARM(&ampEDTMASK &ampEDTMASKLEN +
&ampRCVVARLEN &ampZROBAL &ampEDTCODE &ampCURRENCY +
&ampSRCVARPCSN &ampSRCVARDEC &ampAPIERROR)

CALL PGM(QECEDT) PARM(&ampSIZECHAR &ampRCVVARLEN &ampSIZEDEC +
‘*PACKED’ &ampSRCVARPCSN &ampEDTMASK &ampEDTMASKLEN +
&ampZROBAL &ampAPIERROR)

ENDSUBR RTNVAL(&ampEDTNUM)

/* SUBR(EDTNUM): End *************************************************/

/* SUBR(RSTAPIERR): Start ********************************************/

RSTAPIERR: SUBR SUBR(RSTAPIERR)

CHGVAR VAR(&ampSUBRNAME) VALUE(‘RSTAPIERR’)
CHGVAR VAR(&ampRSTAPIERR) VALUE(0)

CHGVAR VAR(&ampAEBYTPRO) VALUE(0)
CHGVAR VAR(&ampAEBYTAVL) VALUE(0)

ENDSUBR RTNVAL(&ampRSTAPIERR)

/* SUBR(RSTAPIERR): End **********************************************/

/* SUBR(ERROR): Start ************************************************/

ERROR: SUBR SUBR(ERROR)

CHGVAR VAR(&ampSUBRNAME) VALUE(‘ERROR’)

IF COND(&ampERROR) THEN(RETURN)

CHGVAR VAR(&ampERROR) VALUE(‘1’)

/* 02: Diagnostic – 15: Escape (exception already handled at time of RCVMSG) +
– 17: Escape (exception not handled at time of RCVMSG) */
IF COND((&ampRTNTYPE *EQ ’02’) *OR (&ampRTNTYPE *EQ +
’15’) *OR (&ampRTNTYPE *EQ ’17’)) THEN(DO)
/* Send DIAGNOSTIC message */
SNDPGMMSG MSGID(&ampMSGID) MSGF(&ampMSGFLIB/&ampMSGF) +
MSGDTA(&ampMSGDTA) TOPGMQ(*PRV (*)) +
TOMSGQ(*TOPGMQ) MSGTYPE(*DIAG)
MONMSG MSGID(CPF0000)
ENDDO /* COND((&ampRTNTYPE *EQ ’02’) *OR (&ampRTNTYPE *EQ +
’15’) *OR (&ampRTNTYPE *EQ ’17’)) */

/* Send ESCAPE message */
IF COND(&ampPGMERROR) THEN(DO)
CHGVAR VAR(&ampMSGDTA) VALUE(&ampPGMNAME *BCAT ‘ended +
abnormally’ *CAT %TRIMR(&ampERRORTEXT))
SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA(&ampMSGDTA) +
TOPGMQ(*PRV (*)) TOMSGQ(*TOPGMQ) +
MSGTYPE(*ESCAPE)
ENDDO /* COND(&ampPGMERROR) */

ENDSUBR RTNVAL(0)

/* SUBR(ERROR): End **************************************************/

ENDPGM:
ENDPGM

References:

Copy To Stream File (CPYTOSTMF)

Find Source Member (FNDSRCMBR): Subroutine VFY_SRCF (verify source file attributes)

Related Posts

ncdu – IFS Disk Space Analyzer

If we want to check the disk space occupied by IFS files and directories, we have the possibility to install Read more


IFS – Find files and directories in your IFS

I take advantage of a question asked on the Midrange.com discussion groups ( Is there an easy way to find Read more


IFS files management

I believe that all of us who work in the IBM i environment have happened, and continue to do, to Read more

L’articolo Export source code to IFS proviene da BlogFaq400.

Verified by MonsterInsights