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



Since I'm not sure whether this is an RPG problem or a lack of understanding
about receiving journal entries with RCVJRNE, I'm not sure where to post
this, so i'm posting to both Midrange-L and RPG400-L.

My system is on V5R1.

I'm experimenting with using RCVJRNE to process the 'CO' journal entries
from the system audit journal (QAUDJRN).  The goal:  I want to detect when a
file gets created in the IFS.

For this test, the stream file I created was '/home/SJL/source16.txt'

As usual, the IBM documentation is about as clear as mud and stored in
several different places (B&R guide, Security Guide, etc.).  I'm about to
pull my hair out (if you know me, that's funny because you know how much
hair I have left...).

I used some sample code that I received from another member (thanks,
Carsten)  to construct this program.  However, it was for file journal
entries, *not* 'CO' entries.  I *thought* (there I go, thinking again) that
I could just use the system-supplied outfile for *TYPE4 entries in my
program as the receiver (parameter 1) for these entries, since it matches
the layout of the buffer described in the above-mentioned guides.

However, it appears that things aren't mapped properly into this buffer
area.  Everything beyond  the system name (COSYNM) seems to be improperly
mapped.

Are the variable-length fields hosing me up?

In the field named CORESA (see below),
I see this value: '00000811N*N        *N        *STMF           '.

The 00000811 probably should have been mapped to the field COESDL
(Entry-specific data length).  The First 'N' should have been mapped to
COETYP (Type of Entry).   The first '*N' should have been mapped to COONAM
(Object Name), the second '*N' should have been mapped to COOLIB (Library
Name), and the value '*STMF' should have been mapped to COOTYP (Object
Type)....and so on.

When I run the RPG program in debug, here is what the DSType4 data structure
looks like for the 'CO' journal corresponding to the creation of this file:

COENTL OF DSTYPE4 = 00990.
COSEQN OF DSTYPE4 = 0001918049.
COCODE OF DSTYPE4 = 'T'
COENTT OF DSTYPE4 = 'CO'
COTSTP OF DSTYPE4 = '2003-12-09-00.54.31.101728'
COJOB OF DSTYPE4 = 'QPADEV9999'
COUSER OF DSTYPE4 = 'SJL       '
CONBR OF DSTYPE4 = 013891.
COPGM OF DSTYPE4 = 'QCMD      '
CORES1 OF DSTYPE4 = '                              000000000000000000000'
COUSPF OF DSTYPE4 = 'SJL       '
COSYNM OF DSTYPE4 = 'BUBBA   '
CORES2 OF DSTYPE4 = '          00000     '
CORESA OF DSTYPE4 = '00000811N*N        *N        *STMF                  '
COESDL OF DSTYPE4 = 6448.
COETYP OF DSTYPE4 = ' '
COONAM OF DSTYPE4 = '          '
COOLIB OF DSTYPE4 = '          '
COOTYP OF DSTYPE4 = '        '
CORES3 OF DSTYPE4 = '                    '
COOUSR OF DSTYPE4 = '          '
COODLO OF DSTYPE4 = '            '
CORES4 OF DSTYPE4 = '        '
COOFLR OF DSTYPE4 =
          ....5...10...15...20...25...30...35...40...45...50...55...60
     1   '                                                    ^USENU  '
    61   '   '
COOBUS OF DSTYPE4 = '      e9î°'
CORES5 OF DSTYPE4 = '   Ò        e9îx  '
COOLEN OF DSTYPE4 = 4600.
COCCID OF DSTYPE4 = 36751.
COCNTY OF DSTYPE4 = ' Í'
COLANG OF DSTYPE4 = ' Ê '
CORES6 OF DSTYPE4 = 'Ä Á'
COPFID OF DSTYPE4 = '       È Ì È    '
COOFID OF DSTYPE4 = '                '
COOBJN OF DSTYPE4 =
          ....5...10...15...20...25...30...35...40...45...50...55...60
     1   '                                                            '
    61   '                                                            '
   121   '                                                            '
   181   '                                                            '
   241   '                                                            '
   301   '                                                            '
   361   '                                                            '
   421   '                                                        e9îx'
   481   '  - QASP01    00001    USENU  Y '
COOID OF DSTYPE4 = '                '
COASP OF DSTYPE4 = ' /home/SJL'
COASPN OF DSTYPE4 = '/sour'
COPCCI OF DSTYPE4 = -73770.
COPCNT OF DSTYPE4 = '.t'
COPLAN OF DSTYPE4 = 'xt0'
COPNLN OF DSTYPE4 = -3856.
COAPIN OF DSTYPE4 = '0'
CORPFI OF DSTYPE4 = '0               '
COPNM OF DSTYPE4 =
          ....5...10...15...20...25...30...35...40...45...50...55...60
     1   '                                                            '
