Hi All,
Second time to post on this group :)
I'm pulling my hair now 'coz I'm so dumb to produce this requirement.
Requirement: I want to run a utility by limiting the no. inside my process (mov##) to be able to use in multi streaming.
Here is my script:
--Input: "user_list.txt"
40013163:5
40109925:3
89877423:4
73084042:1
40152547:2
82475674:0
--Script:
set -A ext_ids `cat user_list.txt`
process_id=2
total_extid=${#ext_ids[@]}
cnt=0
while [ $cnt -lt $total_extid ]
do
if [ $total_extid -lt 6 ]
then
echo "PREQ_MOVER mov0$process_id ${ext_ids[$cnt]} "
else
# Always starts w/ process_id 2
process_id=`expr 2 + $cnt / 3` # Increase the dividend to increase the process_id value
if [ $process_id -le 9 ]
then
processid="0$process_id"
else
processid=$process_id
fi
extids=`echo "${ext_ids[$cnt]}"|cut -d : -f 1`
echo "PREQ_MOVER mov$processid $extids "
count=`echo "${ext_ids[$cnt]}"|cut -d : -f 2`
## Un/Comment here
#if [ $count -eq 0 ]
# then
# count=$(($count + 1))
#fi
fi
## Un/Comment here
#cnt=$(($cnt + $count))
cnt=$(($cnt + 1))
done
# Single stream or multi stream
if [ $total_extid -lt 6 ]
then
echo "\n\tRunning Single Stream of MOVER\n"
echo "MOVER mov0$process_id SOURCE_DB"
else
echo "\n\tRunning Multiple Stream of MOVER\n"
proc=2
while [ $proc -le $process_id ]
do
if [ $proc -le 9 ]
then
procs="0$proc"
else
procs=$proc
fi
echo "MOVER mov${procs} "
proc=$(($proc + 1))
done
fi
Output:
PREQ_MOVER mov02 40013163
PREQ_MOVER mov02 40109925
PREQ_MOVER mov02 89877423
PREQ_MOVER mov03 73084042
PREQ_MOVER mov03 40152547
PREQ_MOVER mov03 82475674
Running Multiple Stream of MOVER
MOVER mov02
MOVER mov03
Now by editing the script by uncommenting the commented fields. I get...
Output:
PREQ_MOVER mov02 40013163
PREQ_MOVER mov03 82475674
Running Multiple Stream of MOVER
MOVER mov02
MOVER mov03
Note: The output above skips from 40013163 to 40013163 & the rest are not shown.
Desired Output: (limit to 3 accounts inside each mov## process)
PREQ_MOVER mov02 40013163 -> since it has 5, it will take up the whole process "mov02". This will fill up the process even if it exceeds the limit
PREQ_MOVER mov03 40109925 -> will take mov03 as it has 3
PREQ_MOVER mov04 89877423 -> will take mov04 as it has 4. This will fill up the process even if it exceeds the limit.
PREQ_MOVER mov05 73084042 -> has 1, will use mov05 since the limit is not met
PREQ_MOVER mov05 40152547 -> has 2, will still use mov05 to fill up the limit
PREQ_MOVER mov06 82475674 -> this will use mov06 as mov05 is already filled up.
Running Multiple Stream of MOVER
MOVER mov02
MOVER mov03
MOVER mov04
MOVER mov05
MOVER mov06
Question: How to be able to display the desired output in order to limit the nos of each mov## process (even it exceeds) in sequence (no skipping).
Purpose: To run the utility MOVER in multiple stream by not skipping a user in the list.
I hope the explanation above is sufficient & I hope someone will enlighten me on this.
Hoping for your kind assistant.
Thanx