The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact firstname.lastname@example.org.
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'.
On Fri, 22 Apr 2022 19:55:47 +0000 Rob Berendt wrote:
Following some instructions based on this:
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
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 ''')';
As an Amazon Associate we earn from qualifying purchases.