Author: Bob Steinkraus
Subject: Casting a Binary Number to Numeric in Natural/ADABAS, or...
Posted: Tue Aug 09, 2016 5:58 pm (GMT 5.5)
Good morning (where I am) -
I am a Natural/ADABAS developer. My task is to generate a 4-digit random number to use in a superdescriptor (along with other fields). So -
The *TIMESTMP is a binary 8 field. I have puzzled and puzzled, using edit masks and redefines and Heaven only knows what else. I can get the *TIMESTMP to display as Hex by Redefining the B8 as N8 and using (EM=HHHHHHHH) but that doesn't get me any further. I tried using VAL to get the numeric value, but that didn't work either.
Does anyone know of a clever and/or elegant way to convert the B8 to an N8 (or probably, a larger field) so I can pick out the most random part? I am not allowed to write any COBOL or Assembler user exits or anything like that.
Any advice gratefully accepted.
Regards,
Bob Steinkraus
Subject: Casting a Binary Number to Numeric in Natural/ADABAS, or...
Posted: Tue Aug 09, 2016 5:58 pm (GMT 5.5)
Good morning (where I am) -
I am a Natural/ADABAS developer. My task is to generate a 4-digit random number to use in a superdescriptor (along with other fields). So -
- First off, is there any way to generate a random number in Natural? I don't have access to the SYSEXP library, and I looked at the SAG website and didn't find anything.
- So I decided to try to generate my own random number. My thought was to use the *TIMESTMP system variable, and try to get the random number from there.
The *TIMESTMP is a binary 8 field. I have puzzled and puzzled, using edit masks and redefines and Heaven only knows what else. I can get the *TIMESTMP to display as Hex by Redefining the B8 as N8 and using (EM=HHHHHHHH) but that doesn't get me any further. I tried using VAL to get the numeric value, but that didn't work either.
Does anyone know of a clever and/or elegant way to convert the B8 to an N8 (or probably, a larger field) so I can pick out the most random part? I am not allowed to write any COBOL or Assembler user exits or anything like that.
Any advice gratefully accepted.
Regards,
Bob Steinkraus