generate random characters



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

generate random characters

Postby ramu65 » Wed Jun 04, 2014 6:35 pm

Hi

I have a requirement to generate random names and insert into table.Is it possible to achieve this in cobol??
ramu65
 
Posts: 29
Joined: Sat Feb 08, 2014 10:51 pm
Has thanked: 0 time
Been thanked: 0 time

Re: generate random characters

 

Re: generate random characters

Postby BillyBoyo » Wed Jun 04, 2014 7:05 pm

It is not only possible, it is a common beginner's mistake in the early stages of testing.

However, you're going to have to explain a bit more about what you want to get a more serious answer.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: generate random characters

Postby Ed Goodman » Fri Jun 06, 2014 8:36 pm

Do they need to be legit names, like Carrie R Cards, or can they be actual random characters, like asjhkj sdsdlkiu?
Ed Goodman
 
Posts: 342
Joined: Thu Feb 24, 2011 12:05 am
Has thanked: 3 times
Been thanked: 17 times

Re: generate random characters

Postby ramu65 » Sun Jun 08, 2014 8:18 pm

I know its difficult to produce legit names.My requirement is to just produce random strings of maximum 10 characters.I am not aware on how to convert random numbers to corresponding alphabets.Can someone please share code to implement the same.
ramu65
 
Posts: 29
Joined: Sat Feb 08, 2014 10:51 pm
Has thanked: 0 time
Been thanked: 0 time

Re: generate random characters

Postby enrico-sorichetti » Sun Jun 08, 2014 9:59 pm

iterate 10 times generating every time a number form 1 to the number of chars of Your destination alphabet
and use the number as the index for the char to use
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2706
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 139 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post