fhg
Volume 9, Number 16 -- May 13, 2009

A Not-Quite-As-Sleepy RPG Program

Published: May 13, 2009

Hey, Ted:

Thanks for the information about the sleep API. On a recent project, we had a requirement to ensure that two operations were at least a microsecond apart, but a full second proved to be far too long. (Seconds add up quickly!) We created a DLYJOBSML (Delay Job for Small Duration) command and invoked the usleep API in the CPP.

--Blair


Like sleep, usleep also delays a job. The difference is that the usleep parameter denotes milliseconds, rather than whole seconds. You might say that sleep is like going to bed at night, whereas usleep only takes a nap.

Here's the code from the previous article retrofitted with usleep.

H dftactgrp(*no) actgrp(*new)                          
H option(*srcstmt:*nodebugio)                          
H bnddir('QC2LE')                                      
                                                       
D usleep          pr            10u 0 extproc('usleep')
D   Interval                    10u 0 value            
                                                       
D t1              s               z                    
D t2              s               z                    
                                                       
 /free                                                 
    *inlr = *on;                                       
    t1 = %timestamp();                                 
    usleep (150);                                      
    t2 = %timestamp();                                 
    return;                                            

Like sleep, usleep does not cause an exact delay. That is, just because you ask for 150 milliseconds doesn't mean you're going to get it. You'll probably get more or less.

Blair was not the only one to write in about usleep. Thanks to everyone who took the time to write.

--Ted


RELATED STORY

A Sleepy RPG Program



                     Post this story to del.icio.us
               Post this story to Digg
    Post this story to Slashdot


Sponsored By
WORKSRIGHT SOFTWARE

Do you need area code information?
Do you need ZIP Code information?
Do you need ZIP+4 information?
Do you need city name information?
Do you need county information?
Do you need a nearest dealer locator system?

We can HELP! We have affordable AS/400 software and data to do all of the above. Whether you need a simple city name retrieval system or a sophisticated CASS postal coding system, we have it for you!

The ZIP/CITY system is based on 5-digit ZIP Codes. You can retrieve city names, state names, county names, area codes, time zones, latitude, longitude, and more just by knowing the ZIP Code. We supply information on all the latest area code changes. A nearest dealer locator function is also included. ZIP/CITY includes software, data, monthly updates, and unlimited support. The cost is $495 per year.

PER/ZIP4 is a sophisticated CASS certified postal coding system for assigning ZIP Codes, ZIP+4, carrier route, and delivery point codes. PER/ZIP4 also provides county names and FIPS codes. PER/ZIP4 can be used interactively, in batch, and with callable programs. PER/ZIP4 includes software, data, monthly updates, and unlimited support. The cost is $3,900 for the first year, and $1,950 for renewal.

Just call us and we'll arrange for 30 days FREE use of either
ZIP/CITY or PER/ZIP4.

WorksRight Software, Inc.
Phone: 601-856-8337
Fax: 601-856-9432
E-mail: software@worksright.com
Web site: www.worksright.com


Senior Technical Editor: Ted Holt
Technical Editor: Joe Hertvik
Contributing Technical Editors: Edwin Earley, Brian Kelly, Michael Sansoterra
Publisher and Advertising Director: Jenny Thomas
Advertising Sales Representative: Kim Reed
Contact the Editors: To contact anyone on the IT Jungle Team
Go to our contacts page and send us a message.

Sponsored Links

Vision Solutions:  New white paper! Review the full range of Data Protection & Recovery options.
SafeData:  FREE White Paper - Best Bets for iSeries Rapid Recovery with Virtualization
Aberdeen Group:  Take the 2009 ERP in Manufacturing survey, get a free copy of complete report


 

IT Jungle Store Top Book Picks

Easy Steps to Internet Programming for AS/400, iSeries, and System i: List Price, $49.95
The iSeries Express Web Implementer's Guide: List Price, $49.95
The System i RPG & RPG IV Tutorial and Lab Exercises: List Price, $59.95
The System i Pocket RPG & RPG IV Guide: List Price, $69.95
The iSeries Pocket Database Guide: List Price, $59.00
The iSeries Pocket SQL Guide: List Price, $59.00
The iSeries Pocket Query Guide: List Price, $49.00
The iSeries Pocket WebFacing Primer: List Price, $39.00
Migrating to WebSphere Express for iSeries: List Price, $49.00
Getting Started With WebSphere Development Studio Client for iSeries: List Price, $89.00
Getting Started with WebSphere Express for iSeries: List Price, $49.00
Can the AS/400 Survive IBM?: List Price, $49.00
Chip Wars: List Price, $29.95


 
The Four Hundred
Sundry Spring Power Systems Storage Enhancements

IBM Wheels and Deals on Power 570s and 595s in Q2

Micro Focus to Buy Borland, Compuware Unit for Testing Tools

As I See It: Ah, Vacation!

Middleware Sales Are Slipping, But Could Rebound First

Four Hundred Stuff
JDA Previews New GUI for MMS at User Conference

ARCAD Moves Open Systems Initiative Forward with Application Lifecycle Management Software

Vision Updates iTERA and MIMIX for i OS HA

Key Announces GA of Smart i Appliance for BI

Oracle Refreshes JD Edwards World, Updates Tools for EnterpriseOne

Four Hundred Monitor
Four Hundred Monitor's
Full iSeries Events Calendar

System i PTF Guide
May 9, 2009: Volume 11, Number 19

May 2, 2009: Volume 11, Number 18

April 25, 2009: Volume 11, Number 17

April 18, 2009: Volume 11, Number 16

April 11, 2009: Volume 11, Number 15

April 4, 2009: Volume 11, Number 14

TPM at The Register
Rackable Systems slips into SGI's name

Fujitsu goes dense with Nehalem blades

IBM deals on big Power iron in Q2

Sun: 'We may have violated bribery laws'

Voltaire's sales plummet in Q1

US job cuts slow in April

Citrix XenServer 5.5 cleared for June landing

Moblin 2.0 Linux goes alpha (again)

Super Micro rack-mounts micro Atom server

Dell hunting M&A guru

AMD to support Intel AVX instructions

Rackable serves up $13.4m in losses

Intel animates Data Center Manager

Citrix plunks NetScaler into virtual machines

THIS ISSUE SPONSORED BY:

WorksRight Software
ProData Computer Services
Guild Companies


Printer Friendly Version


TABLE OF CONTENTS
A Not-Quite-As-Sleepy RPG Program

SQL's Other Fetch Options

Admin Alert: Four Ways To Encrypt i5/OS Backups, Part 1

Four Hundred Guru

BACK ISSUES

From the IT Jungle Forums
PHP CLI Call

Perl, PHP, and/or ZendCore

batch printing PDF files from RPG program

Using db2_connect in PHP on iSeries

How to return value from CL program?

ADO.NET/IBM.Data.DB2.iSeries/ iDB2Connection

Order by alias names




 
Subscription Information:
You can unsubscribe, change your email address, or sign up for any of IT Jungle's free e-newsletters through our Web site at http://www.itjungle.com/sub/subscribe.html.

Copyright © 1996-2009 Guild Companies, Inc. All Rights Reserved.
Guild Companies, Inc., 50 Park Terrace East, Suite 8F, New York, NY 10034

Privacy Statement