When calling an API the same set of rules generally apply whether the call is done interactively or in batch. One rule is that API parameters are passed in groups (required, optional group 1, optional group 2, etc). In the case of QEZSNDMG there are nine parameters in the first group where you are passing only five. In addition, <a href=”http://publib.boulder.ibm.com/infocenter/iseries/v5r4/topic/apis/QEZSNDMG.htm”>QEZSNDMG</a> documents that if you call the API in batch then paramter 10 must be passed and must be set to a value of ‘N’. As parameter 10 is in optional parameter group 2 then you must pass all of optional group 1 and all of optional group 2.
With this information, then:
ADDJOBSCDE JOB(QEZSNDMG) CMD(CALL PGM(QEZSNDMG) PARM(‘*INFO’ ‘*NORMAL’ ‘Testing’ X’00000007′ ‘USER1′ X’00000001′ X’00000000′ X’00000000′ X’00000000′ ‘N’ ‘ ‘ ‘*USR’))
will send the message ‘Testing’ to user USER1.
A couple of items:
1. Some of the parameters are defined as being Binary(4). As command analyzer will treat any numeric parameter as packed decimal you need to specify the Binary(4) parameters using hex. So x’00000001′ means pass a 4-byte field which will look like a 1 when viewed as a binary number (the number of users). x’00000007′ means pass a 4-byte field which looks like a 7 (the length of your message).
2. Two of the parameters are outputs from the API. You need to pass “something” for these (I use x’00000000′) but you will not be able to determine what values were returned (when using a command line like approach).
3. For the Error code parameter I used x’00000000′. This appears to the API as if I had specified a Bytes Provided within the Error code structure of 0, so errors will be returned as exceptions.