-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGETIBMMQ.nsp
More file actions
73 lines (73 loc) · 2.83 KB
/
GETIBMMQ.nsp
File metadata and controls
73 lines (73 loc) · 2.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
** Example 'GETIBMMQ': Get MQ message from IBM-MQ queue.
************************************************************************
DEFINE DATA LOCAL
1 MQ-QUEUE-VIEW VIEW OF MQ-QUEUE
2 ERROR-CODE /* MQ reason code
2 ERROR-TEXT /* Text describing the reason code
2 FUNCTION /* Operation: GET, PUT
2 QMANAGER /* Queue manager name
2 QNAME /* Queue name
2 PRIORITY /* Priority (0=low, 9=high)
2 MESSAGE-10K /* Extended message field
2 PUT-DATE /* Put date (YYYYMMDD)
2 PUT-TIME /* Put time (HHMMSSTH)
2 REPLY-TO-QNAME /* Queue name for receiving reply
2 REPLY-TO-QMANAGER /* Queue manager to receive reply
2 USER-ID /* User ID of PUT/GET requester
*
1 I (I4) /* Count number of messages read
1 I-MAX (I4) INIT <10> /* Default number of messages to be read
1 Q-MANAGER (A48)
1 Q-NAME (A48)
END-DEFINE
*
* The GET function is used to retrieve messages from the queue. Once a
* message is retrieved, it is removed from the queue.
*
SET KEY ALL
INPUT (AD=MITL'_' IP=OFF ZP=ON SG=OFF CD=TU)
'GET information from Natural Messaging Queue' (I) /
'--------------------------------------------' (I) //
'Queue name ..................' Q-NAME /
'Queue manager name ..........' Q-MANAGER /
'Maximum number of messages ..' I-MAX (AD=M) ///
'NOTE: Once a message is retrieved, it is removed from the queue.' ///
'Press ENTER to continue or any PF-key to stop.'
*
IF *PF-KEY NE 'ENTR'
ESCAPE ROUTINE
END-IF
*
FOR I = 1 TO I-MAX
*
* Perform function GET to retrieve information from the queue
*
PROCESS MQ-QUEUE-VIEW USING
MQ-QUEUE-VIEW.FUNCTION = 'GET', /* Function name : GET/PUT
MQ-QUEUE-VIEW.QMANAGER = Q-MANAGER, /* QUEUE manager name
MQ-QUEUE-VIEW.QNAME = Q-NAME /* QUEUE Name
*
PRINT 'Message count : ' I (AD=L)
PRINT 'Message : ' MQ-QUEUE-VIEW.MESSAGE-10K
PRINT 'Queue manager : ' MQ-QUEUE-VIEW.QMANAGER
PRINT 'Queue name : ' MQ-QUEUE-VIEW.QNAME
PRINT 'Priority : ' MQ-QUEUE-VIEW.PRIORITY (AD=L)
PRINT 'Put date : ' MQ-QUEUE-VIEW.PUT-DATE
PRINT 'Put time : ' MQ-QUEUE-VIEW.PUT-TIME
PRINT 'User ID : ' MQ-QUEUE-VIEW.USER-ID
PRINT 'Reply queue manager : ' MQ-QUEUE-VIEW.REPLY-TO-QMANAGER
PRINT 'Reply queue name : ' MQ-QUEUE-VIEW.REPLY-TO-QNAME
PRINT '*'(70)(I)
*
* Check for error
*
IF ERROR-CODE NE 0
PRINT / 'Error occurred while performing the GET function.' /
PRINT 'Error code : ' ERROR-CODE (AD=L)
PRINT 'Error text : ' ERROR-TEXT
PRINT '*'(70)(I)
ESCAPE BOTTOM /* Stop processing if error occurs
END-IF
*
END-FOR
END