Showing posts with label sleep. Show all posts
Showing posts with label sleep. Show all posts

Thursday, January 13, 2005

How to make an as400 program "sleep" for an amount of time

1) CALL as400 QCMDEXC to DLYJOB

or

2)
H Bnddir('ROUTINES/SRVPGM':'QC2LE')
D sleep PR 10I 0 EXTPROC('sleep')
D seconds 10U 0 VALUE

or, microseconds as400

D sleep PR 10I 0 EXTPROC('usleep')
D useconds 10U 0 VALUE

Then just sleep(60 * 10); (10 Mins)

or

use the MI WAITTIME instruction.

H DFTACTGRP(*NO)
DWait pr extproc('_WAITTIME')
D 16
DTemplate ds
D Interval 20u 0
D Options 8 inz(*loval)
DOneSecond s 20u 0 inz(4096000000)
C *entry plist
C parm NbrSecs 15 5
C eval Interval = NbrSecs * OneSecond
C callp Wait(Template)
C move '1' *inlr
C return

Supplying a value of 5 for NbrSecs would give you a 5 second delay to you as400 program.