Showing posts with label synon. Show all posts
Showing posts with label synon. Show all posts

Synon 2E upcoming features

Broadcom did a show and tell session on the 28th of October, they have also shared the video (link below)


Here is what I garnered from it from a 2e perspective.



Obviously this disclaimer (aka a safe harbour statement) is there to advise that none of these features are guaranteed to be included in a future version.  

If the two features showcased today, my personal opinion is one is very close and likely to be in the next release.  The later, I feel is still some years off...  But that's just what I think.

 



There are a couple of key highlights here.  The main one for me is the continued technical debt replacement for PL1 code.  This is often touted by technology managers that the toolset is outdated, "even IBM won't support the complier used to build the tool".  As 2e advocates we know the real truth, but the number of times I have heard this ignorance spewed in recent years is testament that a bad story gains traction.

The sooner Broadcom can resolve this the better it is for all.

The BLOB and CLOB support as data types is about 20 years late IMHO.  Most sites have already done workarounds with user functions but I still welcome this functionality and WILL use it.

2E VS Code Viewer


During the event a couple of demos were shown.  The first one was for a 2E VS Code plug-in.  A fresh view of the 2e model.   The demonstration showcased the following elements.

Action Diagram viewer



Usages/References viewer



Generated Source and Joblog viewer



All of these look cool and I guess the intention is to replace the 5250 environment with a modern IDE but built on the industry standards.  From what I saw it looks quite neat.  However, the real issue is that it is currently not a like for like replacement of the 5250 interface and until it is 100%, I fear the uptake will be minimal.  If you cannot edit an action diagram (for example), then a viewer is merely that.

It was stated that 'EDIT' is being looked at 'kind a', and I do hope it comes to fruition.  I remember my colleague Yuriy wrote his own viewer in VB some 25 years ago so it is clear that Broadcom have done the easy bit, so far.

Integrating this with Implementer, 5250 and VS Code development (together) are the real challenges and I have everything crossed that the development team will achieve this.

Move EEF's

This next demo was another one of those little things you'd hoped would have been done 30 years ago, but it still has its use today.  Everyone has models where EEF's (Execute External Functions) have been written across the wrong file.  A Scan utility on the Loan Account file rather than #System Utilities.  A calc GST function on the Customer Invoice file rather than the Tax Code file.

This little improvement allows you to move the functions around wth a simple subfile option.


Similar to the copy function screen.


Nice little completion message.


And yes, before you ask.  It does handles all the called references in the action diagram and also updates the AD of the calling functions without need to re-prompt.

My current shop is only on 8.7.0 so we have quite a lot more little features to explore with the 8.7.1, 8.7.2, 8.7.3 and 8.7.4 mini uplifts over the last 6 or 7 years.  An upcoming blog post will cover some of the 2e features (when I get my hands on them).



Thanks for reading the 
Synon 2E and Plex Emporium by Lee Dare (A developer blog). 
Lee.

News from Broadcom Today.

News from Broadcom today.

2E has been certified on Power 11 hardware to IBMi o/s level 7.5 and 7.6

No excuse not to keep current and keep those support agreements up to date.




I've decided to do a blog about some of the features in the new versions in the coming weeks.....

Thanks for reading the 
Synon 2E and Plex Emporium by Lee Dare (A developer blog). 
Lee.

New domain, same content, better look?

I mentioned in the last blog post that I wanted to reskin the blog.  Also, that I wasn't happy that Google was failing to index my site.

Suspecting it was an aging template or a.n.other technical factor with Blogger/Google that I didn't have the skills, and after a year trying, the desire to resolve, vibe coding seemed to me to be the best way forward.

Sceptical was my default viewpoint before this process.
Amazed is my current thinking.
60 days and endless Youtube videos later, was all it took to change my mindset.

If you care to click the link below you will be taken to the new site. 


This was vibe coded over the last couple of months mainly using FREE credits.  Eventually I got so caught up in this that I paid a subscription and went fully in.

I hope you like the Look 'n Feel.  A considerable about of effort from myself and www.lovable.com was used to get this as it is.  Thanks to the people who did some testing. the feedback was appreciated.

Thumbnail

