Question on counting control #'s

KWong kwong@intergate.bc.ca
Fri, 29 May 1998 00:24:13 -0700


The INITIAL option on the SUBTOTAL statement will allow you to do this in
one pass.

>access A-DATASET
>define starter int size 4 = parm prompt "Enter starting number:"
>define initnum int size 4 = starter - 1
>define counter int size 4 = 1
>define ctrlnum int size 4 = 1
>report counter subtotal noreset &
        fieldA &
        ctrlnum subtotal initial initnum noreset
>set subfile name XXXX keep
>go

Enter starting number: 101

Records written: ...

>dump *XXXX

 COUNTER FIELDA CTRLNUM
    1     0011    101
    2     0012    102
    3     0013    103
    4     0014    104
    .      .       .
    .      .       .

Ken Wong
Piranha Consulting Group Inc.


At 09:31 98-05-28 PDT, Nancy Tietz wrote:
>
>Try this:
>
>Quiz
>>access  A-DATASET
>>define starter int size 4 = parm prompt "Enter starter number:"
>>define counter int size 4 = 1
>>
>>set subfile name xxx keep
>> report summary  number  starter  counter SUBTOTAL
>> go
>> access *xxx
>> define control# int size 4 = starter + counter - 1   ;minus 1 so it starts 
>with starter!
>> rep number control#
>>go
>Enter starter number: 12
>1    12
>2    13
>3    14
>4    15
>5    16
>
>If you need it sorted, you may need to add:
>>Sort on sort-key1 on sort-key2
>> set subfile name xxx keep at sort-key1
>> rep sum  number starter counter SUBTOTAL  RESET AT SORT-KEY1
>
>I hope that helps!
>Nancy Tietz
>ntietz@mcare.med.umich.edu
> ----------
>>From: powerh-l-owner
>>To: 'POWERH-L@LISTS.SWAU.EDU'
>>Subject: Question
>>Date: Wednesday, May 27, 1998 4:43PM
>>
>>Good afternoon,
>>
>>        I have a slight problem I was hoping someone could help me with.
>>I need a list of numbers in a file and I need to assign each number a
>>specific control number. I know what the beginning control number is and
>>I need to increment it by one for each number and then write them both
>>out to a subfile.                     number            control #
>>                        1               0011
>>                        2               0012
>>                        3               0013
>>                        4               0014
>>                        5               0015
>>I am running 7.29 on an HP3000.
>>
>>Thanks for your help
>>Anthony
>>= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
>>Subscribe: "subscribe powerh-l" in message body to majordomo@lists.swau.edu
>>Unsubscribe: "unsubscribe powerh-l" in message to majordomo@lists.swau.edu
>>powerh-l@lists.swau.edu is gatewayed one-way to bit.listserv.powerh-l
>>This list is closed, thus to post to the list, you must be a subscriber.
>>
>= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
>Subscribe: "subscribe powerh-l" in message body to majordomo@lists.swau.edu
>Unsubscribe: "unsubscribe powerh-l" in message to majordomo@lists.swau.edu
>powerh-l@lists.swau.edu is gatewayed one-way to bit.listserv.powerh-l
>This list is closed, thus to post to the list, you must be a subscriber.
>
>

= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Subscribe: "subscribe powerh-l" in message body to majordomo@lists.swau.edu
Unsubscribe: "unsubscribe powerh-l" in message to majordomo@lists.swau.edu
powerh-l@lists.swau.edu is gatewayed one-way to bit.listserv.powerh-l
This list is closed, thus to post to the list, you must be a subscriber.