|
Rob wrote:
>At the last calc spec shown the debugger shows a value
>for QUSRTVUSP but no value for GH0100. Why?
>
>...
>D* Retrieve from a user space.
>D QUSRTVUS PR EXTPGM('QUSRTVUS')
>D Spc_Lib 20A CONST
>D Start 10i 0 CONST
>D Length 10i 0 CONST
>D DataRead 32765A VARYING OPTIONS(*VARSIZE)
>D qusrtvusEr LIKE(ERRC0100)
>...
>D QUSRTVUSP S 32765A VARYING
>...
> * List API - Generic Header Format 0100 from 'System API Reference'
>D GH0100 DS
>D GHUser 64A
>D GHGHSize 10i 0
>D GHRelease 4A
>D GHFormat 8A
>...
>D GH0100P S LIKE(GH0100)
>...
>C CALLP QUSRTVUS('JOBLIST QTEMP ':
>C 1:%len(GH0100P):QUSRTVUSP
>C ERRC0100P)
>C eval errc0100=errc0100p
>C if exceptionId<>*blanks
>C return
>C endif
>C eval GH0100=QUSRTVUSP
>
> * Initialize our offset to the offset of the list data.
>C eval CurOffSet=GHListOff
>
>EVAL QUSRTVUSP :X
> 00000 00000000 00000000 00000000 00000000 - ................
> 00010 00000000 00000000 00000000 00000000 - ................
> 00020 00000000 00000000 00000000 00000000 - ................
> 00030 00000000 00000000 00000000 00000000 - ................
> 00040 00000080 F0F1F0F0 D1D6C2D3 F0F1F0F0 - ...Ø0100JOBL0100
> 00050 D8E4E2D3 D1D6C240 4040F1F0 F0F0F2F0 - QUSLJOB 100020
> 00060 F2F0F9F4 F9F4F1C3 00000228 000000C0 - 2094941C.......{
>...
>EVAL GH0100 :X
> 00000 40404040 40404040 40404040 40404040 -
> 00010 40404040 40404040 40404040 40404040 -
> 00020 40404040 40404040 40404040 40404040 -
> 00030 40404040 40404040 40404040 40404040 -
> 00040 40404040 40404040 40404040 40404040 -
> 00050 40404040 40404040 40404040 40404040 -
> 00060 40404040 40404040 40404040 40404040 -
> 00070 40404040 40404040 40404040 40404040 -
> 00080 40404040 40404040 40404040 40404040 -
The value of that user space is retrieved into variable
QUSRTVUSP, which is declared as a character varying
field.
The hex dump of QUSRTVUSP shows zeros in its first two
bytes. This means that RPG considers the value of the
character varying field to be a string of length zero.
When assigned to a fixed length char field, the zero
length value is copied and then padded with blanks,
thus the all blanks value in GH0100.
The problem is that the QUSRTVUS interface returns a
fixed length char string as the 4th parameter, but you
lied to RPG by saying it returns a char varying value.
Cheers! Hans
Hans Boldt, ILE RPG Development, IBM Toronto Lab, boldt@ca.ibm.com
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---
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.