And don't worry too much.  This old site isn't going away, nor is the content.  I imported the existing posts and I can import upcoming ones whenever I like.

Any feedback is appreciated.

Thanks for reading the 
Synon 2E and Plex Emporium by Lee Dare (A developer blog). Lee.

Retro Vibes and the Rise of the New CASE Age


I’ve been digging through the archives recently. While pondering a style refresh for this blog, I found myself searching for the exact vivid colour scheme used for the classic Synon manuals and diskettes back in the day.  

That trip down memory lane reminded me of a post I wrote way back in 2010: A Retro Look Back. 


Looking at those original hues now... wow. You might need sunglasses for this one! They are incredibly vibrant—and perhaps a little too garish for the modern update I have in mind—but time will tell.

(Side note: I’m also looking to co-host away from Google soon. No matter what I try, the site isn't indexing properly, which I suspect is a legacy Blogger template issue I've been battling for a year. Stay tuned for moving plans!)

Re-reading that 2010 post, something specific caught my eye. Near the end, I predicted an uptake in "code generation tools." At the time, my mind went to snippet generation, CRUD automation, basic auto-complete improvements, and deeper code generation within CA Plex and Synon 2E.

Never in my wildest dreams could I have foreseen the current boom in AI-centric development. Tools like Lovable, Cursor, Claude, and Base44 that are achieving staggering levels of abstraction.

Thumbnail



It makes you wonder: with business users now able to describe what they want and watch systems generate in real-time, are we finally witnessing the true realisation of what the Synon pioneers dreamed of in the 80s and 90s? The ultimate promise of CASE (Computer-Aided Software Engineering) might just have become our daily reality.
Old Post Image

Thanks for reading,
Lee
The Synon 2E and Plex Emporium (A Developer Blog)


2E Hidden Gem - Action Diagram PARMS

It's always nice to learn something new every day!

Today, whilst navigating a functions' action diagram, I was presented with the following screen showing numerous NLL fields.

F15 Filter Image 1


Usually I page down looking for the field I wanted to view or update, and as you all know, on some files this can be quite cumbersome.  That is until I read a request in the 'Ideas' section from Broadcom's support portal. A user had requested a filter for NLL's or in Peter's parlance "Meaningless" :-)

I thought to myself, that's a neat idea I'll up vote it!!!!

Broadcom Idea


After clicking the "Thumbs Up" button and anticipating the AI to build the feature and email me a PTF, I noticed that the idea had already been implemented......  I quickly fired up a 2E session and went looking for it!!!!

F15 Filter Image 2


"Lo and behold" (The English equivalent of "Mamma Mia"), there it was, albeit slightly hidden.  You see the toggle is F15 and the label was stating "Undefined parms only" (First image).  However, the toggle is a triple toggle and a third option to remove the NuLLed fields was just another key press away!  

This little feature makes scanning for used data fields way easier.  What do you think?

On a side note, this also works for unentered fields during file maintenance or if PARMS have been added to a function.  The F15 options' initial toggle will show any unmapped fields.

F15 Filter Image 3


Thanks for reading the Synon 2E and Plex Emporium by Lee Dare (A developer blog). 
Lee.

p.s. Perhaps I should start a hidden gems series in the blog.

Synon 2E Internals - Steve Hinzmann Synon User Group 1991

Synon 2E internal file structure

I have a few posts (see below) where I discuss the Synon 2E internal files.


This all stems from the awesome work presented by this legend, Steve!!!

Steve's guide 2e Model



OG presentation scan.



Warning query these files at your own peril!  However, this knowledge is awesome for things like generation of data dictionaries and source code pre-compilations.

Thanks for reading the
Synon 2E and Plex Emporium by Lee Dare (A developer blog). 
Lee.

Useful synon 2E sites you MUST bookmark

Synon 2E related useful sites and links you MUST bookmark


This blog isn't the only useful place to get great Plex and Synon 2E content.

Here are some 'up to date' and 'active' links.  

These appear to be creating content largely from the 2E manuals.

The 2E manuals in their raw form from Broadcom. (Please cut an paste this - redirect works but causes me SEO issues for some unknown reason)

https://techdocs.broadcom.com/us/en/ca-enterprise-software/it-operations-management/ca-2e/8-7.html

