× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Barbara

I did a test to see what happens when I create a null map for fields in a
file. Here is a sample of the file field descriptions

Data Field Buffer Buffer Field Column
Field Type Length Length Position Usage Heading
EMPNUM CHAR 8 8 1 Both EMPNUM
Coded Character Set Identifier . . . . . : 37
SNAME CHAR 10 10 9 Both SNAME
Allows the null value
Coded Character Set Identifier . . . . . : 37
FORENAME CHAR 15 15 19 Both FORENAME
Coded Character Set Identifier . . . . . : 37
INIT1 CHAR 1 1 34 Both INIT1
Coded Character Set Identifier . . . . . : 37
INIT2 CHAR 1 1 35 Both INIT2
Coded Character Set Identifier . . . . . : 37
NINUM CHAR 9 9 36 Both NINUM
Allows the null value
Coded Character Set Identifier . . . . . : 37
TAXCODE CHAR 4 4 45 Both TAXCODE
Coded Character Set Identifier . . . . . : 37
NITABLE CHAR 1 1 49 Both NITABLE

This is the structure, it makes some sense.
/* ------------------------------------------------------- *
// PHYSICAL FILE : TSTMDTA/EMPDETS
// FILE LAST CHANGE DATE : 2012/09/13
// RECORD FORMAT : EMPREC
// FORMAT LEVEL IDENTIFIER : 37F02E40D0B87
* ------------------------------------------------------- */
typedef struct {
unsigned char EMPNUM;
unsigned char SNAME;
unsigned char FORENAME;
unsigned char INIT1;
unsigned char INIT2;
unsigned char NINUM;
unsigned char TAXCODE;
unsigned char NITABLE;
unsigned char RATEP;
unsigned char RATED;
} TSTMDTA_EMPDETS_EMPREC_nmap_t;

So my assumption is that if I assign that structure to the in_null_map and
set the relevant fields to NULL it should work. Likewise if I have an
unsigned char *, I should be able to set it to the address of the
in_null_map and increment it over the in_null_map and set the relevant
offset accordingly?

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 Barbara Morris
Sent: Friday, September 14, 2012 3:37 PM
To: c400-l@xxxxxxxxxxxx
Subject: Re: [C400-L] _SET_NULL_MAP_FIELD() macro

On 9/14/2012 11:47 AM, Chris Hird wrote:
... The _SET_NULL_MAP_FIELD() macro takes 3 parameters, first the
_RFILE ptr, then a type...

Chris, for update, you need the _SET_UPDATE_NULL_MAP_FIELD macro. The one
you mentioned works with the output null map.

I think those macros are meant to be used with a typedef created by pragma
mapinc with the nullflds option. The _type would be the typedef name, and
the _field would the field name. It looks like the macros only support
clearing the whole null map with _CLEAR_UPDATE_NULL_MAP, and then setting
individual fields to '1' with _SET_UPDATE_NULL_MAP_FIELD.

Here's a test program I found in my library that updates file BMORRIS/JUNKF.
It looks like the field names in my junk file were all 10A, and the first
and third were defined ALWNULL. The program is blindly updating all the
fields, and setting the third field NULL3 to be null.

main()
{
#pragma mapinc("nulls", "BMORRIS/JUNKF(REC)","nullflds")
#pragma mapinc("data", "BMORRIS/JUNKF(REC)","both")
#include "nulls"
#include "data"
BMORRIS_JUNKF_REC_both_t data;
_RFILE *rf;

rf = _Ropen("BMORRIS/JUNKF", "rr+ nullcap=Y");
_Rreadn (rf, &data, sizeof(data), __DFT);
_CLEAR_UPDATE_NULL_MAP(rf, BMORRIS_JUNKF_REC_nmap_t);
memcpy(&data, "null1 notnull2 null3 notnull4 ", 40);
_SET_UPDATE_NULL_MAP_FIELD(rf, BMORRIS_JUNKF_REC_nmap_t, NULL3);
_Rupdate (rf, &data, sizeof(data));
_Rclose (rf);
}
--
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.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.