× 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.



Thanks for replying Scott. I did as you suggested create my own verion of
the QUSEC data structure and primed the Bytes Provided field which did the
trick and corrected the error. I definitely agree on your CALLB
suggestion as I do have a prototyped and free form version. I had just
been taking stabs at preventing the error and reverting to the old style
code was a failed effort to do so.



Scott Klement <midrange-l@xxxxxxxxxxxxxxxx> wrote on 05/14/2012 12:35:57
PM:

From: Scott Klement <midrange-l@xxxxxxxxxxxxxxxx>
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>,
Cc: mgarrison@xxxxxxxxxx
Date: 05/14/2012 12:36 PM
Subject: Re: API QcstListClusterResourceGroupIn error

Hi there,

You need to set (at a minimum) the QUSBPRV field of QUSEC before you use

it. It must either be set to 0 or the size of the QUSEC structure before

calling API_DltUsrSpc(). (You are currently clearing it in the GETCRG
subroutine, but that's after you use it!)

Also, if you want to use QUSEC properly (instead of just a success/fail
flag) you will need to define your own copy, since the IBM-supplied DS
doesn't have a subfield defined to accept the message data variables.
(Sorry, but.. IBM's definition is really yucky.)

Also... please consider replacing the CALLB operations with prototypes.
Not only will that make your code look more consistent (always a good
thing) but it'll also make errors easier to catch, and the code more
maintainable. Oh yeah, and it won't look like it was written for V3R1!
(Which was the _only_ release where CALLB made sense!)

But, those are style issues, not functional issues... the functional
issue seems to be that QUSEC isn't initialized before you use it.


On 5/14/2012 9:02 AM, mgarrison@xxxxxxxxxx wrote:
I have written a program to try and retrieve the Current Node's Role
in a
HA Cluster. I need to know if the current system is the Primary
system or
a Backup System. When running the program I am receiving the
following
error when executing the QcstListClusterResourceGroupIn. Can anyone
tell
me what I am doing wrong as I have spent a lot of time looking at it
and I
just don't see the problem.

Additional Message Information

Message ID . . . . . . : CPF3CF1 Severity . . . . . . . : 40
Message type . . . . . : Diagnostic
Date sent . . . . . . : 05/14/12 Time sent . . . . . . :
07:54:18

Message . . . . : Error code parameter not valid.
Cause . . . . . : The format of the error code parameter is not
correct.
Recovery . . . : Correct the error code parameter and try the
request

again. If you do not know the correct format for the error code
parameter,
see the APIs topic collection in the Programming category in the
i5/OS

Information Center, http://www.ibm.com/systems/i/infocenter/.


The code for the program is as follows:

H/include *libl/UTILSRC,GugIHSpec

*š Create user space API
D API_CreateUserSpace...
D pr extpgm( 'QUSCRTUS' )
D SpcNamQ 20a const
D ExtAtr 10a const
D InzSiz 10i 0 const
D InzVal 1a const
D PubAut 10a const
D Text 50a Const
D Replace 10a Const Options( *NoPass )
D Error 32767a Options( *NoPass:
*VarSize )
D Domain 10a Const Options( *NoPass )

*š Delete User Space API
D API_DltUsrSpc pr extpgm( 'QUSDLTUS' )
D SpcNamQ 20a const
D Error 32767a options( *varsize )

*š Retrieve User Space API
D API_RtvUsrSpc pr extpgm( 'QUSRTVUS' )
D iSpcNamQ 20a const
D iStartPos 10i 0 const
D iDataLength 10i 0 const
D oRcvVar 32767a options( *varsize )
D ioErrorCode 32767a options( *varsize )

*š API error data structure
D dsLRGI0100 ds
D NodeId 8a
D CurrNodeRole 10i 0
D MemberStatus 10i 0
D PreferredRole 10i 0

*š Cluster Resource Group data structure
D dsCRGinfoUsrSpc...
D ds qualified
D USRSPC_Q 20a inz( '#RTVCRGLSTGUSYS ')
D EXT_ATR 1a inz( ' ' )
D USP_SIZ 10i 0 inz( 65535 )
D INZ_VAL 1a inz( x'00' )
D PUB_AUT 10a inz( '*CHANGE' )
D TXT_DSC 50a inz( 'List Cluster
Resource
Group' )
D USP_RPL 10a inz( '*YES' )

D ds
D vResultsInfo 30a inz
D vResultsQue 10a overlay( vResultsInfo : 1
)
D vResultsLib 10a overlay( vResultsInfo :
*next
)
D vResultsRsv 10a overlay( vResultsInfo :
*next
)
D inz( *loval )

*š Stand-alone variable definitions
D vClusterName s 10a inz
D vCRGName s 10a inz( ' ' )
D vFormatName s 8a inz( 'LRGI0100' )
D vReqHandle s 16a inz
D vRtvCluVarLen s 10i 0 inz
D vRtvCluFormat s 8a inz( 'RCLI0100' )
D vUserSpace s 20a inz

D/copy QSYSINC/QRPGLESRC,QCSTCTL1
D/copy QSYSINC/QRPGLESRC,QCSTCRG3
D/copy QSYSINC/QRPGLESRC,QUSEC

/free

//š Set SQL options
exec sql set option commit = *none, alwcpydta = *optimize,
closqlcsr = *endmod, DLYPRP = *yes, datfmt = *iso, TIMFMT =
*iso;

//š Delete any previous User Space for Cluster Resource Group
API_DltUsrSpc( dsCRGinfoUsrSpc : QUSEC );

//š Create User Space for Cluster Resource Group
API_CreateUserSpace( dsCRGinfoUsrSpc.USRSPC_Q
: dsCRGinfoUsrSpc.EXT_ATR : dsCRGinfoUsrSpc.USP_SIZ
: dsCRGinfoUsrSpc.INZ_VAL : dsCRGinfoUsrSpc.PUB_AUT
: dsCRGinfoUsrSpc.TXT_DSC : dsCRGinfoUsrSpc.USP_RPL
: QUSEC );

vUserSpace = dsCRGinfoUsrSpc.USRSPC_Q ;
exsr GETCRG ;

//š Retrieve the User Space for Cluster Resource Group

//š Delete any previous User Space for Cluster Resource Group
API_DltUsrSpc( dsCRGinfoUsrSpc : QUSEC );

*inlr = *on ;
return ;

/end-free

C GETCRG begsr

C clear QUSEC
C eval vRtvCluVarLen = %len(QCSI010001)

C callb QCSTRCI
C parm QCSI010001
C parm vRtvCluVarLen
C parm vRtvCluFormat
C parm QUSEC

C clear QUSEC

C eval vClusterName = QCSCN03
C callb QCSTLCRG
C parm vReqHandle
C parm vUserSpace
C parm vFormatName
C parm vClusterName
C parm vCRGName
C parm vResultsInfo
C parm QUSEC

C endsr




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.