I agree with you 100%. I can only think that Jerry might be dyslexic and confused V4R5 with V5R4. That, and he might think he's a speed reader and skips a bunch of words.
Original Message:
Sent: Mon August 05, 2024 02:03 AM
From: Birgitta Hauser
Subject: SQL query to find objects located on IFS path on specific directory /subdirectory in IBM i
Again: STRSQL is stabilized since a long time! Enhancements in Db2 and SQL after V4R5M0 are NOT included in the STRSQL Tool.
There is no reason anymore to use STRSQL. Not sure why you instist running your Query with STRSQL.
The Path_Name is returned as DBCLOB (Double Byte Large Object) which was not supported in the old days and which is NOT supported in STRSQL.
You may try to convert the DBCLOB column into a VARCHAR column.
Select Cast(PATH_NAME as VarChar(256)) .....
------------------------------
Birgitta Hauser
Database and Software Engineer
Selfemployed - Modernization-Education-Consulting on IBM i
Kaufering
+49 170 5269964
Original Message:
Sent: Sun August 04, 2024 08:21 AM
From: jerry ven
Subject: SQL query to find objects located on IFS path on specific directory /subdirectory in IBM i
Hi,
1) Thanks, running same SQL query on IBM i ACS under 'Run SQL scripts' did show the desired results here(with actual 'PATH_NAME'.).
2) However, I had run this SQL query using STRSQL on the 'V7R5M0' OS/400 version. still that SQL query showed that '*POINTER' so not sure whether it's really OS/400 version issue here?
3) When I ran this SQL query using STRSQL then got below results: -
SELECT *
FROM TABLE(QSYS2.IFS_Object_Statistics(
Start_Path_Name => '/HOME/K21' ,
Subtree_Directories => 'YES'
)) x
WHERE LOWER(cast(Path_Name as varchar(255) CCSID 37 )) LIKE '/home/xyz%'
"

4) When I ran this SQL query using STRSQL: -
S " SELECT *
FROM TABLE(QSYS2.IFS_Object_Statistics(
Start_Path_Name => '/HOME/K21' ,
Subtree_Directories => 'YES'
)) x
WHERE LOWER(cast(Path_Name as varchar(255) CCSID 37 )) LIKE cast('/home/xyz%' as varchar(255) CCSID 37)
"
Then got below results: -

5) Using IBM I ACS 'RUN SQL Scripts' can we create a file like we can create in STRSQL when we do Shift + F1 in STRSQL like below:

Then we select option '1' here then on below screen we can give option -'SELECT output' as '3= File'

And then on below screen we find multiple options like '1=Create File' , '2=Replace File', '3=Create member' ,'4=Replace member' , '5=Add to member' like these there are so many options commitment control,Date format, Date Separator,Time format, Time separator etc. for changing the session attributes there so can we get all these using 'RUN SQL Scripts' inside IBM i ACS tool as well , If yes, Could someone please help by providing their navigation path for the same here?



Thanks much..
Original Message:
Sent: Sun August 04, 2024 06:03 AM
From: Birgitta Hauser
Subject: SQL query to find objects located on IFS path on specific directory /subdirectory in IBM i
You should no longer use STRSQL it is stabilized since Release V4R5M0, i.e. everything that was added after to SQL is not supported. The path name is returned as DBCLOB (Double Byte Large Object) which was not yet supported in Release V4R5M0.
Install IBM i Access Client Solutions (ACS) and then run your query with RUN SQL SCRIPTS ... and you will see all values
IBM i Access Client Solutions Download:
https://www.ibm.com/resources/mrs/assets/DownloadList?source=swg-ia&lang=en_US
------------------------------
Birgitta Hauser
Database and Software Engineer
Selfemployed - Modernization-Education-Consulting on IBM i
Kaufering
+49 170 5269964
Original Message:
Sent: Sun August 04, 2024 03:41 AM
From: jerry ven
Subject: SQL query to find objects located on IFS path on specific directory /subdirectory in IBM i
Hi,
Thanks, but what i want is to see all the objects on that given IFS path so i tried this SQL query as per this link example here "Using SQL to list directories and files in IFS @ RPGPGM.COM"
SELECT PATH_NAME,OBJECT_TYPE,CREATE_TIMESTAMP,LAST_USED_TIMESTAMP, DATA_SIZEFROM TABLE(QSYS2.IFS_OBJECT_STATISTICS('/HOME/K21/','YES'))
But instead of path name when i run this SQL query then i get '*POINTER' like below:-

