Creating a Subfile of Sequential Numbers
Bob Comeau
bcomeau@crossley.ca
Tue, 25 Sep 2001 14:20:06 -0300
A crude non-powerhouse method (no flames please):
:print buildseq
PARM SEQRQRD="100"
SETVAR SEQRQRD,!SEQRQRD
PURGE SEQFILE
BUILD SEQFILE;DISC=!SEQRQRD;REC=-6,,F,ASCII
FILE SEQFILE=SEQFILE,OLD
SETVAR SEQNUM,1000000
SETVAR SEQSTOP,SEQNUM + !SEQRQRD
WHILE SEQNUM < SEQSTOP DO
ECHO ![RHT("!SEQNUM",6)]>>*SEQFILE
SETVAR SEQNUM,SEQNUM + 1
ENDWHILE
DELETEVAR SEQRQRD
DELETEVAR SEQNUM
DELETEVAR SEQSTOP
ECHO Done!
:buildseq 10
Done!
:print seqfile
000000
000001
000002
000003
000004
000005
000006
000007
000008
000009
:
My biggest concern would be the number of file opens/closes performed
in building a million record file. But for a one time shot, it works.
To get it indexed just build an appropriate KSAMFILE and FCOPY records into
it.
Or to stay within Image you could feed the records into an appropriate
dataset.
Bob Comeau