The Broadcom forum.

Annual conference site from CM First.

If you want to modernise your Synon 2E applications or port.

A services company?

A lovely old post from the OG sales guy from Synon.

Some LinkedIn groups and their member count as of 06/12/2025.
https://www.linkedin.com/groups/3307655/ - Synon Professional (417)
https://www.linkedin.com/groups/1637887/ - Synon Programmers (1880)

I'd appreciate a reciprocal link for my site if you are the owners of any of these.  It helps with google discovery. :-)

Any other links to share, please get in touch.

Thanks for reading the
Synon 2E and Plex Emporium by Lee Dare (A developer blog). 
Lee.

Synon 2E - Technical Deep Dives

Synon 2E - Technical Deep Dives

Below are some long form posts targeting specific areas of the Synon 2E tech stack.

I thoroughly enjoyed writing these 'back in the day' and hope that they help some of you.

The generic data driver is a method to output *Arrays into PRTFIL's or DSPFIL's without having to define a structure file etc.  Very, very useful and I have used numerous times.  The only design consideration is the array size depending on which RPG generator is being used. 


Performance tuning batch jobs?


Pet hates?

Some things that I don't like seeing in 2E coding.  Call them standards?, call them being a fusspot?

Code reviews, love them or hate them, they share knowledge and create better developers.

General Synon 2E topics, hints, tips, 'How to' guides.  They'll be a gem or two in here for most of you.

This should be standard in all shops

Nice little tips here

A personal favourite

Really useful, especially with the new webservices push and unpack and package up input and output arrays.

Thanks for reading the
Synon 2E and Plex Emporium by Lee Dare (A developer blog). 
Lee.

Synon 2E - SQL and Model files summary

Synon 2E - SQL and Model files summary


Some of the SQL posts over the last year or so.  Some useful 2E model files extraction routines, audit stamp updates and some general IBMi knowledge.


Want to get down and dirty into the inner depths of the 2E model files?  These posts will help give you the confidence to dive in.

WARNING: Not for the faint hearted and welcome to surrogate hell (or is it heaven).


Thanks for reading the
Synon 2E and Plex Emporium by Lee Dare (A developer blog). 
Lee.

Synon 2E - Standards posts all in one page

Synon 2E - Standards posts all in one page


Many of these were written years ago and google is gradually forgetting them.

Here is a summary of some of the technical posts I've made with lots of helpful hints, tips and development standards for Synon 2E, CA 2E and now Broadcom 2E.

This one is useful if you want to write performance code of reduce generator code bloat
https://leedare-plex2e.blogspot.com/2008/07/2e-development-standards-performance.html

Some general 2E coding standards

https://leedare-plex2e.blogspot.com/2008/08/synon-2e-development-standards-general.html

Some coding standards around action diagramming and usage of contexts
https://leedare-plex2e.blogspot.com/2008/08/2e-development-standards-ad-contexts.html

Some more ad-hoc hints and tips
https://leedare-plex2e.blogspot.com/2008/09/2e-development-stanbdards-ad-hoc-tips.html

More standards and a focus on *Return Code usage
https://leedare-plex2e.blogspot.com/2008/09/2e-development-standards-that-damn.html
https://leedare-plex2e.blogspot.com/2017/01/dont-forget-return-code.html

Naming Conventions?

https://leedare-plex2e.blogspot.com/2008/09/2e-development-standards-extra-naming.html
https://leedare-plex2e.blogspot.com/2008/10/2e-development-standards-further-naming.html

More hints and tips, diving a little deeper into certain function
https://leedare-plex2e.blogspot.com/2008/10/2e-development-standards-hints-and-tips.html
https://leedare-plex2e.blogspot.com/2008/10/2e-development-standards-hints-and-tips_25.html
https://leedare-plex2e.blogspot.com/2008/10/2e-development-standards-hints-and-tips_31.html
https://leedare-plex2e.blogspot.com/2008/11/2e-development-standards-hints-and-tips.html

Standards and hints for CHGOBJ/CRTOBJ composite functions

https://leedare-plex2e.blogspot.com/2008/11/2e-development-standards-composite.html

