Troubleshooting
Problem
This document explains how to call the Machine Interface Library Function 'waittime' using an ILE CLLE program.
Resolving The Problem
|
Disclaimer: This is an example only. IBM accepts no responsibility for its correctness. |
The waittime function causes the current process to be placed in a wait state for the amount of time specified by the wait interval in accordance with the specified wait options.
For the first parameter, you have the _MI_Time * wait_interval. The _MI_Time is an unsigned value of 4096000000. The wait_interval is the number of seconds you would like to wait. For my example, I took 4096000000 and multiplied it by 15 seconds to get a value of 61440000000. This number in hex is X'0000000E4E1C0000'.
The second parameter must have the value of hex X'0000'. The &OPTIONS can be larger. When calling 'waittime', you must pass the second parameter by value.
PGM
DCL VAR(&TIME) TYPE(*CHAR) LEN(8) VALUE(X'0000000E4E1C0000')
DCL VAR(&OPTIONS) TYPE(*CHAR) LEN(2) VALUE(X'0000')
DCL VAR(&VAR) TYPE(*CHAR) LEN(20)
/* The format of QDATETIME field is YYYYMMDDHHNNSSXXXXXX */
RTVSYSVAL SYSVAL(QDATETIME) RTNVAR(&VAR)
SNDPGMMSG MSG('Job wait started ' *CAT &VAR)
CALLPRC PRC('waittime') PARM(&TIME (&OPTIONS *BYVAL))
RTVSYSVAL SYSVAL(QDATETIME) RTNVAR(&VAR)
SNDPGMMSG MSG('Job wait ended ' *CAT &VAR)
ENDPGM
Note: The procedure name is 'waittime' which has to be in lower case.
> call waittime1
Job wait started 20241118153542643264
Job wait ended 20241118153557673436
To compile this sample you can issue a CRTBNDCL command or select 14 in PDM and it will compile.
Job wait started 20241118153542643264
Job wait ended 20241118153557673436
To compile this sample you can issue a CRTBNDCL command or select 14 in PDM and it will compile.
Note: On IBM i 610 and higher, we added functionality where the CL compiler automatically pulls in most of the IBM service programs. On a IBM i 540 system, you must issue a CRTCLMOD command or select 15 in PDM to compile it and then issue the CRTPGM command, binding it with service program QSYS/QC2UTIL1
Refer to the following link for WAITTIME in IBM documentation IBM i 750
https://www.ibm.com/docs/en/i/7.5?topic=instructions-wait-time-waittime
Refer to the following link for WAITTIME in IBM documentation IBM i 750
https://www.ibm.com/docs/en/i/7.5?topic=instructions-wait-time-waittime
[{"Type":"MASTER","Line of Business":{"code":"LOB68","label":"Power HW"},"Business Unit":{"code":"BU070","label":"IBM Infrastructure"},"Product":{"code":"SWG60","label":"IBM i"},"Platform":[{"code":"PF012","label":"IBM i"}],"Version":"6.1.0"}]
Historical Number
517234485
Was this topic helpful?
Document Information
Modified date:
18 November 2024
UID
nas8N1013117