How to delete observations in SAS - sas

I'm working in SAS with a file with roughly 80000 observations, I've decided to keep 11 variables.
I want to delete variables with a value exceeding 97. These are missing observations and I don't want to deal with that.
I tried using the followin code (please don't judge):
199 DATA radata;
200 SET radata;
201 IF ca10 <= 97 THEN OUTPUT;
202 IF ca10 > 97 THEN DELETE;
203 IF sex <= 97 THEN OUTPUT;
204 IF sex > 97 THEN DELETE;
205 IF sex <= 97 THEN OUTPUT;
206 IF sex > 97 THEN DELETE;
207 IF cityrur <= 97 THEN OUTPUT;
208 IF cityrur > 97 THEN DELETE;
209 IF edu3 <= 97 THEN OUTPUT;
210 IF edu3 > 97 THEN DELETE;
211 IF ca10 <= 97 THEN OUTPUT;
212 IF ca10 > 97 THEN DELETE;
213 IF hinc3rel <= 97 THEN OUTPUT;
214 IF hinc3rel > 97 THEN DELETE;
215 IF aa10i <= 97 THEN OUTPUT;
216 IF aa10i > 97 THEN DELETE;
217 IF ba10 <= 97 THEN OUTPUT;
218 IF ba10 > 97 THEN DELETE;
219 IF age <= 97 THEN OUTPUT;
220 IF age > 97 THEN DELETE;
221 IF ga10c <= 97 THEN OUTPUT;
222 IF ga10c > 97 THEN DELETE;
223 IF bc20 <= 97 THEN OUTPUT;
224 IF bc20 > 97 THEN DELETE;
225 IF ac10a <= 97 THEN OUTPUT;
226 IF ac10a > 97 THEN DELETE;
227 IF ga10j <= 97 THEN OUTPUT;
228 IF ga10j > 97 THEN DELETE;
229 RUN;
SAS however, responds not by subtracting observations but by adding more of them!
Please help.....

https://communities.sas.com/ is probably a better place to ask such a programming question (and I wouldn't be surprised if this question is closed).
Here are 3 ways to delete all observations (i.e., rows) with at least one value of those variables being greater than 97:
data radata;
set radata;
array x(10) ca10 sex cityrur edu3 hinc3 aa10i age ga10c bc20 ga10j;
do i=1 to 10;
if x(i) > 97 then delete;
end;
run;
or
data radata;
set radata;
if ca10 > 97 then delete;
if sex > 97 then delete;
if cityrur > 97 then delete;
if edu3 > 97 then delete;
if hinc3 > 97 then delete;
if aa10i > 97 then delete;
if age > 97 then delete;
if ga10c > 97 then delete;
if bc20 > 97 then delete;
if ga10j > 97 then delete;
run;
or
data radata;
set radata;
if ca10 > 97 or sex > 97 or cityrur > 97 or edu3 > 97 or
hinc3 > 97 or aa10i > 97 or age > 97 or ga10c > 97 or
bc20 > 97 or ga10j > 97 then delete;
run;
Now if you just want those variables to have the missing value symbol (.) and not delete the whole observation, then you'll need to replace delete with x(i) = .. You can do something similar for the second example.

Related

Arduino insertion sort issue with struct array

Here is the struct:
struct RGB {
byte r;
byte g;
byte b;
byte v;
};
And here is the sorting function:
void insertion_sort(RGB arr[], size_t capacity) {
RGB temp;
size_t j;
for(size_t i = 1; i < capacity; i++) {
temp = arr[i];
j = i - 1;
while(j >= 0 && arr[j].v > temp.v) {
arr[j+1] = arr[j];
j--;
}
arr[j+1] = temp;
}
}
the v member of the RGB struct is the object's position in the array before scrambling (and hopefully where it ends up after sorting). Here is the output when printing the v member of every element of the array:
165 171 53 164 171 13 13 167 156 168 163 14 15 16 17 18 19 20 20 156 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 142 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149
I get the same output every time.
There are 150 elements in the array, and everything seems fine after 21. The issue is that the elements before that are wrong, and also made up of values higher than 149. Currently, the b and g members of RGB are all 0 throughout the array, and r is evenly-spaced values from 0-254.
It should be noted that the exact same sorting function works when I recreated everything in C++, and it even works to sort an array of ints in Arduino. The only issue is sorting an array of RGB structs, which seems to be causing memory issues.
Your problem is the definition of j.
Your options are:
Serial output in critical lines and analyze the serial monitor -> Arduinos way of debuging
using one of the hundred tested sorting functions (e.g. here on stack exchange) like quick sort etc.
using the std::sort
For the last option you have to:
The best solution is to use the C++ standard library function std::sort. This function is type-safe, and doesn't require you to cast anything to void * and back, and you don't have to manually enter the sizes of the array and its elements.
#include < Arduino_Helpers.h\>
#include < AH/STL/algorithm\>
#include < AH/STL/iterator\>
auto cmpfunc = [](RGB A, RGB B) { return A.value < B.value; };
// or if you do not like this notation use
bool cmpfunc(RGB A, RGB B) {
return A.value < B.value;
}
std::sort(std::begin(RGB arr[]), std::end(RGB arr[]), cmpfunc); // Dummy for a RGB arr[] containing all your values
-
The problem was because of the size_t datatype, which is unsigned and could not become a value < 0 when it was supposed to. Thank you #JohnFilleau

Primes with argc and argv

I have an assignment in Codejudge which I write a command line program which reads a space separated list of integers from the command line and prints the ordered sublist consisting of the input prime numbers.
I tried numerous times but I can't seem to work
this is input argument:
9308 2034 9466 283 7949 1153 7241 5341 4693 6910 6852 5540 8015 9305 5697 1395 4727 9159 8661 1367 6096 2911 4797 8025 2593 5460 5767 5543 2429 8371 6024 2343 285 8657 9869 5388 5295 6279 3084 9573 6980 2362 1565 5134 5185 1991 7142 3699 5937 4151 3044 2468 8005 1603 662 2989 752 6971 3152 3681 9743 653 4542 719 2081 5772 9179 4034 5904 5494 1653 251 130 6646 2835 2260 8998 7464 112 2179 6592 8502 7381 5990 6681 8237 1331 537 2048 3342 9353 7883 1041 621 1022 4569 1421 9592 877 657 7097 2828 6242 2216 387 4605 8017 2784 4509 5818 7959 1612 491 6381 6530 5773 2220 2802 6478 7401 9084 1845 8805 8192 9806 6940 6578 9132 3144 8793 4854 1087 3238 8622 419 346 2598 1194 5766 4626 4740 6191 8639 7948 9833 3117 232 5839 8726 4863 4532 3498 6717 4874 3496 2951 5750 6982 1779 9614 9519 5980 3245 2698 6771
etc.
#include <cmath>
#include <iostream>
#include <vector>
#include <algorithm>
int main(int argc, char* argv[]) {
std::vector<int> input;
std::vector<int> output;
for (int a = 0; a < argc; a++) {
input.push_back(std::atoi(argv[a]));
}
int count = 0;
for (int i = 0; i < input.size(); i++) {
if (input.at(i) % 2 != 0 && (input.at(i) % 3 != 0 || input.at(i) / 3 == 1) && (input.at(i) % 5 != 0 || input.at(i) / 5 == 1) /*&& input.at(i)*input.at(i)% input.at(i)!=0*/) {
output.push_back(input.at(i));
count++;
}
}
sort(output.begin(), output.end());
for (int i = 0; i < count; i++) {
std::cout << output[i] << " ";
}
}
expected result:
1 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 127 131 137 139 149 151 157 163 167 173 179 181 191 193 197 199 211 223 227 229 233 239 241
actual result:
1 3 5 7 11 13 17 19 23 29 31 37 41 43 47 49 53 59 61 67 71 73 77 79 83 89 91 97 101 103 107 109 113 119 121 127 131 133 137 139 143 149 151 157 161 163 167 169 173 179 181 187 191 193 197 199 203 209 211 217 221 223 227 229 233 239 241
there are difference between the expected and the actual.
keep in mind that the vector of random numbers are in random orders and not from smallest to largest and they all are
for (int a = 0; a < argc; a++) {
input.push_back(std::atoi(argv[a]));
}
should be
for (int a = 1; a < argc; a++) {
input.push_back(std::atoi(argv[a]));
}
The first argument argv[0] is the program name.

Why are my bit shifts giving incorrect numbers

I'm trying to store a number in an array of 4 integers. The array is in the class Num. My problem is that when I call getValue, the function returns numbers that aren't correct. I tried go through the program on paper, doing all the calculations in Microsoft's calculator, and the program should give the correct output. I don't even know which function could be problematic since there aren't any errors or warnings, and both worked on paper.
21 in binary:10101
What I'm trying to do:
Input to setValue function: 21
setValue puts the first four bits of 21 (0101) into num[3]. So num[3] is now 0101 in binary. Then it should put the next four bits of 21 into num[2]. The next four bits are 0001 so 0001 goes into num[2] The rest of the bits are 0 so we ignore them. Now num is {0,0,1,5}. getValue first goes to num[3]. There is 5 which is 0101 in binary. So it puts that into the first four bits of return value. It then puts 0001 into the next four bits. The rest of the numbers are 0 so it is supposed to ignore them. Then the output of the function getValue is directly printed out. The actual output is at the bottom.
My code:
#include <iostream>
class Num {
char len = 4;
int num[4];
public:
void setValue(int);
int getValue();
};
void Num::setValue(int toSet)
{
char len1=len-1;
for (int counter = len1;counter>=0;counter--)
{
if(toSet&(0xF<<(len1-counter))!=0)
{
num[counter]=(toSet&(0xF<<(len1-counter)))>>len1-counter;
} else {
break;
}
}
}
int Num::getValue()
{
char len1 = len-1;
int returnValue = 0;
for(char counter = len1; counter>=0;counter--)
{
if (num[counter]!=0) {
returnValue+=(num[counter]<<(len1-counter));
} else {
break;
}
}
return returnValue;
}
int main()
{
int x=260;
Num number;
while (x>0)
{
number.setValue(x);
std::cout<<x<<"Test: "<<number.getValue()<<std::endl;
x--;
}
std::cin>>x;
return 0;
}
Output:
260Test: -1748023676
259Test: 5
258Test: 5
257Test: 1
256Test: 1
255Test: 225
254Test: 225
253Test: 221
252Test: 221
251Test: 213
250Test: 213
249Test: 209
248Test: 209
247Test: 193
246Test: 193
245Test: 189
244Test: 189
243Test: 181
242Test: 181
241Test: 177
240Test: 177
239Test: 177
238Test: 177
237Test: 173
236Test: 173
235Test: 165
234Test: 165
233Test: 161
232Test: 161
231Test: 145
230Test: 145
229Test: 141
228Test: 141
227Test: 133
226Test: 133
225Test: 1
224Test: 1
223Test: 161
222Test: 161
221Test: 157
220Test: 157
219Test: 149
218Test: 149
217Test: 145
216Test: 145
215Test: 129
214Test: 129
213Test: 125
212Test: 125
211Test: 117
210Test: 117
209Test: 113
208Test: 113
207Test: 113
206Test: 113
205Test: 109
204Test: 109
203Test: 101
202Test: 101
201Test: 97
200Test: 97
199Test: 81
198Test: 81
197Test: 77
196Test: 77
195Test: 5
194Test: 5
193Test: 1
192Test: 1
191Test: 161
190Test: 161
189Test: 157
188Test: 157
187Test: 149
186Test: 149
185Test: 145
184Test: 145
183Test: 129
182Test: 129
181Test: 125
180Test: 125
179Test: 117
178Test: 117
177Test: 113
176Test: 113
175Test: 113
174Test: 113
173Test: 109
172Test: 109
171Test: 101
170Test: 101
169Test: 97
168Test: 97
167Test: 81
166Test: 81
165Test: 77
164Test: 77
163Test: 69
162Test: 69
161Test: 1
160Test: 1
159Test: 97
158Test: 97
157Test: 93
156Test: 93
155Test: 85
154Test: 85
153Test: 81
152Test: 81
151Test: 65
150Test: 65
149Test: 61
148Test: 61
147Test: 53
146Test: 53
145Test: 49
144Test: 49
143Test: 49
142Test: 49
141Test: 45
140Test: 45
139Test: 37
138Test: 37
137Test: 33
136Test: 33
135Test: 17
134Test: 17
133Test: 13
132Test: 13
131Test: 5
130Test: 5
129Test: 1
128Test: 1
127Test: 225
126Test: 225
125Test: 221
124Test: 221
123Test: 213
122Test: 213
121Test: 209
120Test: 209
119Test: 193
118Test: 193
117Test: 189
116Test: 189
115Test: 181
114Test: 181
113Test: 177
112Test: 177
111Test: 177
110Test: 177
109Test: 173
108Test: 173
107Test: 165
106Test: 165
105Test: 161
104Test: 161
103Test: 145
102Test: 145
101Test: 141
100Test: 141
99Test: 133
98Test: 133
97Test: 1
96Test: 1
95Test: 161
94Test: 161
93Test: 157
92Test: 157
91Test: 149
90Test: 149
89Test: 145
88Test: 145
87Test: 129
86Test: 129
85Test: 125
84Test: 125
83Test: 117
82Test: 117
81Test: 113
80Test: 113
79Test: 113
78Test: 113
77Test: 109
76Test: 109
75Test: 101
74Test: 101
73Test: 97
72Test: 97
71Test: 81
70Test: 81
69Test: 77
68Test: 77
67Test: 5
66Test: 5
65Test: 1
64Test: 1
63Test: 161
62Test: 161
61Test: 157
60Test: 157
59Test: 149
58Test: 149
57Test: 145
56Test: 145
55Test: 129
54Test: 129
53Test: 125
52Test: 125
51Test: 117
50Test: 117
49Test: 113
48Test: 113
47Test: 113
46Test: 113
45Test: 109
44Test: 109
43Test: 101
42Test: 101
41Test: 97
40Test: 97
39Test: 81
38Test: 81
37Test: 77
36Test: 77
35Test: 69
34Test: 69
33Test: 1
32Test: 1
31Test: 97
30Test: 97
29Test: 93
28Test: 93
27Test: 85
26Test: 85
25Test: 81
24Test: 81
23Test: 65
22Test: 65
21Test: 61
20Test: 61
19Test: 53
18Test: 53
17Test: 49
16Test: 49
15Test: 49
14Test: 49
13Test: 45
12Test: 45
11Test: 37
10Test: 37
9Test: 33
8Test: 33
7Test: 17
6Test: 17
5Test: 13
4Test: 13
3Test: 5
2Test: 5
1Test: 1
I compiled this with g++ 6.3.0 with the command g++ a.cpp -o a.exe
When compiling with -Wall, there are a number of warnings:
orig.cpp: In member function ‘void Num::setValue(int)’:
orig.cpp:15:39: warning: suggest parentheses around comparison in operand of ‘&’ [-Wparentheses]
if(toSet&(0xF<<(len1-counter))!=0)
~~~~~~~~~~~~~~~~~~~~~^~~
orig.cpp:17:61: warning: suggest parentheses around ‘-’ inside ‘>>’ [-Wparentheses]
num[counter]=(toSet&(0xF<<(len1-counter)))>>len1-counter;
~~~~^~~~~~~~
orig.cpp: In member function ‘int Num::getValue()’:
orig.cpp:30:24: warning: array subscript has type ‘char’ [-Wchar-subscripts]
if (num[counter]!=0) {
^
orig.cpp:31:38: warning: array subscript has type ‘char’ [-Wchar-subscripts]
returnValue+=(num[counter]<<(len1-counter));
^
If you were to print the values of num before changing them, you'd see that some might be non-zero (i.e. they are uninitialized), which causes undefined behavior and probably breaks your for loops in getValue and setValue.
So change:
int num[4];
Into:
int num[4] = { 0 };
Here's a cleaned up version with the warnings fixed:
#include <iostream>
class Num {
int len = 4;
int num[4] = { 0 };
public:
void setValue(int);
int getValue();
void showval();
};
void Num::setValue(int toSet)
{
int len1=len-1;
for (int counter = len1;counter>=0;counter--)
{
if ((toSet & (0xF << (len1-counter))) != 0)
{
num[counter] = (toSet & (0xF << (len1-counter))) >> (len1-counter);
} else {
break;
}
}
}
int Num::getValue()
{
int len1 = len-1;
int returnValue = 0;
for(int counter = len1; counter>=0;counter--)
{
if (num[counter]!=0) {
returnValue+=(num[counter]<<(len1-counter));
} else {
break;
}
}
return returnValue;
}
void Num::showval()
{
for (int i = 0; i < len; ++i)
std::cout << i << ": show: " << num[i] << "\n";
#if 0
for (int i = 0; i < len; ++i)
num[i] = 0;
#endif
}
int main()
{
int x=260;
Num number;
number.showval();
while (x>0)
{
number.setValue(x);
std::cout << x << " Test: " << number.getValue() << std::endl;
x--;
}
std::cin>>x;
return 0;
}
To break a number into nibbles, the shift counts should be multiples of 4. Otherwise slices of 4 bits are extracted that don't line up.
00010101 (21)
^^^^ first nibble
^^^^ second nibble
The second nibble is displaced by 4 bits so it needs to be shifted right by 4, not by 1.
You could multiply your shift counts by 4, but there is an easier way: only ever shift by 4. For example:
for (int i = len - 1; i >= 0; i--) {
num[i] = toSet & 0xF;
toSet >>= 4;
}
Then every iteration extracts the lowest nibble in toSet, and shifts toSet over so that the next nibble becomes the lowest nibble.
I didn't put in a break and there should not be one. It definitely shouldn't be the kind of break that you had, which stops the loop also whenever a number has a zero in the middle of it (for example in 0x101 the middle 0 causes the loop to stop). The loop also should not stop when the entire rest of the number is zero, since that leaves junk in the other entries of num.
It's more common to store the lowest nibble in the 0th element and so on (then you don't have to deal with all the "reverse logic" with down-counting loops and subtracting things from the length) but that's up to you.
Extracting the value can be done symmetrically, building up the result while shifting it, instead of shifting every piece into its final place immediately. Or just multiply (len1-counter) by 4. While extracting the value, you also cannot stop when num[i] is zero, since that does not prove that the rest of the number is zero too.

Get frequency from dataset with repeated measurements over time

this is my problem: I have a dataset that has 10 measurements over time, something like this:
ID Expenditure Age
25 100 89
25 102 89
25 178 89
25 290 89
25 200 89
.
.
.
26 100 79
26 102 79
26 178 79
26 290 79
26 200 79
.
.
.
27 100 80
27 102 80
27 178 80
27 290 80
27 200 80
.
.
.
Now I want to obtain the frequency of age, so I did this:
proc freq data=Expenditure;
table Age / out= Age_freq outexpect sparse;
run;
Output:
Age Frequency Count Percent of total frequency
79 10 0.1
80 140 1.4
89 50 0.5
The problem is that this counts all rows, but doesn't take into account the repeated measurements per id. So I wanted to create a new colum with the actual frequencies like this:
data Age;
set Age_freq;
freq = Frequency Count /10;
run;
but I think sas doesn't recognize this 'Frequency Count' variable, can anybody gives me some insight on this?
thanks
You have to remove the duplicate records so that each ID had one record containing the age.
Solution: create a new table with the disticnt values of the ID and Age. then run the proc freq
Code:
I created a new table called Expenditure_ids that doesn't have any duplicate values for the ID & Age.
data Expenditure;
input ID Expenditure Age ;
datalines;
25 100 89
25 102 89
25 178 89
25 290 89
25 200 89
26 100 79
26 102 79
26 178 79
26 290 79
26 200 79
27 100 80
27 102 80
27 178 80
27 290 80
27 200 80
28 100 80
28 102 80
28 178 80
28 290 80
28 200 80
;
run;
proc sql;
create table Expenditure_ids as
select distinct ID, Age from Expenditure ;
quit;
proc freq data=Expenditure_ids;
table Age / out= Age_freq outexpect sparse;
run;
Output:
Age=79 COUNT=1 PERCENT=25
Age=80 COUNT=2 PERCENT=50
Age=89 COUNT=1 PERCENT=25

crash while accessing the std::string of a class

I have the following coredump.
Program terminated with signal 11, Segmentation fault.
#0 0xb5b1c2f8 in std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
from /arm-none-linux-gnueabi/libc_m/usr/lib/libstdc++.so.6
#0 0xb5b1c2f8 in std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
from /arm-none-linux-gnueabi/libc_m/usr/lib/libstdc++.so.6
#1 0x00964f5c in Qct::OamClientUtil::getRsp (this=<value optimized out>)
at /Agent/include/oamClientUtil.hpp:92
#2 0x00902118 in MapPM::sendCollect (this=0xb4af9928) at /gent/src/mapPM.cc:557
#3 0x00921dc0 in Agent::handlePMCollectReq (this=<value optimized out>, buf=0xb335ccb0)
at /Agent/src/Agent.cc:5671
#4 0x0095deb4 in AgentRxHandler (handle=<value optimized out>, buf=0xb335ccb0)
at /Agent/src/uslAgent.cc:398
#5 0x0080f364 in uslDCTEntry (dct=20401048) at /usl/src/lcid/uslDCT.cc:253
#6 0x009c867c in TASK::taskEntryPoint (params=0x1375098) at /emvxworks/taskLib.cpp:224
#7 0x009c7bbc in pthreadw_taskentry (arg=<value optimized out>) at /emvxworks/pthread_wrapper.cpp:786
#8 0xb59a6120 in start_thread (arg=0xb4aff460) at pthread_create.c:307
#9 0xb592e9f8 in nfsservctl ()
from /CodeSourcery/4.6.3-2012.03-57/arm-none-linux-gnueabi/libc_m/lib/libc.so.6
Backtrace stopped: frame did not save the PC
I am quite confused how a simple string is causing the crash.
Since the code is pretty big I will paste the relevant classes for now. Will add more if needed.
/Agent/include/oamClientUtil.hpp:92
37 class OamClientUtil
38 {
39 public:
40 OamClientUtil();
41
42 virtual
43 ~OamClientUtil();
44
45
46 void
47 initOamProxyConn();
48
49 void
50 setBatch(
51 OamClients& batch
52 );
53
54 /// load oam transactions from a file
55 /// and convert them to a list of oam client transactions
56 bool
57 loadTrxFromFile(
58 std::string& batchfilename
59 );
60
61 /// actual processing the list of transactions
62 MgmtResult
63 run();
64
65 bool
66 isGood();
67
68 /// return the dryrun flag
69 bool
70 isDryrun();
71
72 /// set the dryrun flag
73 bool
74 isDryrun(bool flag);
75
76 const OamErrorString&
77 errorString() const;
78
79
80 void
81 initRsp() {
82 getRsp_ = "";
83 }
84 void
85 initKeyRsp() {
86 getKeysRsp_ = "";
87 }
88
89
90 std::string
91 getRsp() {
92 return getRsp_;
93 }
94 std::string
95 getKeysRsp() {
96 return getKeysRsp_;
97 }
98 bool
99 getKeysLast() {
100 return getKeysLast_;
101 }
102 private:
103 static const unsigned REQ_TIMEOUT_SECS = 10;
104
105 /// send get request
106 MgmtResult
107 sendGetReq(
108 OamClientTrxPtr trx
109 );
110
111 /// send getKeys request
112 MgmtResult
113 sendGetKeysReq(
114 OamClientTrxPtr trx
115 );
116 /// send set request
117 MgmtResult
118 sendSetReq(
119 OamClientTrxPtr trx
120 );
121
122 /// send clear request
123 MgmtResult
124 sendClearReq(
125 OamClientTrxPtr trx
126 );
127
128 /// process the list of transactions
129 MgmtResult
130 processTransactionList(
131 OamClientTrxList& trxlist ///< The list of transaction to be processed
132 );
133
134 /// process one transaction
135 MgmtResult
136 processTransaction(
137 OamClientTrxPtr trx ///< The transaction to be processed
138 );
139
140 /// print content of one transaction
141 void
142 printRequests(
143 OamClientTrxPtr trx
144 );
145
146 void
147 indCallback(
148 unsigned int msgId,
149 QctUint8_t* indMsgBuffer,
150 unsigned int indMsgBufferLength);
151
152
153 static ProvisioningPtr
154 initProvisioningPtr();
155
156
157 static MgmtXmlPtr
158 initMgmtXmlPtr();
159
160 QmiClient qmiClient_;
161 MgmtXmlPtr mgmtXmlPtr_;
162 OamClients batch_;
163 SerialStreamFixedBuf<QMI_FSM_OAM_CLIENT_MAX_LENGTH_V04> sstream_;
164 QctUint16_t trxid_;
165
166 std::string batchfilename_;
167 bool isDryrun_;
168 bool isGood_;
169 QctUint32_t oamSessionId_;
170 OamErrorString errorMsg_;
171 std::string getRsp_;
172 std::string getKeysRsp_;
173 bool getKeysLast_;
174 ProvisioningPtr provisioningPtr_;
175 };
176
#2 0x00902118 in MapPM::sendCollect (this=0xb4af9928) at /Agent/src/mapPM.cc:557
549Qct::MgmtResult MapPM::sendCollect()
550{
551 clUtil_.initRsp();
552 clUtil_.setBatch(oamClients_);
553 Qct::MgmtResult mr = clUtil_.run(); // process every transaction in oamClients_
554 if (mr == Qct::MGMT_RESULT_FAIL) {
555 //return Qct::MGMT_RESULT_FAIL;
556 }
557 return makePMFile(clUtil_.getRsp());
558
}
clUtil_ is object of Qct::OamClientUtil
Qct::OamClientUtil clUtil_;
/Agent/src/Agent.cc:5671
5671 Qct::MgmtResult result = mapPM.sendCollect();
/Agent/src/uslAgent.cc:398
400 case OAM_AGENT_PMSETUP:
401 oamAgent.handlePMSetupReq(buf);
402 break;
I don't think there should be any valid reason for your program to crash at this point -- that is assuming that;
All the code have been compiled with the same compiler
The header files are not compiled differently in different files (i.e. you didn't forget to recompile something after you changed a header file).
I think you most likely have a memory corruption somewhere else and it shows up (by bad luck) when you accesses this class. Try to use a tool like valgrind or similar to track down anything bad being done by the rest of your code.