Screen function types and some standards to assist with solid development
https://leedare-plex2e.blogspot.com/2009/01/synon-2e-development-standards-pmtrcd.html
https://leedare-plex2e.blogspot.com/2009/03/2e-development-standards-screen.html
https://leedare-plex2e.blogspot.com/2009/06/2e-development-standards-screen.html

Little tip with using cursor with subfiles
https://leedare-plex2e.blogspot.com/2019/01/a-little-trick-with-set-cursor.html

Thanks for reading the
Synon 2E and Plex Emporium by Lee Dare (A developer blog). 
Lee.

Did you know Synon 2E has a Full Screen Mode?

Long time IBMi users typically work with an expanded WRKACTJOB screen shortly after learning all the command keys that are of use.  As a junior developer (back in the early nineties), I was always in awe of the seniors around me who didn't need to toggle through the command key options whilst managing the jobs running in the system.


WRKACTJOB screen (normal)

As always though, once you had learnt the system you could press F21 to remove the subfile options and command key text, thus freeing up more room for the critical data on these somewhat limited 5250 displays. 

If I remember rightly, the command key used to bring up a window and you could chose between Basic (might have been intermediate) and Advanced mode.  This has long since been removed from the o/s and the command key merely acts as a toggle nowadays.  The reward of course was the ability to see more of your processes and interactive sessions.

Here is my current 'Pro' setup lol.


WRKACTJOB screen (Full Screen)


Synon aka 2e with various prefixes, Cool: Allfusion: Advantage: CA: etc also has the ability for a user to see more on selected screens.  Here are a couple that might be of interest. 

Action Diagram Expanded vs Normal view.


Synon action diagramming screen (Full Screen)

Synon action diagramming screen (normal)

Most developers could survive with this as virtually all worth their salt will know every option and command key off the top of their head anyhow.

A lesser-known scenario and also a bit harder to remember all the options, is the ability to extend the records shown when viewing a model list. 


Synon Model List screen (Normal)

Synon Model List screen (Full Screen)

Personally, I don't have this one switched on but kudos to anyone out there that does!

So how do you set these values?

From the main Services Menu take option 11 for Edit model profile (YEDTMDLPRF) or as the menu implies, execute the command.  Then set the options accordingly.


Synon Options Screen

You're welcome.
Thanks for reading the
Synon 2E and Plex Emporium by Lee Dare (A developer blog). 
Lee.

Synon 2E Understanding CONstant usages

UPDATE: 06/12/2025 - Linked to a summary post dedicated to deep dive long form posts.

One of my colleagues was trying to track down some (potentially) hardcoded string values/literals.  She had already used the SQL queries in one of my previous posts to narrow down the usages inside messages, however, she was also concerned that there might be some underlying hardcoding via CND and more specifically via CON values.

As a side, IMHO there should be next to no CON usages in a well architected model apart from, values like *BLANK, 0.00 and some tolerance towards values like 12 (months), 52 (weeks), 365 (days), 100 (percentage).  I'd even accept 1,2,3, 9999999 etc.

I draw the line at meaningful literals that could have been scoped conditions (CND) or database values.

My main reason for this is that there isn't a way (via the 2E tool interface) to check for usages of CON values.  Obviously, we can scan the generated source, but then what about all the genuine field names or comments.

Back with 2E!  When generating the source, it somehow lets the generator knows about them and adds them into the code (inline) or as part of a data structure.  Take a look at the bottom of a source listing if you don't believe me.

Here is a sample function using some constants.  Note the 'Create Flatfile' call is passing in 'FLAT FILE CoNsTANT' as CON.

Action diagramming screen CON

And here are the relevant code snippets of generated source i.e. The moves.

Synon AD to RPG

Synon AD to RPG


Followed by the structure of CON values at the bottom.  Note: Sometimes the CON is generated 'inline' at the point of the MOVE.

How RPG handles CON (Constants)


Anyhow, in order for the CON values to be consistently applied, they must be in the 2E model data files somewhere, with the theory being we should also be able to query them.  As CON can only be applied via action diagram text, let's start by looking there in the YMSGACTRFP file.

Synon action diagram database table

