I may not need it, at this time. I have over a dozen differing lpars of IBM i and it's not unreasonable that there may be duplicates at some time.
Besides, I have the logic working now and it can be duplicated, if needed, for other such entries.
------------------------------
Robert Berendt IBMChampion
Business Systems Analyst, Lead
Dekko
Fort Wayne
260-599-3160
------------------------------
Original Message:
Sent: Fri September 20, 2024 09:13 AM
From: Rich Malloy
Subject: How to convert an integer into a string while retaining the leading zeros?
Based on the above, I don't believe you need entry number since you don't have duplicate job names. Since the job name is unique, you should be able to just use *ONLY (which is the default) ....I can see if you had duplicate job names then yes, the entry number is required but that doesn't seem to be the case. I was just curious as to why you were needing the entry number....glad its working for you though. Rich
------------------------------
Rich Malloy
------------------------------
Original Message:
Sent: Fri September 20, 2024 08:23 AM
From: Robert Berendt
Subject: How to convert an integer into a string while retaining the leading zeros?
Rich:
Part 1:
Job
BRMMAINT
BRMRECOVER
BRMREORG
BRMSSTATUS
Part 2:
...
DECLARE BRM CURSOR FOR
select SCHEDULED_JOB_NAME, SCHEDULED_JOB_ENTRY_NUMBER
FROM QSYS2.SCHEDULED_JOB_INFO
WHERE SCHEDULED_JOB_NAME LIKE 'BRM%'
AND STATUS = 'HELD';
...
-- WRKJOBSCDE BRM*
-- Release any which are held
SET END_TABLE = 0;
OPEN BRM;
FETCH BRM INTO JOBNAME, JOB_ENTRY_NBR;
WHILE END_TABLE = 0 DO
SET JOB_ENTRY_NBR_CHAR = LPAD(JOB_ENTRY_NBR, 6, '0');
SET COMMAND = 'RLSJOBSCDE JOB(' concat JOBNAME concat
') ENTRYNBR(' concat JOB_ENTRY_NBR_CHAR concat ')';
CALL QSYS2.QCMDEXC(COMMAND);
FETCH BRM INTO JOBNAME, JOB_ENTRY_NBR;
END WHILE;
CLOSE BRM;
...
------------------------------
Robert Berendt IBMChampion
Business Systems Analyst, Lead
Dekko
Fort Wayne
260-599-3160
Original Message:
Sent: Fri September 20, 2024 08:16 AM
From: Rich Malloy
Subject: How to convert an integer into a string while retaining the leading zeros?
just curious - do you have jobs in the job scheduler with the same name ? If not, the entry number isn't required if you accept the default as *ONLY. Also, and just in case you are not aware - this sql service can be used to work with your scheduled jobs qsys2.scheduled_job_info and consumed into your program if that makes life easier for you...(now or in the future). Thanks
------------------------------
Rich Malloy
Original Message:
Sent: Thu September 19, 2024 10:42 AM
From: Robert Berendt
Subject: How to convert an integer into a string while retaining the leading zeros?
DIGITS was what I couldn't remember. Thank you.
Had to use the RIGHT when trying to stuff an INT into a CHAR(6) required by RLSJOBSCDE JOB(...) ENTRYNBR(here)
Otherwise I was getting all zeros.
------------------------------
Robert Berendt IBMChampion
Business Systems Analyst, Lead
Dekko
Fort Wayne
260-599-3160
Original Message:
Sent: Thu September 19, 2024 10:09 AM
From: Anton Gombkötö
Subject: How to convert an integer into a string while retaining the leading zeros?
I'd rather use the DIGITS function, like:
values right(digits(cast(1037 as int)), 6);
If your variable has the right size, you do not even need the "right".
best regards
ANTON GOMBKÖTÖ
Softwareentwickler

CPB SOFTWARE (AUSTRIA) GMBH
Campus Viertel Zwei
Vorgartenstraße 206c, A-1020 Wien
T: +43 1 427 01-204
Anton.Gombkoetoe@cpb-software.com
www.cpb-software.com
FN 174113z, Handelsgericht Wien
This message is intended for the named addressee only and shall not create any legal obligation upon CPB Software AG or any of its affiliates or subsidiaries unless independently confirmed in writing. Any disclosure or dissemination to third parties is strictly prohibited.