# Unexpected error message

**URL:** <https://discuss.ampl.com/t/unexpected-error-message/768>\
**Category:** New to AMPL\
**Tags:** errors-and-messages\
**Created:** [October 19, 2023, 1:10pm UTC](https://discuss.ampl.com/t/unexpected-error-message/768 "2023-10-19T13:10:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abendrot47](https://avatars.discourse-cdn.com/v4/letter/a/46a35a/32.png) [@Abendrot47](https://discuss.ampl.com/u/Abendrot47)\
**Post date:** [October 19, 2023, 1:10pm UTC](https://discuss.ampl.com/t/unexpected-error-message/768/1 "2023-10-19T13:10:57Z")

</div>

Here is my run file:  
reset;

data 1-1a.dat;

model 1-1a.mod;

solve;

Getting these unexpected errors:  
1-1a.dat, line 3 (offset 16):  
MEDIA is not a set  
context: set \>\>\> MEDIA \<\<\< := TV MAG ;

1-1a.dat, line 5 (offset 65):  
cost is not a subscripted param  
context: param: cost reach require \>\>\> := \<\<\<

1-1a.dat, line 9 (offset 134):  
budget is not a param (or var or constraint or objective)  
context: param \>\>\> budget \<\<\< := 1000000 ;  
ampl:

Can someone please help me understand why I am getting these errors and how to correct them? Thanks

---

<div class="post-metadata">

**Author:** ![4er](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/4er/32/530_2.png) [@4er](https://discuss.ampl.com/u/4er)\
**Post date:** [October 20, 2023, 4:57pm UTC](https://discuss.ampl.com/t/unexpected-error-message/768/2 "2023-10-20T16:57:27Z")

</div>

You need to read the model file _before_ the data file:

```auto
model 1-1a.mod;
data 1-1a.dat;
solve;

```

In the model file there is a statement

```auto
set MEDIA;

```

that defines `MEDIA` to be a set. Then in the data file there is a statement

```auto
set MEDIA := TV MAG ;

```

that gives the members of that set, for the particular case that you want to solve.
