Ignore case in pkginfo analysis on Solaris

(imported topic written by tigger0191)

Hi Guys,

I’m trying to collect data using an analysis about particular software on Solaris servers. I’d like to ignore case. How would I construct this statement such that it would return results for ibm or IBM, db2 or DB2, etc.

if exists names whose (it contains “IBM” or it contains “international” or it contains “WebSphere” or it contains “rational” or it contains “db2” or it contains “mq”) of pkginfos of pkgdb then names whose (it contains “IBM” or it contains “international” or it contains “WebSphere” or it contains “rational” or it contains “db2” or it contains “mq”) of pkginfos of pkgdb else “None”

I’m trying to avoid having to know the exact case for each string.

Thanks,

Tigger

(imported comment written by Lee Wei)

Hi Tigger,

The general String manipulation statement to handle casing is:

(it as lowercase contains “ibm”)

Hope that example is what you need.

Lee Wei

(imported comment written by tigger0191)

Won’t this return only lowercase instances of the string? I need an “anycase” way to handle it. Thanks.

(imported comment written by Lee Wei)

The statement will turn any string into lowercase first before doing the comparison.

Examples are:

q: “IBM” as lowercase contains “ibm”

A: True

q: “IBm” as lowercase contains “ibm”

A: True

q: “ibm” as lowercase contains “ibm”

A: True

(imported comment written by tigger0191)

Thanks Lee. Works great!

(imported comment written by tigger0191)

So this is what I have so far:

if exists names whose (it contains “IBM” or it as lowercase contains “websphere” or it as lowercase contains “rational” or it as lowercase contains “db2” or it as lowercase contains “mq”) of pkginfos of pkgdb then names whose (it contains “IBM” or it as lowercase contains “websphere” or it as lowercase contains “rational” or it as lowercase contains “db2” or it as lowercase contains “mq”) of pkginfos of pkgdb else “None”

This is working as I want it to. However, I’ve been told now that I need to collect version numbers too. Is this possible? If so, how would I do it?

Thanks for your help.

(imported comment written by Lee Wei)

Hard for me to test without a handy Solaris box.

However, this is an example for the construct.

This would be the your Then statement:

(name of it, version of it) of pkginfos whose (name of it contains “IBM”) of pkgdb

Sometime, the Version property is empty and you might get an error. Here is the way to add and IF-THEN-ELSE to error check:

(name of it, (if (exists version of it) then (version of it as string) else (“None”))) of pkginfos whose (name of it contains “IBM”) of pkgdb

(imported comment written by tigger0191)

Well, I’m getting closer. This property is returning “The operator “contains” is not defined”. Where am I going wrong?

if exists names whose (it contains “IBM” or it as lowercase contains “websphere” or it as lowercase contains “rational” or it as lowercase contains “db2” or it as lowercase contains “mq”) of pkginfos of pkgdb then (name of it, version of it) of pkginfos whose (it contains “IBM” or it as lowercase contains “websphere” or it as lowercase contains “rational” or it as lowercase contains “db2” or it as lowercase contains “mq”) of pkgdb else “None”

(imported comment written by Lee Wei)

(name of it, version of it) of pkginfos whose (it contains “IBM” or it as lowercase contains “websphere”…

has to be:

(name of it, version of it) of pkginfos whose (NAME OF it contains “IBM” or NAME OF it as lowercase contains “websphere”…

Try that.

(imported comment written by tigger0191)

Thank you Lee Wei. You have been patient and tremendously helpful. I’m getting the data I need.