Change file content based on data

I have a Transaction File coming into the system. In this file, in all records the relevant data is as follows-

Position 1:10 -> Transaction Code
Position 252:255 -> 4 digit business code

Now based on these 2 fields I have to alter value in Transaction code (Position 1:10)

For example if  10 digit transaction code is �CN0001N  -�  and 
4 digit business code is one of following values  0292, 0379, 1038, 7810, 7811, 7812, 7842, 7843 
change the 10 digit transaction code to �CNQCSHN  -�
 

[/SIZE][/FONT]

I have to check for 15 similar conditions.

Also My file is having lots of records - (Around 1 Million) so performance is also an issue.

Could someone please suggest the approach which should be taken for this?

not clear.

provide sample input file and output file here.

I hope the below explanation will make the things clears. As the single record in file is having 955 characters, file is too big to be posted even for sample record.

Input file Details

Position 1:10 -> Transaction Code
Position 252:255 -> 4 digit business code

Condition

IF

10 digit transaction code = �CN0001N -�
( from position 1:10)

4 digit business code = One from following -> 0292, 0379,
1038, 7810, 7811, 7812, 7842, 7843

THEN

Change the 10 digit transaction code(position 1:10) to �CNQCSHN -�

Ok, for my understanding, the input should be like (just a sample)

Position 1:10 -> CN0001N -
Position 252:255 -> 0292

then the output will be:

Position 1:10 -> CNQCSHN -
Position 252:255 -> 0292

is it right?

Yes. This is exactly what is required.

Also there are around 1 million records in the file and the command/script should check all records.

And there are 15 similar conditions.

give some samples from your real date for us to easily understand. For example, how to identify there are four records? split by empty lines or other condition?

Such as: ?

Position 1:10 -> CN0001N -
Position 252:255 -> 0292

Position 1:10 -> CN0001N -
Position 252:255 -> 0292

Position 1:10 -> CN0002N -
Position 252:255 -> 0379

Position 1:10 -> CN0001N -
Position 252:255 -> 0292
$ cat 1.txt
Position 1:10 -> CN0001N -
Position 252:255 -> 0292

Position 1:10 -> CN0001N -
Position 252:255 -> 7810

Position 1:10 -> CN0002N -
Position 252:255 -> 0111

Position 1:10 -> CN0001N -
Position 252:255 -> 0292
awk -F "->" '{
       if($1 == "Position 1:10 ")
       {
          line1=$0;
          getline;
          if($2==0292 || $2==0379 || $2==1038 || $2==7810|| $2==7811|| $2==7812|| $2==7842|| $2==7843)
             line1="Position 1:10 -> CNQCSHN -";
          print line1;
          print;
       }
       else print;
    }' 1.txt
Output:
Position 1:10 -> CNQCSHN -
Position 252:255 -> 0292

Position 1:10 -> CNQCSHN -
Position 252:255 -> 7810

Position 1:10 -> CN0002N -
Position 252:255 -> 0111

Position 1:10 -> CNQCSHN -
Position 252:255 -> 0292