QzhbCgiParse API not working - cgi

I am trying to use QzhbCgiParse API in RPGLE to parse the QUERY_STRING, but it keeps throwing the error 'Error code parameter not valid'.
Dcl-Pr QzhbCgiParse extproc('QzhbCgiParse');
cmdStr char(100) const;
outFmt char(8) const;
targetBuf char(5000);
targetSize int(10) const;
responseLen int(10);
errorCode likeds(WPError);
End-Pr;
Dcl-S cmdStr char(100);
Dcl-S outFmt char(8);
Dcl-S targetBuf char(5000);
Dcl-S targetSize int(10);
Dcl-S responseLen int(10);
Dcl-Ds WPError;
bytesProv int(10) inz(%size(WPError));
bytesAvail int(10) inz(0);
errMsgId char(7);
*n char(1);
errMsgData char(40);
End-Ds;
QzhbCgiParse('-v ':'CGII0100': targetBuf: %size(targetBuf) : responseLen :WPError);
I have tried many data structure for the error code parameter, all in vain. Please advise.

I have got it working, API prototype was the issue. Once i changed the prototype as below, it worked perfectly.
Dcl-Pr QzhbCgiParse extproc('QzhbCgiParse');
cmdStr char(65535) const;
outFmt char(8) const;
targetBuf char(65535);
targetSize int(10) const;
responseLen int(10);
errorCode char(56);
End-Pr;

Related

The specified cast from a materialized 'System.Int32' type to the 'System.String' type is not valid.max function using int

I get this error on this line
var idnumber = db.h_ptmast.Max(r => r.ptmast_regno);
the datatype of ptmast_regno is int
if i wirte the above as
int idnumber = db.h_ptmast.Max(r => r.ptmast_regno);
then the whole line gives error as cannot convert type string to int

Program with embedded sql gives compilation error

#include<stdio.h>
#include<error.h>
#include<sys/shm.h>
#include "/opt/PostgreSQL/9.1/include/libpq-fe.h"
int main()
{
PGconn *conn;
int buf_ptr=0;
int i;
{
fprintf(stderr,"connection to database failed:%s",PQerrorMessage(conn));
exit(0);
}
else
{
printf("connection to database successful \n");
}
printf("Do you want to create a table enter 1 \n ");
scanf("%d",&i);
if(i==1)
{
EXEC SQl CREATE TABLE EMPOYE(
ENO INT,
ENAME VARCHAR(10));
}
return 0;
}
hello i am a newbie i am learning embedded c
i want to create a simple code where a table is created in c
when i am compiling the above program i am getting error like
embc.c:25: error: âEXECâ undeclared (first use in this function)
embc.c:25: error: (Each undeclared identifier is reported only once
embc.c:25: error: for each function it appears in.)
embc.c:25: error: expected â;â before âSQlâ
please help
First, the connection to database is missing, you should have something like :
int i=0;
EXEC SQL CONNECT TO target [AS connection-name] [USER user-name];
Or
PGconn *conn;
int buf_ptr=0;
int i=0;
conn = PQconnectdbParams(const char **keywords, const char **values, int expand_dbname);
then save your source file as prog.pgc and run :
ecpg prog.pgc
this will create a file called prog.c which can be compiled as a standard C file.

enum acting like an unsigned int in Xcode 4.6 even when enum is defined as a signed int

I have only been able to recreate this bug using xCode 4.6. Everything works as expected using Xcode 4.5
The issue is myVal has the correct bit structure to represent an int val of -1. However, it is showing a value of 4294967295 which is the value of the same bit structure if represented by an unsigned int. You'll notice that if i cast myVal to an int it will show the correct value. This is strange, because the enum should be an int to being with.
here is a screen shot showing the value of all of my variables in the debugger at the end of main. http://cl.ly/image/190s0a1P1b1t
typedef enum : int {
BTEnumValueNegOne = -1,
BTEnumValueZero = 0,
BTEnumValueOne = 1,
}BTEnumValue;
int main(int argc, const char * argv[])
{
#autoreleasepool {
//on this line of code myVal is 0
BTEnumValue myVal = BTEnumValueZero;
//we are adding -1 to the value of zero
myVal += BTEnumValueNegOne;
//at this moment myVal has the exact bit stucture
//of a signed int at -1, but it is displaying it
//as a unsigned int, so its value is 4294967295
//however, if i cast the enum (which should already
//be an int with a signing) to an int, it displays
//the correct value of -1
int myIntVal = (int)myVal;
}
return 0;
}
The new, preferred way to declare enum types is with the NS_ENUM macro as explained in this post: http://nshipster.com/ns_enum-ns_options/