It looks like we have some constants referred to in field ELMTTL ** (Element Title - highlighted RED).  This could be a good start but there are some obvious limitations. Whilst it looks like it covers basic *MOVE and *CONCAT field assignments, when we have hardcoded values going into a function call (PURPLE), the CON value isn't reflected in the ELMTTL field.  

**It would appear that the ELMTTL data is used for the AD layout.  Perhaps I will expand more on the complexities of this data in a future post!!!

However, it looks like 2E maintains a surrogate reference for each unique CON value used in the AD regardless of AD syntax used.  (GREEN)

This is awesome, but how are these linked via the function AD?  

To do this, let's take a gander at a subset of the 2E files in the model library. The one highlighted below looks like it could be useful and most likely, a file most dev's didn't even realise existed.  Hands up who has explored the intricacies of the model schema.

Some synon 2E model files

What does the data look like in the table?

Synon CON (Constants)

Bingo, we have our constants.  

Luckily ours are at the bottom of the file :-) for easier blog documentation.  Diving deeper, we have now confirmed that 2E maintains a surrogate reference for each unique CON value and if we refer back to the YMSGACTRFP image above, these are all highlighted in the GREEN section.

So, all that is left for us to do is to identify the CON values we want to analyse, work out what functions they are linked to via the AD code and some pretty cool impact analysis is before us.

Here is a sample SQL retrieving the many different usages of the term 'constant'.  As CON is only ever associated with field @@SUB3, the query is quite straight forward.

Ensuring you have the correct library list.

SELECT DISTINCT b.@@msg, c.OBJNME, b.@@SUB3, a.CON, c.OBJOWN    
FROM YCONDTARFP a LEFT JOIN YMSGACTRFP b ON a.@@CON = 
b.@@SUB3 LEFT JOIN YMDLOBJRFP c on b.@@MSG = c.@@OBJ  
WHERE UPPER(a.CON) LIKE '%CONSTANT%' AND c.CUROBJ = 'Y'                       

This query returns unique records for each of the functions using CON context with the word 'constant', the UPPER() function ensures we don't miss any based-on case differences.  The rest of the query does a basic join to return some additional fields from YMDLOBJRFP (This is the *ALLOBJ or *A model list).  You can add to this query or tidy up names and formatting however you like.

CON Usage query

I hope that this helps someone.

Thanks for reading the
Synon 2E and Plex Emporium by Lee Dare (A developer blog). 
Lee.

p.s. This remains one of my favourite posts :-)


Synon 2E It's (ELeM)entary, My Dear Watson

UPDATE: 06/12/2025 - Linked to a summary post dedicated to deep dive long form posts.


I've used this trick a few times so I thought I should share it on the blog before I get run over by a bus.

Often we (developers) are asked to produce or consume data files for integrations with 3rd party systems.  Even with the emergence of web services there are still many many times where the preferred method of interchange is file based, typically these are bulk (high volume) transactional exchanges.  Think payments between banks etc 

For the systems I've worked on we have solved this with .csv delimited inbound and outbound files.  We have also utilised fixed width files, the majority having old school multi-format layouts with a traditional header, detail and footer structure which has some advantages over .csv.

For now, I will also ignore that we could have also provided XML or JSON payloads as part of a real-time integration. 

As you can see, there are numerous ways to skin this cat. However, this is a 2E and Plex blog so for today, let us concentrate on:-

  • How you might build and consume files into a 2E based application. 
  • How can we create a multi-format flat file using purely Synon logic only?

Let's fire up a 5250 session and explore an unsung feature in 2E that helps remove the complexity of building these flat files.

What are we going to build? 


An extract file with a header record, 10 detailed transactional records and a footer which denotes both EOF as well as have a total  for basic validation.  In the real-word this may include hash total etc

An example of what this file data might look like is below.

File format Banking style?


Back in 2E, f
irst define a file with one Known By (Numeric 9.0) should be suffice for most integrations and a second field (Has relation) of 'Flatfile Data' - Type TXT and length of 500 (or whatever length works for your environment). RP4 has better field limits than RPG. 

I've called my file FIXFILP.


Data file 2E sample


Now we need to build the data record, usually you would start concatenating the data values together to meet the design specification of the receiving system and handle those pesky FILLER57 fields etc that always appear from somewhere.

