Hi all,
I need to generate a file containing approx. 8 million distinct IP addresses - eg. 10.96.04, 10.96.05, 10.96.06, etc.
All I have is a start IP Range and an end IP Range (10.96.04 - 10.96.255.254) to work on and I have been given 64 varied ranges.
Would anyone know how to create a routine that would generate this distinct IP addresses? Any thoughts would be much appreciated.
Cheers,
eaman
Generate IP Address through DS Jobs
Moderators: chulett, rschirm, roy
Hi and welcome aboard ,
There are plenty who knows how.
The question is will anyone contribute such an effort for free?
(even if it might be a small effort)
You can find all the ingridiants for the solution in your Basic.pdf guide.
you'll need some loops (2 nested ones at least and some string concatenation and your good to go )
IHTH,
There are plenty who knows how.
The question is will anyone contribute such an effort for free?
(even if it might be a small effort)
You can find all the ingridiants for the solution in your Basic.pdf guide.
you'll need some loops (2 nested ones at least and some string concatenation and your good to go )
IHTH,
Roy R.
Time is money but when you don't have money time is all you can afford.
Search before posting:)
Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Time is money but when you don't have money time is all you can afford.
Search before posting:)
Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
There are 4 sets of numbers between 0 and 255 in an IP address. Assuming your start address uses the top 2 groups:
I didn't debug this so it probably won't compile, but the rough logic is there. I might also change it to multiple FOR a=0 TO 255 loops...
Code: Select all
StartIPClassA = 64
StartIPClassB = 23
AddressesToGenerate = 8000000
AddressString = '' ;** this is going to be a big string!
IPA = StartIPClassA
IPB = StartIPClassB
IPC = 0
IPD = 0
FOR Counter = 1 TO AddressesToGenerate
IPD += 1
IF (IPD=256)
THEN
IPD = 0
IPC += 1
IF (IPC=256)
THEN
IPC = 0
IPB += 1
IF (IPB=256)
THEN
IPB = 0
IPA += 1
IF IPA=256 THEN CALL DSLogFatal('oopsie','')
END
END
END
AddressString<-1> = IPA:'.':IPB:'.':IPC:'.':IPD
NEXT Counter
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
-
- Charter Member
- Posts: 130
- Joined: Mon Sep 06, 2004 3:05 am
- Location: Dubai,UAE
Hi,
If I have understood your question correctly then u need
10.96.4.0
|
10.96.4.255
|
10.96.5.0
|
10.96.5.255
|
|
|
10.96.255.255
This can easily be done in DataStage Job using Stage Variables
Declaring 2 stage Variables
Counter1 - Intial Value =4
Counter2 - Intial Value =0
Counter1 Derivation: If Counter2=255 then Counter1+1 else Counter1
Counter2 Derivation: If Counter2<255 then Counter2+1 Else 0
IPAdress=10: "." : 96 : "." : Counter1 : "." : Counter2
In the transformer stage give the correct OUTROWNUM which calculates to 64512 for 10.96.255.255
Hope this helps
Thanks
If I have understood your question correctly then u need
10.96.4.0
|
10.96.4.255
|
10.96.5.0
|
10.96.5.255
|
|
|
10.96.255.255
This can easily be done in DataStage Job using Stage Variables
Declaring 2 stage Variables
Counter1 - Intial Value =4
Counter2 - Intial Value =0
Counter1 Derivation: If Counter2=255 then Counter1+1 else Counter1
Counter2 Derivation: If Counter2<255 then Counter2+1 Else 0
IPAdress=10: "." : 96 : "." : Counter1 : "." : Counter2
In the transformer stage give the correct OUTROWNUM which calculates to 64512 for 10.96.255.255
Hope this helps
Thanks
Warm Regards,
Amruta Bandekar
<b>If A equals success, then the formula is: A = X + Y + Z, X is work. Y is play. Z is keep your mouth shut. </b>
--Albert Einstein
Amruta Bandekar
<b>If A equals success, then the formula is: A = X + Y + Z, X is work. Y is play. Z is keep your mouth shut. </b>
--Albert Einstein
YES it works! thank you so much Sunshine, its exactly what i need!
More power to all.
More power to all.
Sunshine2323 wrote:Hi,
If I have understood your question correctly then u need
10.96.4.0
|
10.96.4.255
|
10.96.5.0
|
10.96.5.255
|
|
|
10.96.255.255
This can easily be done in DataStage Job using Stage Variables
Declaring 2 stage Variables
Counter1 - Intial Value =4
Counter2 - Intial Value =0
Counter1 Derivation: If Counter2=255 then Counter1+1 else Counter1
Counter2 Derivation: If Counter2<255 then Counter2+1 Else 0
IPAdress=10: "." : 96 : "." : Counter1 : "." : Counter2
In the transformer stage give the correct OUTROWNUM which calculates to 64512 for 10.96.255.255
Hope this helps
Thanks