Whereas I wanted to objects on that IFS path as the output of above SQL query in the PATH_NAME like as shown in the above link example. So what is wrong with my SQL query here why instead of that PATH_NAME I am seeing "*POINTER" and not the actual 'PATH_NAME' here?
Just for example i have below objects on my IFS path but when i run above SQL query it does not show desired result neither the SQL query which i had posted in my first post shows the desired result here even after making suggested changes in my where clause :-

So could some one please advise what wrong in my SQL query due to which iam seeing this '*POINTER' instead of actual path name here?
Thanks much...
Original Message:
Sent: Sat August 03, 2024 04:40 PM
From: Roman Chloupek
Subject: SQL query to find objects located on IFS path on specific directory /subdirectory in IBM i
Hello Jerry,
I reran your exact query and did not encounter any errors. It was on IBM i v7.4 with all technology refreshes and all group fixes up to date. Also, my "Run SQl Scripts" job's CCSID was 37 (EBCDIC English) and the CCSID of the paths it processed was either 37, 819, or 1208 (i.e. all "translatable" to my job's CCSID 37 which is what the WHERE clause does behind the covers).
So the following might be starting point to triage your issue further:
- Your DB2 for i database engine is complaining that some of the strings have unspecified CCSID (that's what 65535 means). So a good guess would be that either some of the path names your query retrieves in the Path_Name column has CCSID of 65535, or, your actual job where the query runs has unspecified CCSID (=65535, I hope that is not the case!)
- Make sure your jobs' CCSID is specified (i.e. it is not 65535!)
- Make sure your sysadmin has installed all IBM i OS and DB2 related fixes on the system
- Although less likely, there might be a bug in how the paths are getting translated for the WHERE clause evaluation. In that case, I would suggest to open a support ticket with IBM.
You may try to re-run it with WHERE clause modify like so:
WHERE LOWER(cast(Path_Name as varchar(255) CCSID 37 )) LIKE '/home/xyz%'
...or...
WHERE LOWER(cast(Path_Name as varchar(255) CCSID 37 )) LIKE cast('/home/xyz%' as varchar(255) CCSID 37)
...where "37" would be CCSID of your job where you run the SQL query -- mine was 37.
Hope this helps,
Roman
Original Message:
Sent: 8/3/2024 2:29:00 AM
From: jerry ven
Subject: RE: SQL query to find objects located on IFS path on specific directory /subdirectory in IBM i
Hi,
Could someone please respond if anyone has any idea on the same here?
Thanks.
Original Message:
Sent: Fri August 02, 2024 05:39 AM
From: jerry ven
Subject: SQL query to find objects located on IFS path on specific directory /subdirectory in IBM i
Hi,
I tried this SQL query to find objects located on IFS path on specific directory /subdirectory in IBM i :-
"SELECT *
FROM TABLE(QSYS2.IFS_Object_Statistics(
Start_Path_Name => '/HOME/XYZ',
Subtree_Directories => 'YES'
)) x
WHERE LOWER(Path_Name) LIKE '/home/xyz%' "
But I got this error now "Message ID . . . . . . : SQL0332
Message . . . . : Character conversion between CCSID 1200 and CCSID 65535
not valid.
Any idea to get the desired result here with any other modified SQL query for the same here please?
Thanks..
------------------------------
jerry ven
------------------------------