This involves dozens (if not hundreds) of lines of code to concatenate the data.  The resulting action diagram is often difficult to understand and cumbersome to maintain.

What if there was an easier way to build up the data with the ability to easily reorder the fields and cater for changing field lengths.  Well there is, using a neat unsung feature of 2E arrays.

2E keeps track of the last record to be added, changed or read in an array, a sort of cursor I guess.  This is available in action diagram logic hidden in the ELM context. (ELeMent).

The only 'built in' function that can use the ELM context is a *CVTVAR.  

First create an array with the data fields you would like to appear in the dataset, this can be header, detail 1, detail 2, footer etc.  It doesn't really matter for a flat file process.  To keep it nice and simple I have made up some generic fields names with various data types.


Parameters1


Parameters2



Parameters3

I've keyed these arrays based on the Record type of HDR, DTL and FTR.  You can do how best suits your use case.  All the arrays are set with a 'Numer of Elements' of 1 record as I don't need to use the in the traditional sense.  I just need a pointer to an ELM in memory.


Sample AD code

All we then do is call a CRTOBJ over the array to populate the data.  Once in the array, we can use the *CVTVAR to populate a flat file field.  2E handles all the different data types and spits out a well formatted string which you can write to the database/extract file etc

Detail Data

But we are not done.  I've ready other blogs that talk about ELM and they do a pretty good job of explaining the outbound example above.  But not many people realise that depending on whether you are using the ELM context as Input or Output, is the equivalent of constructing or deconstructing the data.  So yes, this method can be used to unpack flat files also. :-)

As long as in the receiving function you have created a shell array record.  You can use ELM to move the data into the array and then standard RTVOBJ functionality to retrieve the record in its deconstructed form.


AD Code

An example below of a couple of screens that I rushed together showing the data string and the subsequent fields.

DSPFIL screen

DSPRCD screen

You simply point the flatfile string to the correct array and 2E will handle everything else.

Thanks for reading the
Synon 2E and Plex Emporium by Lee Dare (A developer blog). 
Lee.


Object Usage via SQL

Usually, I would use the Work with Object (WRKOBJ) command and work through them one by one capturing the data in excel or notepad manually.  Another option is to build a list of objects on the system using the OUTFILE keyword from the DSPOBJD command and then query these via SQL or Query/400 or simply by using YWRKF our trusted friend in the 2E world.

Today however,  I had a list of around 50 or so objects and as we have separate development and production machines (the latter, I have no access to via segregation of duties policies that I support BTW), I felt it was unfair to ask a colleague to send me 50 screen prints, as well as, this being prone to user error with so many commands to execute.

I could have documented the steps for the traditional method above but this isn't really repeatable for my colleagues nor is it enjoyable.  Therefore, I decide to write an SQL (or four) as it turns out to get me the data and leave us with a template for the future.  There is a bonus 5th one for us 2Er's

There is a bump in the road though.  Isn't there always aye!

Even though IBM have made huge strides with the availability of data via SQL in recent releases.  A simple view for the OBJECT_STATISTICS does not exist.  There is a table function which will get you the data but is precluded on obtaining data for an entire library or a subset based on object type. 

Here is an example straight from the IBM documentation.

https://www.ibm.com/docs/en/i/7.4.0?topic=services-object-statistics-table-function

When I applied this to my test library, I didn't want the timestamp but a date only and I wanted a subset of the fields available.

This is quite a simple modification to the IBM example, we just do a substring at take the first 10 characters and give the field as nice name.  Note also the replacement of the asterisk (*) for the select to exact fields.

SELECT OBJNAME, DAYS_00001, 

SUBSTR(VARCHAR(LAST_00001), 1, 10) AS LAST_USED

 FROM table                                    

(object_statistics('MYLIB', '*ALL'))   


Unfortunately, I hit a hurdle when trying to view the resulting data via YWRKF.  The 2E programs raised an error condition and threw a hissy fit as I had some null dates represented as '-' in the returned data and not the ISO format (0001-01-01) it was expecting.