NHibernate: Wrong column type: found float, expected double precision

I have a domain entity class with a property:
public virtual double? Result { get; set; }
The property is being mapped using the NHibernate 3.2 mapping-by-code stuff:
public class SampleResultMap : ClassMapping<SampleResult>
{
public SampleResultMap()
{
Id(c => c.Id,
map => map.Generator(Generators.Identity));
Property(c => c.Result, map =>
{
map.NotNullable(false);
});
// More properties, etc.
}
}
This works fine and the SQL Server 2008 R2 table is created properly with a data type of float.
However, the SchemaValidator.Validate call gives this error:
NHibernate.HibernateException was unhandled
Wrong column type in Foo.dbo.SampleResult for column Result.
Found: float, Expected DOUBLE PRECISION
Looking at the SQL that the call to SchemaExport.Create generates there is this definition for the table:
create table SampleResult (
Id INT IDENTITY NOT NULL,
DateEnteredUtc DATETIME not null,
ElementId INT not null,
Unit INT not null,
ResultText NVARCHAR(50) null,
[Result] DOUBLE PRECISION null,
Detected BIT not null,
Qualifier NVARCHAR(10) null,
SampleId INT not null,
Deleted BIT not null,
primary key (Id)
)
From a quick reading of the NHibernate 3.2 sources it appears that the validator is comparing “DOUBLE PRECISION” to “float”.
Has anyone else seen this? I assume it is a bug but I haven't used the validator before so wanted to find out if I’m doing something wrong.
I had a similar issue with natively generated IDs on a SQLite DB which was caused because SQLite only supports auto increment on integer columns.
NHibernate had correctly created the ID column as an integer but when it was validating it, it thought it should be an int instead of an integer. Because int just maps to integer on SQLite I just created a new dialect to use integer instead of int and it now works fine.
As DOUBLE PRECISION is the same as FLOAT(53) on SQLServer it might be the same thing, it's seeing float instead of double precision. As a work around you could try changing the dialect to use FLOAT(53) instead:
using System.Data;
using NHibernate.Dialect;
public class UpdatedMsSql2008Dialect : MsSql2008Dialect
{
public UpdatedMsSql2008Dialect()
: base()
{
RegisterColumnType(DbType.Double, "FLOAT(53)");
}
}
The SQLServer dialect source seems to suggest it should work. Definitely looks like there is a bug with the validator though.

CF - Starting application after installing it on device

In my setup.dll i have the folowing:
#include "stdafx.h"
#include "ce_setup.h"
TCHAR Message[] = _T("TERMS & CONDITIONS\r\n ")
_T("Do you agree to terms? \r\n");
codeINSTALL_INIT Install_Init
(
HWND hwndParent,
BOOL fFirstCall,
BOOL fPreviouslyInstalled,
LPCTSTR pszInstallDir
)
{
if (!fFirstCall || ::MessageBoxW(0, Message, _T("RmapGeneric"), MB_YESNO) == IDYES)
return codeINSTALL_INIT_CONTINUE;
else
return codeINSTALL_INIT_CANCEL;
}
codeINSTALL_EXIT Install_Exit
(
HWND hwndParent,
LPCTSTR pszInstallDir,
WORD cFailedDirs,
WORD cFailedFiles,
WORD cFailedRegKeys,
WORD cFailedRegVals,
WORD cFailedShortcuts
)
{
PROCESS_INFORMATION pi = {0};
codeINSTALL_EXIT cie = codeINSTALL_EXIT_DONE;
TCHAR szPath[MAX_PATH];
_tcscpy(szPath, pszInstallDir);
_tcscat(szPath, _T("\\"));
_tcscat(szPath, _T("Application.exe"));
MessageBox(GetForegroundWindow(), szPath, L"status", MB_OK);
if (!CreateProcess(szPath, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, &pi))
{
MessageBox(GetForegroundWindow(), szPath, L"failed", MB_OK);
cie = codeINSTALL_EXIT_UNINSTALL;
}
return cie;
}
While the first function works, the Install_Exit does not.
All i want is that after the installation the application automaticly starts.
Any suggestions what am i doing wrong?
There's nothing completely obvious as to what's wrong. Are you certain that the target executable is in that folder? Have you called GetLastError to see why it's failing?
Ok i found the problem in .DEF file
I forgot to export the exit function :S