Richard
Yes I agree, the manual mentions using the #pragma mapinc to map the fields but as that is done at compile time it may not work in this situation as I need to set up the in_null_map field of the _RFILE struct at runtime? The first parameter relates to the structure and the second the field so the returned value is the offset to the field within the structure. The structure is for a volatile const char * of varying length (depends on the number of fields in the file) so I know that the one I am testing with is 10 bytes long. That I do know but the rest is simply black art...
I wrote a quick trial using the following code which I thought would set the map but it still fails when I try to update the file??
Unfortunately there is little to no information around about how to set the field, I can see the length of the in_map_null matches the number of fields in the file but that’s as far as I get.
Here is the code I tried to use to set the in_null_map.
data= (char *)&NVI_Buf->NVI;
nvi_set = (char *)&fp->in_null_map;
for(j = 0; j < NVI_Buf->Length_NVI; j++,data++,nvi_set++) {
if(*data == 0xF9)
*nvi_set = __NULL_VALUE;
else
*nvi_set = __NOT_NULL_VALUE;
printf("%.X - %c",*data,*nvi_set);
}
printf("\nin_null_map =");
nvi_set = (char *)&fp->in_null_map;
for(j = 0; j < NVI_Buf->Length_NVI; j++,nvi_set++) {
printf("%.X",*nvi_set);
}
I can see the in_null_map is set to 0xF1 and 0xF0 in the right order (the NVI_Buf is from a journal entry) but it still fails to set the buffer correctly if the messages in the joblog are to be believed?
I am working blind here and IBM is not able to supply me enough information to make this work, I cannot release the entire code due to Confidentiality either..
Chris...
Chris Hird
Director
Shield Advanced Solutions Ltd
http://www.shieldadvanced.ca
1(519) 940-1192
___________________________________________________________________________________
Please consider the environment before printing this email.
This message, including any attached documents, is intended for the addressees only. It may contain information that is confidential, privileged and/or exempt from disclosure. No rights to privilege or confidentiality have been waived. Any unauthorized use or disclosure is prohibited. If you have received this message in error, please reply to the sender by e-mail and delete or destroy all copies of this message.
______________________________________________________
Avant d'imprimer ce courriel, pensez à l'environnement.
Ce message, incluant tous les documents joints, est à l'intention des destinataires visés seulement. Il peut contenir des renseignements confidentiels, protégés et/ou ne pouvant pas être divulgués. Aucune renonciation n'est faite quant à sa nature confidentielle et privilégiée. Par conséquent, toute diffusion ou utilisation non autorisée est strictement interdite. Si vous avez reçu ce message par erreur, veuillez en aviser immédiatement l'expéditeur par retour de courriel et en détruire toutes les copies existantes.
-----Original Message-----
From: c400-l-bounces@xxxxxxxxxxxx [mailto:c400-l-bounces@xxxxxxxxxxxx] On Behalf Of Wei CDL Feng
Sent: Friday, September 14, 2012 1:08 PM
To: C programming iSeries / AS400
Subject: Re: [C400-L] _SET_NULL_MAP_FIELD() macro
Hi,
From a C program view, the 2nd (__type) and the 3rd parameters (__field) should refer to some user defined structure (type name) and its containing field (member name). Those do not need typedef, I think. The description
of the macro offsetof may help to study the usage. But I don't understand
what specific type name and member name would be used in your context. :-)
http://en.wikipedia.org/wiki/Offsetof
http://www.cplusplus.com/reference/clibrary/cstddef/offsetof/
#define _SET_UPDATE_NULL_MAP_FIELD(__file,__type,__field)
(*((__file)->in_null_map + offsetof(__type,__field)) =
__NULL_VALUE)
Richard Feng
Chris Hird
<chris.hird@shiel
dadvanced.ca> To
Sent by: <c400-l@xxxxxxxxxxxx>
c400-l-bounces@mi cc
drange.com
Subject
[C400-L] _SET_NULL_MAP_FIELD()
09/14/2012 11:47 macro
PM
Please respond to
C programming
iSeries / AS400
<c400-l@midrange.
com>
Hi
I am trying to work with data that has NULL fields defined and need to update a file. I am reading the data from a journal entry and can see the NULL map in the journal entry, the manuals say I need to update the null map fields before I call the _Rupdate() function, but that’s where things get a little confusing. The _SET_NULL_MAP_FIELD() macro takes 3 parameters, first the _RFILE ptr, then a type (I assume this is wher it needs to be ‘0’ or ‘1’
to determine if NULL) plus a field. But it offers no explanation of the input required? I assume because it is a volatile char *const that this is an array of characters which needs to be set to ‘0’ or ‘1’ according to the fields in the file?
This is the macro definition
#define _SET_UPDATE_NULL_MAP_FIELD(__file,__type,__field)
(*((__file)->in_null_map + offsetof(__type,__field)) =
__NULL_VALUE)
I cannot find any typedef which relates to the __type or __field element?
I have determined the content of the data and it shows that F9 needs to be set as a ‘1’ and F0 to ‘0’, but I am not sure how to code up the above macro to achieve this? I also see the data for the field which is F0 in the null map is the data to be changed so I know the _Rupdate() function should take the NULL map and set the data accordingly but not sure how to implement?
This is only part of the problem, but once I get the null map set I am sure the rest will make sense.
Any advice will be gladly accepted.
Chris…
Chris Hird
Director
Shield Advanced Solutions Ltd
http://www.shieldadvanced.ca
1(519) 940-1192
____________________________________________________________________________
_______
Please consider the environment before printing this email.
This message, including any attached documents, is intended for the addressees only. It may contain information that is confidential, privileged and/or exempt from disclosure. No rights to privilege or confidentiality have been waived. Any unauthorized use or disclosure is prohibited. If you have received this message in error, please reply to the sender by e-mail and delete or destroy all copies of this message.
______________________________________________________
Avant d'imprimer ce courriel, pensez à l'environnement.
Ce message, incluant tous les documents joints, est à l'intention des destinataires visés seulement. Il peut contenir des renseignements confidentiels, protégés et/ou ne pouvant pas être divulgués. Aucune renonciation n'est faite quant à sa nature confidentielle et privilégiée.
Par conséquent, toute diffusion ou utilisation non autorisée est strictement interdite. Si vous avez reçu ce message par erreur, veuillez en aviser immédiatement l'expéditeur par retour de courriel et en détruire toutes les copies existantes.
--
This is the C programming iSeries / AS400 (C400-L) mailing list To post a message email: C400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/c400-l
or email: C400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/c400-l.
As an Amazon Associate we earn from qualifying purchases.