Link to home
Start Free TrialLog in
Avatar of Denton Wei
Denton Wei

asked on

About AS/400 's command RCVJRNE and the RPG's file to get the entries

I research the official document about commands RCVJRNE and QSNDDTAQ in the IBM knowledge center. But I just find the introduce about the parameter.
The example is just simple and doesn't contain that send data to data queue using RCVJRNE. So please help me.
The follow is the RPG file.
     DDQNAME           S             10A   INZ('DTAQTEST')
     DDQLIB            S             10A   INZ('xxxxxxxxx')
     DDQSNDLEN         S              5  0 INZ(100)
     DDATLEN           S              3  0 INZ(0)
     DDATKEY           S             10A
     DASYREQ           S             10A   INZ('*NO')
     DDATJRN           S             10A   INZ('*YES')
     DDQSNDDATA        S            100A
     D*
     DDQLEN            S              5  0
     DDQTYPE           S              1A
     D*
     C*************************************
     C* Main Logic
     C*************************************
     C*
     C     *ENTRY        PLIST
     C                   PARM                    DQSNDDATA
     C                   PARM                    DQTYPE
     C
     C                   CALL      'QSNDDTAQ'
     C                   PARM                    DQNAME
     C                   PARM                    DQLIB
     C                   PARM                    DQSNDLEN
     C                   PARM                    DQSNDDATA
     C                   PARM                    DATLEN
     C                   PARM                    DATKEY
     C                   PARM                    ASYREQ
     C                   PARM                    DATJRN
     C*
     C                   SETON                                        LR
     C

Open in new window

(My English is not good. If my grammar is wrong, please point out).
Capture.JPG
Avatar of Member_2_276102
Member_2_276102

I don't see anything obvious in the code. The image shows a basic set of joblog messages, but it doesn't show the detail from the CPF9521 error message. The detail should give a more specific indication. We'd know more if you show us the message detail.

A CPF9521 generally means that the data queue wasn't created appropriately to hold these journal entries. Can you show the statements that created the data queue? Also, please show the creation attributes of the data queue that is being journaled. The attributes should match. (If you cannot show attributes of one of the data queues, we still might guess how this data queue should be defined as long as one is shown.)
Avatar of Gary Patterson, CISSP
Based on the code above, the data queue should be of CHAR type and 100 bytes long.
Avatar of Denton Wei

ASKER

I'm sorry to report comment...
My fault, please forgive me!

Thank you very much!
And I uploaded two pictures about the details of CRTDTAQ and error messages.
If I made some changes on the  RPG file, like the follow. It was successful.
DDQNAME           S             10A   INZ('DTAQTEST')     
DDQLIB            S             10A   INZ('HTXA23004')    
DDQSNDLEN         S              5  0 INZ(200)                                  
DDQSNDDATA        S            200A                       
D*                                                        
DDQLEN            S              5  0                     
DDQTYPE           S              1A                       
D*                                                        
C*************************************                                  
C* Main Logic                                                           
C*************************************                                  
C*                                                                      
C     *ENTRY        PLIST                                               
C                   PARM                    DQSNDDATA                   
C                   PARM                    DQTYPE                      
C                                                                       
C                   CALL      'QSNDDTAQ'                                
C                   PARM                    DQNAME                      
C                   PARM                    DQLIB                       
C                   PARM                    DQSNDLEN                    
C                   PARM                    DQSNDDATA                   
C                                                                       
C                   SETON                                        LR     
C                                                

Open in new window

CRTDTAQ_detail.JPG
Joblog_detail.JPG
Joblog_detail_2.JPG
Why create a data queue with a max entry length of 64K when you just need 200 bytes in your program?  System will allocate 64K for each entry, even if you just use 200 bytes each time, so your data queue will grow very fast, and you will be very limited in the number of entries that can be stored.

https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_71/rbam6/mangq.htm
First as Gary noted, 64K does not appear to be the correct size. You are using first (100) and second (200) as the *DTAQ entry size when calling QSNDDTAQ. Neither of those values should be used; you should be using the 'Data length' field from the RCVJRNE journal entry data. If the original *DTAQ was created as MAXLEN(100), then the data returned by RCVJRNE has a good chance of being up to (116) bytes long, and all (116) bytes probably should be passed to QSNDDTAQ.

I can't tell if the journaled *DTAQ was keyed or not, but the basic handling is similar for both. See the description for Send data queue, no key (Q QS) journal entry to review the 'Data' field.

It's hard to be sure because it's not clear what business problem is being solved by this programming.

Also, can you show the code that puts data into the DQSNDDATA program variable? That is, how is the *DTAQ entry data extracted from the journal entry?

I haven't needed to retrieve journal entries that hold *DTAQ entries, but I've had to handle many other types. There can be little quirks that are easily missed.
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.