|
<lmejia@...> writes:
Hello, I do this: D JvR03DtaLen 10i 0 Inz( %Size( JvR03Dta )) D JvR03Dta 26a D JvR03DtaDte 26z Overlay( JvR03Dta:01 ) Then JvR03DtaDte = %TimeStamp; And it works
Thanks, I made this change but I still have the same problem. If anyone is feeling particularly altruistic I have pasted the latest incarnation of the program at the bottom of this message. The problem is still as described below. Martin
Saludos, Leonel Mejía Chinchilla Administrador de Seguridad de Sistemas Gerencia de Tecnología y Operaciones Regionales BAC | Credomatic Network Martin Saunders <martin.saunders@...> Sent by: rpg400-l-bounces+lmejia=credomatic.com@... Subject Journal API QjoRetrieveJournalEntries All, I am using the QjoRetrieveJournalEntries API to retrieve some information about what is being printed from our system from the job accounting journal (QACGJRN). The program writes out the details for 38 spooled file/printer combinations to the output file but after this it just loops and increments the page count for these 38 records (looks like it is just retrieving the same journal entries again and again).
**-- Header specifications: --------------------------------------------** H Option(*SrcStmt: *Nodebugio) **-- File specifications: ----------------------------------------------** fIntODF uf a e K Disk fInvDat if e Disk UsrOpn fStrCtlL3 if e K Disk **-- API error data structure: -----------------------------------------** D ApiError Ds D AeBytPrv 10i 0 Inz( %Size( ApiError )) D AeBytAvl 10i 0 D AeECMsgID 7 D AeReserved 1 D AeECMsgDta 240 **-- Global variables: -------------------------------------------------** D Idx s 10i 0 D IntFunction s Like(ODFFct) Inz('PRINT') D KeyStatus s Like(ODFSts) Inz(' ') D KeyValue1 s Like(ODFKy1) D KeyValue2 s Like(ODFKy2) D TotPage s 11 0 D ROLib s 10 Inz('*LIBL') D ApiRcvSiz s 10u 0 D PrvRcvNam s 10a D PrvLibNam s 10a ** **-- Retrieve journal entry data: ----------------------------- D JeRcvVar Ds Align D JhJrnHdr D JhBytRtn 10i 0 Overlay( JhJrnHdr: 1 ) D JhOfsHdrJrnE 10i 0 Overlay( JhJrnHdr: *Next ) D JhNbrEntRtv 10i 0 Overlay( JhJrnHdr: *Next ) D JhConInd 1a Overlay( JhJrnHdr: *Next ) D JhConRcvStr 10a Overlay( JhJrnHdr: *Next ) D JhConLibStr 10a Overlay( JhJrnHdr: *Next ) D JhConSeqNbr 20s 0 Overlay( JhJrnHdr: *Next ) D 11a Overlay( JhJrnHdr: *Next ) D JeData 32754a **-- Entry header: D JeEntHdr Ds Based( pEntHdr ) D JeOfsHdrJrnE 10u 0 D JeOfsNulValI 10u 0 D JeOfsEntDta 10u 0 D JeOfsTrnId 10u 0 D JeOfsLglUoW 10u 0 D JeOfsRcvInf 10u 0 D JeSeqNbr 20u 0 D JeTimStp 20u 0 D JeTimStpC 8a Overlay( JeTimStp ) D JeThrId 20u 0 D JeSysSeqNbr 20u 0 D JeCntRrn 20u 0 D JeCmtCclId 20u 0 D JePtrHdl 10u 0 D JeRmtPort 5u 0 D JeArmNbr 5u 0 D JePgmLibAsp 5u 0 D JeRmtAdr 16a D JeJrnCde 1a D JeEntTyp 2a D JeJobNam 10a D JeUsrNam 10a D JeJobNbr 6a D JePgmNam 10a D JePgmLib 10a D JePgmLibAspDv 10a D JeObject 30a D JeUsrPrf 10a D JeJrnId 10a D JeAdrFam 1a D JeSysNam 8a D JeIndFlg 1a D JeObjNamInd 1a D JeBitFld 1a D JeRsv 9a ** **-- Null values - *VARLEN: D JeNulValVar Ds Based( pNulVal ) D JnNulValLen 10i 0 D JnNulValIndV 512a **-- Null values - length: D JeNulValLen Ds Based( pNulVal ) D JnNulValIndL 512a **-- Entry data: D JeEntDta Ds Based( pEntDta ) D JdEntDtaLen 5s 0 D 11a D JdEntDta 4096a d JdJobName 10 Overlay(JdEntDta) d JdJobUser 10 Overlay(JdEntDta: *Next) d JdJobNum 6S 0 Overlay(JdEntDta: *Next) d JdAcgCde 15 Overlay(JdEntDta: *Next) d JdDevFil 10 Overlay(JdEntDta: *Next) d JdDevFilLib 10 Overlay(JdEntDta: *Next) d JdDevName 10 Overlay(JdEntDta: *Next) d JdDevType 4 Overlay(JdEntDta: *Next) d JdDevModel 4 Overlay(JdEntDta: *Next) d JdNumPages 11P 0 Overlay(JdEntDta: *Next) d JdNumLines 11P 0 Overlay(JdEntDta: *Next) d JdSplFil 10 Overlay(JdEntDta: *Next) d JdSplFilNum 4 Overlay(JdEntDta: *Next) d JdOutPty 1 Overlay(JdEntDta: *Next) d JdFrmType 10 Overlay(JdEntDta: *Next) d JdTotBytes 15P 0 Overlay(JdEntDta: *Next) d JdUserData 10 Overlay(JdEntDta: *Next) **-- Interface data D Ds D ODFDta 251 D ODFDtaID 2 Overlay(ODFDta) D ODFYear 2 Overlay(ODFDta: *Next) D ODFWeek 2 Overlay(ODFDta: *Next) D ODFStr 3 Overlay(ODFDta: *Next) D ODFUser 10 Overlay(ODFDta: *Next) D ODFFile 10 Overlay(ODFDta: *Next) D ODFFileName 50 Overlay(ODFDta: *Next) D ODFPrinter 10 Overlay(ODFDta: *Next) D ODFTotPage 11 Overlay(ODFDta: *Next) **-- Today's date D Ds D Today 1 7 0 D DatCen 1 1 0 D DatCur 2 7 0 **-- Logical unit of work: D JeLglUoW Ds Based( pLglUow ) D JuLglUoW 39a **-- Receiver information: D JeRcvInf Ds Based( pRcvInf ) D JrRcvNam 10a D JrRcvLib 10a D JrRcvLibAspDv 10a D JrRcvLibAspNb 5i 0 ** **-- Retrieve journal entry selection records: -------------- D JrnEntRtv Ds D JeNbrVarRcd 10i 0 **-- RCVRNG - *CURRENT, *CURCHAIN D JrnVarR01 Ds D JvR01RcdLen 10i 0 Inz( %Size( JrnVarR01 )) D JvR01Key 10i 0 Inz( 1 ) D JvR01DtaLen 10i 0 Inz( %Size( JvR01Dta )) D JvR01Dta 40a D JvR01RcvStr 10a Overlay( JvR01Dta: 1 ) D JvR01LibStr 10a Overlay( JvR01Dta: *Next ) D JvR01RcvEnd 10a Overlay( JvR01Dta: *Next ) D JvR01LibEnd 10a Overlay( JvR01Dta: *Next ) **-- FROMENT - *FIRST D JrnVarR02 Ds D JvR02RcdLen 10i 0 Inz( %Size( JrnVarR02 )) D JvR02Key 10i 0 Inz( 2 ) D JvR02DtaLen 10i 0 Inz( %Size( JvR02Dta )) D JvR02Dta 20a Inz( '*FIRST' ) D JvR02SeqNbr 20s 0 Overlay( JvR02Dta ) **-- FROMTIME D JrnVarR03 Ds D JvR03RcdLen 10i 0 Inz( %Size( JrnVarR03 )) D JvR03Key 10i 0 Inz( 3 ) D JvR03DtaLen 10i 0 Inz( %Size( JvR03Dta )) D JvR03Dta 26a D JvR03Time z Overlay(JvR03Dta) **-- TOENT - *LAST D JrnVarR04 Ds D JvR04RcdLen 10i 0 Inz( %Size( JrnVarR04 )) D JvR04Key 10i 0 Inz( 4 ) D JvR04DtaLen 10i 0 Inz( %Size( JvR04Dta )) D JvR04Dta 20a Inz( '*LAST' ) **-- TOTIME D JrnVarR05 Ds D JvR05RcdLen 10i 0 Inz( %Size( JrnVarR05 )) D JvR05Key 10i 0 Inz( 5 ) D JvR05DtaLen 10i 0 Inz( %Size( JvR05Dta )) D JvR05Dta 26a D JvR05Time z Overlay(JvR05Dta) **-- NBRENT D JrnVarR06 Ds D JvR06RcdLen 10i 0 Inz( %Size( JrnVarR06 )) D JvR06Key 10i 0 Inz( 6 ) D JvR06DtaLen 10i 0 Inz( %Size( JvR06Dta )) D JvR06Dta 10i 0 Inz( 1000 ) **-- JRNCDE - *ALL, *CTL / *ALLSLT, *IGNFILSLT D JrnVarR07 Ds D JvR07RcdLen 10i 0 Inz( %Size( JrnVarR07 )) D JvR07Key 10i 0 Inz( 7 ) D JvR07DtaLen 10i 0 Inz( %Size( JvR07Dta )) D JvR07Dta D JcNbrCod 10i 0 Overlay( JvR07Dta: 1 ) D JcJrnCod 20a Overlay( JvR07Dta: *Next ) D Dim( 16 ) D JcJrnCodVal 10a Overlay( JcJrnCod: 1 ) D JcJrnCodSlt 10a Overlay( JcJrnCod: *Next ) **-- ENTTYP - *ALL, *RCD D JrnVarR08 Ds D JvR08RcdLen 10i 0 Inz( %Size( JrnVarR08 )) D JvR08Key 10i 0 Inz( 8 ) D JvR08DtaLen 10i 0 Inz( %Size( JvR08Dta )) D JvR08Dta D JcNbrTyp 10i 0 Overlay( JvR08Dta: 1 ) D JcEntTyp 10a Overlay( JvR08Dta: *Next ) D Dim( 16 ) **-- JOB - *ALL D JrnVarR09 Ds D JvR09RcdLen 10i 0 Inz( %Size( JrnVarR09 )) D JvR09Key 10i 0 Inz( 9 ) D JvR09DtaLen 10i 0 Inz( %Size( JvR09Dta )) D JvR09Dta 26a Inz( '*ALL' ) **-- PGM - *ALL D JrnVarR10 Ds D JvR10RcdLen 10i 0 Inz( %Size( JrnVarR10 )) D JvR10Key 10i 0 Inz( 10 ) D JvR10DtaLen 10i 0 Inz( %Size( JvR10Dta )) D JvR10Dta 10a Inz( '*ALL' ) **-- USRPRF * *ALL D JrnVarR11 Ds D JvR11RcdLen 10i 0 Inz( %Size( JrnVarR11 )) D JvR11Key 10i 0 Inz( 11 ) D JvR11DtaLen 10i 0 Inz( %Size( JvR11Dta )) D JvR11Dta 10a Inz( '*ALL' ) **-- CMTCYCID - *ALL D JrnVarR12 Ds D JvR12RcdLen 10i 0 Inz( %Size( JrnVarR12 )) D JvR12Key 10i 0 Inz( 12 ) D JvR12DtaLen 10i 0 Inz( %Size( JvR12Dta )) D JvR12Dta 20a Inz( '*ALL' ) **-- DEPENT - *ALL, *NONE D JrnVarR13 Ds D JvR13RcdLen 10i 0 Inz( %Size( JrnVarR13 )) D JvR13Key 10i 0 Inz( 13 ) D JvR13DtaLen 10i 0 Inz( %Size( JvR13Dta )) D JvR13Dta 10a Inz( '*ALL' ) **-- INCENT - *CONFIRMED, *ALL D JrnVarR14 Ds D JvR14RcdLen 10i 0 Inz( %Size( JrnVarR14 )) D JvR14Key 10i 0 Inz( 14 ) D JvR14DtaLen 10i 0 Inz( %Size( JvR14Dta )) D JvR14Dta 10a Inz( '*CONFIRMED' ) **-- NULLINDLEN - *VARLEN D JrnVarR15 Ds D JvR15RcdLen 10i 0 Inz( %Size( JrnVarR15 )) D JvR15Key 10i 0 Inz( 15 ) D JvR15DtaLen 10i 0 Inz( %Size( JvR15Dta )) D JvR15Dta 10a Inz( '*VARLEN' ) **-- FILE - *ALLFILE, *ALL D JrnVarR16 Ds D JvR16RcdLen 10i 0 Inz( %Size( JrnVarR16 )) D JvR16Key 10i 0 Inz( 16 ) D JvR16DtaLen 10i 0 Inz( %Size( JvR01Dta )) D JvR16Dta D JcNbrFil 10i 0 Overlay( JvR16Dta: 1 ) D JcFilNamQ 30a Overlay( JvR16Dta: *Next ) D Dim( 16 ) D JfFilNam 10a Overlay( JcFilNamQ: 1 ) D JfLibNam 10a Overlay( JcFilNamQ: *Next ) D JfMbrNam 10a Overlay( JcFilNamQ: *Next ) **-- 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 E1AtcCYMD 7a Overlay(E1RcvAtcDts) 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 ) ** **-- Retrieve Object Description Details: ------------------- D ObjDDS DS D ObBytRtn 10i 0 D ObBytAvl 10i 0 D ObjName 10 D ObjLib 10 D ObjType 10 D ObjRtnLib 10 D ObjAuxStg 10i 0 D ObjOwn 10 D ObjDmn 2 D ObjCrtDat 13 D ObjChgDat 13 D ObjExtAtr 10 D ObjText 50 D ObjSrcFil 10 D ObjSrcLib 10 D ObjSrcMbr 10 **-- *Entry parameters: -------------------------------------------------** D SPL001 Pr ExtPgm('SPL001') D 7 0 D 7 0 D 2 0 D 2 0 ** D SPL001 PI D FromDate 7 0 D ToDate 7 0 D Year 2 0 D Week 2 0 ** **-- Retrieve journal entries: -----------------------------------------** D RtvJrnE Pr ExtProc( 'QjoRetrieveJournalEntries') D RjRcvVar 32767a Options( *VarSize ) D RjRcvVarLen 10i 0 Const D RjJrnNamQ 20a Const D RjRcvInfFmt 8a Const D RjSltInf 32767a Const Options( *Omit: *VarSize ) D RjError 32767a Options( *Omit: *VarSize ) **-- Delete pointer handle: --------------------------------------------** D DltPtrHdl Pr ExtProc( 'QjoDeletePointerHandle' ) D DhPtrHdl 10u 0 Const D DhError 32767a Options( *NoPass: *VarSize ) **-- Retrieve Object Description: ---------------------------------------** D RtvObjD Pr ExtPgm('QUSROBJD') D RORcvVar 32767a Options( *VarSize ) D RORcvVarLen 10i 0 Const D RORcvInfFmt 8a Const D ROQualObj 20a Const D ROObjType 10a Const D ROError 32767a Options( *Omit: *VarSize ) **-- Retrieve Journal Info: ---------------------------------------------** 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 ) ** **-- Mainline: ---------------------------------------------------------** ** /Free ExSR GetRcvRange; Open InvDat; Read InvDat; Close InvDat; JcNbrTyp = 1; JcEntTyp(1) = 'SP'; JvR03Dta = %TimeStamp(%Date(FromDate: *CYMD)); JvR05Dta = %TimeStamp(%Date(ToDate: *CYMD)); JeNbrVarRcd = 4; DoU JhConInd = '0' or AeBytAvl > *Zero; RtvJrnE( JeRcvVar: %Size(JeRcvVar): 'QACGJRN *LIBL ': 'RJNE0200': JrnEntRtv + JrnVarR01 + JrnVarR03 + JrnVarR05 + JrnVarR08: ApiError); If AeBytAvl = *Zero; pEntHdr = %Addr(JeRcvVar) + JhOfsHdrJrnE; For Idx = 1 to JhNbrEntRtv; ExSr PrcLstEnt; If JePtrHdl > *Zero; CallP(e) DltPtrHdl(JePtrHdl); EndIf; If Idx < JhNbrEntRtv; pEntHdr = pEntHdr + JeOfsHdrJrnE; EndIf; EndFor; If JhConInd = '1'; JvR01RcvStr = JhConRcvStr; JvR01LibStr = JhConLibStr; JvR01RcvEnd = '*CURRENT'; JvR02SeqNbr = JhConSeqNbr; EndIf; EndIf; EndDo; *InLR = *On; Return; // Process list entry: -----------------------------------------------** BegSr PrcLstEnt; pEntDta = pEntHdr + JeOfsEntDta; If JeOfsNulValI > *Zero; pNulVal = pEntHdr + JeOfsNulValI; EndIf; If JeOfsLglUoW > *Zero; pLglUow = pEntHdr + JeOfsLglUoW; EndIf; If JeOfsRcvInf > *Zero; pRcvInf = pEntHdr + JeOfsRcvInf; EndIf; If JdDevFil <> 'BCD020P' and JdDevName <> *Blanks and JdNumPages > 0; KeyValue1 = %EditC(Year: 'X') + %EditC(Week: 'X') + %Trim(JdJobUser); KeyValue2 = %Trim(JdDevFil) + %Subst(JdDevName: 1: 5); Chain (IntFunction: KeyStatus: KeyValue1: KeyValue2) IntODF; If %Found(IntODF); TotPage = %Dec(ODFTotPage: 11: 0); TotPage += JdNumPages; ODFTotPage = %EditC(TotPage: 'X'); Update RIntODF; Else; // Get the Report Description RtvObjD(ObjDDS: %Size(ObjDDS): 'OBJD0200': JdDevFil + ROLib: '*FILE': APIError); ODFStr = '000'; CtlUS3 = %Subst(JdDevName: 1: 5); Chain (CtlUS3) StrCtlL3; If %Found(StrCtlL3); ODFStr = %EditC(CtlStN: 'X'); EndIf; ODFFct = IntFunction; ODFSts = KeyStatus; ODFKy1 = KeyValue1; ODFKy2 = KeyValue2; ODFDID = 'SP'; ODFDtaID = ODFDID; ODFUser = JdJobUser; ODFYear = %EditC(Year:'X'); ODFWeek = %EditC(Week:'X'); ODFFile = JdDevFil; ODFFileName = ObjText; ODFPrinter = JdDevName; ODFTotPage = %EditC(JdNumPages: 'X'); ODFCDT = Today; ODFCTM = %Dec(%Char(%Time(): *HMS0): 6: 0); Write RIntODF; EndIf; EndIf; EndSr; // Get Receiver Range: -----------------------------------------------** BegSr GetRcvRange; ApiRcvSiz = 10240; pJrnInf = %Alloc(ApiRcvSiz); DoU RjBytAvl <= ApiRcvSiz; If RjBytAvl > ApiRcvSiz; ApiRcvSiz = RjBytAvl; pJrnInf = %ReAlloc(pJrnInf: ApiRcvSiz); EndIf; RtvJrnInf(RJRN0100: ApiRcvSiz: 'QACGJRN *LIBL ': 'RJRN0100': JrnInfRtv: ApiError); EndDo; If AeBytAvl = *Zero; pJrnKey = pJrnInf + RjOfsKeyInf + %Size(RjNbrKey); pKeyHdr1 = pJrnKey + JkOfsKeyInf; pKeyEnt1 = pKeyHdr1 + %Size(JrnKeyHdr1); For Idx = 1 to JkNbrEnt; If %Dec(E1AtcCYMD: 7: 0) >= FromDate; JvR01RcvStr = PrvRcvNam; JvR01LibStr = PrvLibNam; Leave; Else; PrvRcvNam = E1RcvNam; PrvLibNam = E1RcvLib; EndIf; If Idx < JkNbrEnt; pKeyEnt1 = pKeyEnt1 + JkKeyInfEntLn; EndIf; EndFor; EndIf; JvR01RcvEnd = RjAtcRcvNam; JvR01LibEnd = RjAtcRcvLib; EndSr; /End-Free
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.