|
Hello Frank, I don't know if it's still relevant, but here's an example based on pointer logic - pretty much following the steps outlined by Scott: **-- Header pecifications: --------------------------------------------** H Option( *SrcStmt ) **-- Global declarations: D Idx s 10u 0 D ApiRcvSiz s 10u 0 **-- Api error data structure: D ApiError Ds D AeBytPro 10i 0 Inz( %Size( ApiError )) D AeBytAvl 10i 0 Inz D AeMsgId 7a D 1a D AeMsgDta 128a **-- Journal information: D RJRN0100 Ds Based( pJrnInf ) D RjBytRtn 10i 0 D RjBytAvl 10i 0 D RjOfsKeyInf 10i 0 D RjJrnNam 10a D RjJrnLib 10a D RjASP 10i 0 D RjMsgQnam 10a D RjMsgQlib 10a D RjMngRcvOpt 1a D RjDltRcvOpt 1a D RjRsoRit 1a D RjRsoMfl 1a D RjRsoMo1 1a D RjRsoMo2 1a D RjRsv1 3a D RjJrnTyp 1a D RjRmtJrnTyp 1a D RjJrnStt 1a D RjJrnDlvMod 1a D RjLocJrnNam 10a D RjLocJrnLib 10a D RjLocJrnSys 8a D RjSrcJrnNam 10a D RjSrcJrnLib 10a D RjSrcJrnSys 8a D RjRdrRcvLib 10a D RjJrnTxt 50a D RjMinEntDtaAr 1a D RjMinEntFiles 1a D RjRsv2 9a D RjNbrAtcRcv 10i 0 D RjAtcRcvNam 10a D RjAtcRcvLib 10a D RjAtcLocSys 8a D RjAtcSrcSys 8a D RjAtcRcvNamDu 10a D RjAtcRcvLibDu 10a D RjRsv3 192a D RjNbrKey 10i 0 ** D JrnKey Ds Based( pJrnKey ) D JkKey 10i 0 D JkOfsKeyInf 10i 0 D JkKeyHdrSecLn 10i 0 D JkNbrEnt 10i 0 D JkKeyInfEntLn 10i 0 ** D JrnKeyHdr1 Ds Based( pKeyHdr1 ) D K1RcvNbrTot 10i 0 D K1RcvSizTot 10i 0 D K1RcvSizMtp 10i 0 D K1Rsv 8a ** D JrnKeyEnt1 Ds Based( pKeyEnt1 ) D E1RcvNam 10a D E1RcvLib 10a D E1RcvNbr 5a D E1RcvAtcDts 13a D E1RcvSts 1a D E1RcvSavDts 13a D E1LocJrnSys 8a D E1SrcJrnSys 8a D E1RcvSiz 10i 0 D E1Rsv 56a **-- Journal information specification: D JrnInfRtv Ds D IsNbrVarRcd 10i 0 Inz( 1 ) D IsVarRcdLen 10i 0 Inz( 12 ) D IsKey 10i 0 Inz( 1 ) D IsDtaLen 10i 0 Inz( 0 ) ** D JrnInfRtv2 Ds D I2NbrVarRcd 10i 0 Inz( 1 ) D I2VarRcdLen 10i 0 Inz( 22 ) D I2Key 10i 0 Inz( 2 ) D I2DtaLen 10i 0 Inz( %Size( I2Dta )) D I2Dta D I2JrnObjInf 10a Overlay( I2Dta ) ** D JrnInfRtv3 Ds D I3NbrVarRcd 10i 0 Inz( 1 ) D I3VarRcdLen 10i 0 Inz( 60 ) D I3Key 10i 0 Inz( 3 ) D I3DtaLen 10i 0 Inz( %Size( I3Dta )) D I3Dta D I3RdbDirEinf 18a Overlay( I3Dta ) D I3RmtJrnNam 20a Overlay( I3Dta: *Next ) **-- Receiver information: D RRCV0100 Ds D RrBytRtn 10i 0 D RrBytAvl 10i 0 D RrRcvNam 10a D RrRcvLib 10a D RrJrnNam 10a D RrJrnLib 10a D RrThh 10i 0 D RrSiz 10i 0 D RrASP 10i 0 D RrNbrJrnEnt 10i 0 D RrMaxEspDtaLn 10i 0 D RrMaxNulInd 10i 0 D RrFstSeqNbr 10i 0 D RrMinEntDtaAr 1a D RrMinEntFiles 1a D RrRsv1 2a D RrLstSeqNbr 10i 0 D RrRsv2 10i 0 D RrSts 1a D RrMinFxlVal 1a D RrRcvMaxOpt 1a D RrRsv3 4a D RrAtcDts 13a D RrDtcDts 13a D RrSavDts 13a D RrTxt 50a D RrPndTrn 1a D RrRmtJrnTyp 1a D RrLocJrnNam 10a D RrLocJrnLib 10a D RrLocJrnSys 8a D RrLocRcvLib 10a D RrSrcJrnNam 10a D RrSrcJrnLib 10a D RrSrcJrnSys 8a D RrSrcRcvLib 10a D RrRdcRcvLib 10a D RrDuaRcvNam 10a D RrDuaRcvLib 10a D RrPrvRcvNam 10a D RrPrvRcvLib 10a D RrPrvRcvNamDu 10a D RrPrvRcvLibDu 10a D RrNxtRcvNam 10a D RrNxtRcvLib 10a D RrNxtRcvNamDu 10a D RrNxtRcvLibDu 10a D RrNbrJrnEntL 20s 0 D RrMaxEspDtlL 20s 0 D RrFstSeqNbrL 20s 0 D RrLstSeqNbrL 20s 0 D RrRsv4 60a **-- Retrieve journal information: D RtvJrnInf Pr ExtProc( 'QjoRetrieveJournal- D Information' ) D JiRcvVar 65535a Options( *VarSize ) D JiRcvVarLen 10i 0 Const D JiJrnNam 20a Const D JiFmtNam 8a Const D JiInfRtv 65535a Const Options( *VarSize ) D JiError 32767a Options( *VarSize: *Omit ) **-- Retrieve journal receiver information: D RtvRcvInf Pr ExtProc( 'QjoRtvJrnReceiver- D Information' ) D RiRcvVar 65535a Options( *VarSize ) D RiRcvVarLen 10i 0 Const D RiRcvNam 20a Const D RiFmtNam 8a Const D RiError 32767a Options( *VarSize: *Omit ) /free ApiRcvSiz = 10240; pJrnInf = %Alloc( ApiRcvSiz ); DoU RjBytAvl <= ApiRcvSiz; If RjBytAvl > ApiRcvSiz; ApiRcvSiz = RjBytAvl; pJrnInf = %ReAlloc( pJrnInf: ApiRcvSiz ); EndIf; RtvJrnInf( RJRN0100: ApiRcvSiz: 'jrnname jrnlib': 'RJRN0100' : JrnInfRtv: ApiError ); EndDo; If AeBytAvl = *Zero; ExSr PrcKeyEnt; EndIf; DeAlloc pJrnInf; Return; // Process key entries: BegSr PrcKeyEnt; pJrnKey = pJrnInf + RjOfsKeyInf + %Size( RjNbrKey ); pKeyHdr1 = pJrnKey + JkOfsKeyInf; pKeyEnt1 = pKeyHdr1 + %Size( JrnKeyHdr1 ); For Idx = 1 to JkNbrEnt; RtvRcvInf( RRCV0100: %Size( RRCV0100 ): E1RcvNam + E1RcvLib : 'RRCV0100': ApiError ); If AeBytAvl = *Zero; // Do whatever... EndIf; If Idx < JkNbrEnt; Eval pKeyEnt1 = pKeyEnt1 + JkKeyInfEntLn; EndIf; EndFor; EndSr; /end-free Best regards, Carsten Flensburg ----- Original Message ----- From: <Frank.Kolmann@xxxxxxxxxx> To: <rpg400-l@xxxxxxxxxxxx> Sent: Wednesday, July 07, 2004 5:55 AM Subject: Re: Journal Receiver Names Example. > Thanks for the advice Scott. > I have got the following code to work. > This pointer stuff is pretty simple, I am embarrassed for asking. > I used a MODS to effectively allocate 16 * 64K memory and > I got the API to pass back 1M (approx) of data max. > I then got the addr of the MODS and used based DS to get > the info I want, namely the Receiver names. > I understand I can 'fine tune' the actual size to pass to > the API but as I got a 16 occur DS I dont think its needed. > If the code below has flaws I would appreciate comments > as I am still a bit afraid of pointers, I know its possible to > crash stuff (OS maybe) if pointers go awry. ########################################### This message has been scanned by F-Secure Anti-Virus for Internet Mail. For more information, connect to http://www.F-Secure.com/
As an Amazon Associate we earn from qualifying purchases.
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.