(this field is blank)

Here is the source for the CL and RPG programs:

******* CL program source ***********

 Pgm

/*-- Global variables:  ---------------------------------------------*/
     Dcl        &JrnSeqNbr   *Dec     10
     Dcl        &JrnExit     *Char    10     'RCVAUDJE'
     Dcl        &JrnSeqDta   *Char    10     'RCVJRNE '
     Dcl        &JrnNam      *Char    10     'QAUDJRN '
     Dcl        &JrnLib      *Char    10     '*LIBL   '

     MonMsg     CPF0000      *N       GoTo Error


/*-- Journal entry date format *TYPE2 = *JOB --*/
     ChgJob     DatFmt( *YMD )

     RtvDtaAra  &JrnSeqDta     RtnVar( &JrnSeqNbr )
     ChgVar     &JrnSeqNbr   ( &JrnSeqNbr + 1 )

 RcvJrnE:
             RCVJRNE    JRN(&JRNLIB/&JRNNAM) EXITPGM(&JRNEXIT) +
                          RCVRNG(*CURCHAIN) FROMENT(&JRNSEQNBR) +
                          JRNCDE(*ALL) ENTTYP(CO) ENTFMT(*TYPE4) +
                          DELAY(*NEXTENT 25)

     MonMsg     CPF7054          *N   Do
     RcvMsg     MsgType( *EXCP )  Rmv( *YES )

/*-- From entry not found - get first entry in current receiver --*/
     RtvJrnE    Jrn( &JrnLib/&JrnNam )      +
                File( *ALLFILE )            +
                RcvRng( *CURRENT )          +
                FromEnt( *FIRST )           +
                RtnSeqNbr( &JrnSeqNbr )

     GoTo       RcvJrnE
     EndDo

 Return:
     Return

/*-- Error handling:  -----------------------------------------------*/
 Error:
     Call       QMHMOVPM    ( '    '                                 +
                              '*DIAG'                                +
                              x'00000001'                            +
                              '*PGMBDY'                              +
                              x'00000001'                            +
                              x'0000000800000000'                    +
                            )

     Call       QMHRSNEM    ( '    '                                 +
                              x'0000000800000000'                    +
                            )

 EndPgm:
     EndPgm

**************** RPG program source **********************

     **  Program . . : RCVAUDJE
     **  Description : Receive 'CO' *TYPE4
     **                journal entry exit program
     **
     **-- Parm 1:
     D DSType4       E Ds                  ExtName( QASYCOJ4 )
      *
     **-- Parm 2:
     D JOCOM           Ds
     D  JOCTL                         1a
     D  JOENTAVL                      1a
     D  JOENTPAS                      1a
      *
      *-- JOCTL - journal control:
     D  NoEnt          c                   '0'
     D  SngEnt         c                   '1'
     D  BlkEnt         c                   '2'
     D  RcvChgEnd      c                   '3'
     D  BegBlkMod      c                   '8'
     D  EndRcvJrnE     c                   '9'
      *
     **-- JOCODE - journal code:
     D  RcdTyp         c                   'R'
     D  AudTyp         c                   'T'
      *
     **-- Current journal entry sequence number:  ----**
     D CurSeqNbr       s             10s 0 DtaAra( RCVJRNE )
      *
     **-----------------------------------------------------**
     **-- Parameters:
     C     *Entry        Plist
     C                   Parm                    DSType4
     C                   Parm                    JOCOM
     **-- Mainline:
     C                   If        JOCTL      =  SngEnt        And
     C                             COCODE     =  AuDTyp
     **
     C                   Select
     C                   When      (COENTT = 'CO') and (COOTYP  = '*STMF')
     C     'Entry Type'  DSPLY                   COENTT
     C     'Entry Lngth' DSPLY                   COENTL
     C                   EndSl
     **
     C                   ExSr      UpdSeqNbr
     C                   EndIf
     **
     C                   ExSr      ChkEndRqs
     C                   Clear                   DSType4
     **
     C                   Return
      *
     **-- Update journal sequence number:  -----------------**
     C     UpdSeqNbr     BegSr
     C     *Lock         In        CurSeqNbr
     C                   Eval      CurSeqNbr  =  COSEQN
     C                   Out       CurSeqNbr
     C                   EndSr
      *
     **-- Check pending endjob request:  -------------------**
     C     ChkEndRqs     BegSr
     C                   If        %Shtdn
     C                   Eval      JOCTL      =  EndRcvJrnE
     C                   Eval      *InLr      =  *On
     C                   EndIf
     C                   EndSr


As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.