Here is some sample code I used to test before

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <qusec.h>
#include <decimal.h>
#include <qwcrdtaa.h>


typedef _Packed struct DA_content_x {
Qwc_Rdtaa_Data_Returned_t hdr;
char data[8192];
} DA_content_t;

int main(int argc, char **argv) {
int bytes = 0; // bytes to read
DA_content_t Dta_Content; // data area content
char test_buf[8192]; // TEST BUFFER
char *tmp; // temp ptr
Qwc_Rdtaa_Data_Returned_t *ptr; // buffer ptr
Qus_EC_t Error_Code = {0}; // error code struct

Error_Code.Bytes_Provided = sizeof(Error_Code);
bytes = *(int *)argv[2];
printf("bytes %d\n",bytes);
QWCRDTAA(test_buf,
8192,
argv[1],
1,
bytes,
&Error_Code);
if(Error_Code.Bytes_Available > 0) {
// do something about the error
printf("Error received %.7s\n",Error_Code.Exception_Id);
return -1;
}
ptr = (Qwc_Rdtaa_Data_Returned_t *)test_buf;
printf("Available = %d\n",ptr->Bytes_Available);
printf("Returned = %d\n",ptr->Bytes_Returned);
printf("Type = %.10s\n",ptr->Type_Value_Returned);
printf("Length = %.10s\n",ptr->Length_Value_Returned);
printf("Decimal pos = %d\n",ptr->Number_Decimal_Positions);
tmp = test_buf;
tmp += sizeof(_Packed struct Qwc_Rdtaa_Data_Returned);
memset(&tmp[bytes],'\0',1);
printf("Content = %s\n",tmp);
return 1;
}


Chris Hird
Director at Shield Advanced Solutions Ltd.

Phone: 519-940-1192  
Mobile: 647-234-6539
Email: chrish@xxxxxxxxxxxxxxxxxx

75 First Street Suite 206
Orangeville, ON L9W 5B6

https://www.shieldadvanced.com





-----Original Message-----
From: C400-L <c400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Patrik Schindler
Sent: September 5, 2025 7:29 AM
To: Bare Metal Programming IBM i (AS/400 and iSeries) <c400-l@xxxxxxxxxxxxxxxxxx>
Subject: [C400-L] Trying to get data area content with QWCRDTAA

Hello,

I'm trying to retrieve the content of a data area with the QWCRDTAA API. It's meant to contain a http proxy URI string for non-PASE applications. I've created it like this:

crtdtaara dtaara(qusrsys/httpproxy) type(*char) len(32) value('http://leela.pocnet.net:3128') aut(*use)


This is the documentation I was using:

https://www.ibm.com/docs/en/i/7.4.0?topic=ssw_ibm_i_74/apis/qwcrdtaa.html


I'm compiling it with the defaults. PDM option 14, plus output(*print) dbgview(*all).

When running the program in question, I'm getting back garbage, such as:

*receiver:c 50 = ' à *CHAR QUSRSYS Ø Ô¼·u´ ø~ '

00000 00000044 00000020 5CC3C8C1 D9404040 - ...à....*CHAR
00010 4040D8E4 E2D9E2E8 E2404040 00000020 - QUSRSYS ....
00020 80000000 00000000 EBB7B3A4 BE001070 - Ø.......Ô¼·u´..ø
00030 A100.... ........ ........ ........ - ß...............

This changes between program calls.

error_code.ec_fields.Exception_Id and error_code.exceptiondata is just blanks.

I understand that the receiver variable (expected to be a string) is really a struct. So, part of the result I'm getting back looks actually valid. But I fail to understand why the proxy URL isn't copied into the receiver variable.

Help and hints are very appreciated!


You can find the actual code I'm trying here:

https://leela.pocnet.net/~poc/getproxy.c

Besides the data area shown at this message's top, there is no external dependency.

Note there is a lot of unused/commented code, and functions not being finally carved out, yet. Also, there might be off-by-one errors in field lengths for the additional terminating zero byte. Will fix that when I eventually see the proxy URI in the debugger.

:wq! PoC

--
This is the Bare Metal Programming IBM i (AS/400 and iSeries) (C400-L) mailing list To post a message email: C400-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/c400-l
or email: C400-L-request@xxxxxxxxxxxxxxxxxx Before posting, please take a moment to review the archives at https://archive.midrange.com/c400-l.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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

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.