×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




Rob,

The problem is not with the IF but with the SELECT statement. You need to
add TRIM or RTRIM to the 2 places you use WORK_YEAR because it has 7 spaces
after it, so the OBJECT_COUNT is always 0 e.g. RTRIM(CHAR(WORK_YEAR)).

In addition if your MD DIR worked then your directory is '/path/2014
' not /path/2014' as you would expect. If you try CD '/path/2014' you
will get CPFA0A9 'Object not found'.

Regards
Terry Bartlett

On Fri, 22 Apr 2022 19:55:47 +0000 Rob Berendt wrote:

Following some instructions based on this:
https://www.itjungle.com/2022/04/11/guru-debugging-sql-stored-procedures-with-acs/


I have these two variables:

DECLARE WORK_YEAR INT;

DECLARE BREAK_YEAR INT;

According to the debugger WORK_YEAR = 2014 and BREAK_YEAR = 0.


However it does none of the lines between the IF and the END IF.
IF WORK_YEAR > BREAK_YEAR then
-- If the year subdirectory doesn't exist, create it
SELECT COUNT(*) into OBJECT_COUNT
from table(qsys2.IFS_OBJECT_STATISTICS(
start_path_name => START_PATH concat '/' concat CHAR(WORK_YEAR),
subtree_directories => 'NO'));
IF OBJECT_COUNT = 0 then
SET COMMAND = 'MD DIR(''' concat START_PATH concat '/' concat
CHAR(WORK_YEAR) concat ''')';
CALL QSYS2.QCMDEXC(COMMAND);
END IF;


Rob Berendt

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2026 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.