|
Dear kelly........ i was seeing some old cobol sources in my company for this which generates a random no.. to my surprise this was what i got.,.... i dont know who wrote it 10 years back but this is working fine in production... maybe it is of some help to u....... P-CRTP-ACTLID. EXEC SQL SELECT ((HOUR(CURRENT TIME) * 3600) + (MINUTE(CURRENT TIME) * 60) + (SECOND(CURRENT TIME))) * 10000 + (DAYS("2010-01-01") - DAYS(CURRENT DATE)), MICROSECOND(CURRENT TIMESTAMP) INTO :W9CRTPACT, :W9CRTPMSEC FROM V_PSRLGEN END-EXEC. MOVE W9CRTPMSEC TO W9CRTPMSEC-1. MOVE W9CRTPMSEC-1 TO W9CRTPMIC. IF W9CRTPMIC6 > 5 ADD 1000000000 TO W9CRTPACT END-IF. **** DISPLAY W9CRTPACT. P-CRTP-ACTLID-EXIT. EXIT. Santosh............. age 24 years,,, a mining engineer working on as400 platform for the last 8 months... dont ask me how I got there.... enjoy... e- mail at : santoshp@lot.tatasteel.com ITS, Tata Steel. Jamshedpur, India. Tel : 842134 (O) , 200279 (R). Kelly Cookson <kc62301@yahoo.com> To: COBOL400-L@midrange.com Sent by: cc: cobol400-l-admin@mi Subject: RANDOM function with COBOL400? drange.com 08/24/01 06:09 AM Please respond to cobol400-l Newbie question. I have to generate a list of randomly selected employees for drug testing. I was thinking of using the RANDOM function. Unless someone has a better idea! :) I can't seem to get the RANDOM function coded properly. When I code the following line using SEU: COMPUTE X = FUNCTION RANDOM. SEU highlights the line and gives the following error message: "ANS COBOL reserved word FUNCTION will be accepted as a nonreserved word. A period is required before RANDOM. Line rejected." I tried coding the variation: COMPUTE X = RANDOM. and got the error message: "RANDOM not arithmetic expression. Line rejected." What am I missing here? How do I use the RANDOM function in COBOL400? Thanks in advance. Kelly __________________________________________________ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/ _______________________________________________ This is the COBOL Programming on the iSeries/AS400 (COBOL400-L) mailing list To post a message email: COBOL400-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/cgi-bin/listinfo/cobol400-l or email: COBOL400-L-request@midrange.com
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.