|
I have attached a code sample called testit3. I am trying to write a user journal entry through the API. However, this does not work as I get a message that key(0) is invalid ! I believe that I am getting into a structure alignment issue but I am not sure. Anyone have any ideas what is wrong with this code ??? Thanks, Jeff Silberberg
/******************************************************************************/
/**
**/
/** TESTIT - Sample Program for Send User Journal Entry
**/
/**
**/
/******************************************************************************/
#include <stdio.h>
#include <string.h>
#include <qjosjrne.h>
#include <qusec.h>
struct jeVarRecord {
short int key;
short int length;
char data;
} ;
struct jeVarArray {
short int count;
char *data; /* Insert Ptr to Array of jeVarRecords */
} ;
main(void)
{
Qus_EC_t errCode;
int rc;
char objName[10] = "SPARCSJRN" ;
char objLibrary[10] = "*LIBL";
char qualName[20];
char entryData[1024];
short int entryDataLen = 0;
char jeRecordKey[1024]; /* Buffer to hold n jeVarRecords */
struct jeVarRecord *jeKey; /* Pointer to Buffer */
struct jeVarArray jeVar; /* OverLay of the jeVarRecords Array */
char *pJeVar; /* Char pointer to Struct jeVar */
char *pErrCode = (char *) &errCode;
jeKey = (struct jeVarRecord *) jeRecordKey;
memset(jeKey, 0x00, sizeof(jeRecordKey));
jeKey->key = 2; /* Key 2 = Qualified File Name */
jeKey->length = sprintf(&jeKey->data, "%s%s",
"$EQUIP ", "*LIBL ");
/** 1234567890 1234567890 **/
jeKey += (jeKey->length + 4); /* Bump Pointer by Len + 2 Shorts */
jeKey->key = 4; /* Key 4 = Fource Journal entry */
jeKey->length = 1 ;
jeKey->data = '1';
jeKey += 6;
/* Keys 1 3 5 are Defaulted */
jeVar.count = 2; /* Load Arrary Count of 2 */
jeVar.data = &jeRecordKey[0];
pJeVar = (char *) &jeVar;
sprintf(qualName, "%10.10s%10.10s", objName, objLibrary);
entryDataLen = sprintf(entryData, "%s", "SHUTDOWN");
QJOSJRNE(qualName, pJeVar, entryData, entryDataLen,
pErrCode);
}
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.