A quick google later and an a minor adjustment to the SQL to present null as an empty ISO date and I was now able to view the data.  FYI, Query/400 was fine with the data, so this is an extra steps for loyal 2E users/shops like me/us.  There are also other date conversion routines readily available I just chose this method for now....

SELECT OBJNAME, DAYS_00001,                                         

IFNULL(SUBSTR(VARCHAR(LAST_00001), 1, 10),'0001-01-01') AS LAST_USED

FROM table                                                        

(object_statistics('MYLIB', '*ALL'))


This is all well and good, but I also wanted to restrict this SQL result to the objects that were of interest.  I achieved this by using a SQL and filter out those of interest.

SELECT OBJNAME, DAYS_00001,                                        

IFNULL(SUBSTR(VARCHAR(LAST_00001), 1, 10),'0001-01-01') AS LAST_USED

FROM table                                                        

(object_statistics('MYLIB', '*ALL')) a WHERE a.OBJNAME in      

('MYOBJ01', 'MYOBJ02', 'MYOBJ03', 'MYOBJ04', 'MYOBJ05',            

 'MYOBJ06', 'MYOBJ07', 'MYOBJ08', 'MYOBJ09', 'MYOBJ10')

SQL to extract object usage data on IBM I and incorporating some synon model queries for extra info.


UPDATE: 06/12/2025 - Added a summary link post to aggregate these types of posts.

Continuing the series on using IBM i SQL for some basic work management tasks.  Today I had a large list of objects that I wanted to understand the date that they were 'last used' and 'days used' count in order to determine if :-

1. The objects could be removed or flagged as obsolete.
2. Prioritise the development/testing based on high volume activity.


Whilst this is great it is only a view on the screen.  I didn't want my colleague to have to take screen prints or scrape the screen with tedious cut and paste to build an excel file for me.

CREATE TABLE QTEMP/OBJ_USAGE AS(
SELECT OBJNAME, DAYS_00001,
IFNULL(SUBSTR(VARCHAR(LAST_00001), 1, 10),'0001-01-01') AS LAST_USED
FROM table
(object_statistics('MYLIB', '*ALL')) a WHERE a.OBJNAME in
('MYOBJ01', 'MYOBJ02', 'MYOBJ03', 'MYOBJ04', 'MYOBJ05', 'MYOBJ06', 'MYOBJ07', 'MYOBJ08', 'MYOBJ09', 'MYOBJ10')

) WITH DATA


This was great for my purposes, I sent the SQL to a colleague, and they were able to implement it and send me a file back.  Job done.

Hold Tight!! 

This is a 2E blog (mainly) and I have only mentioned YWRKF.  You can do better than that I hear you cry.

The above list of objects can easily be expanded or substituted with a list from a file which you could build somehow.  What if I linked this to a Model List?  That would be cool right!

Whilst this isn't an option for my site due to having separate machines, it might work for you.  If you are like us, you may have send over some data periodically from production and work on the queries from a different angle.  Anyhow, assuming you have model lists and objects you wish to query on the same machine you can embed your SQL in RPG, CL or as a SQL source member and run with RUNSQLSTM etc.

You just need to link the Model list with your library of objects.  See below for one method.

We create an alias of the member we wish to use as our list.

CREATE OR REPLACE ALIAS QTEMP/OBJ_USAGE FOR MYMODEL/YMDLLSTRFP(MYLIST)

Execute the query.  Optionally as above, you can output to a file if you wish.

SELECT OBJNAME, DAYS_00001, IFNULL(SUBSTR(VARCHAR(LAST_00001), 1, 10),'0001-01-01') AS LAST_USED
FROM TABLE (OBJECT_STATISTICS('MYLIB', '*ALL')) a LEFT JOIN QTEMP/OBJ_USAGE a ON a.OBJNAME = b.IMPNME WHERE  b.OBJTYP = 'FUN'

Lastly, tidy up after ourselves and drop the temporary ALIAS.

DROP ALIAS QTEMP/OBJ_USAGE


As always, I am sure that there are other ways of solving this problem and I would love to hear about them in the comments.  This is my current 'new method' and will likely change as I notice more and more flaws or need to expand the scope.

Thanks for reading the
Synon 2E and Plex Emporium by Lee Dare (A developer blog). 
Lee.