Thanks Chuck for a great response.
And thank you All for your responses.
From: CRPence <CRPbottle@xxxxxxxxx>
To: midrange-l@xxxxxxxxxxxx
Sent: Sunday, 24 March 2013, 17:13
Subject: Re: soft coding parameters
On 22 Mar 2013 16:51, A Paul wrote:
This is my CLLE program:
PGM
DCL VAR(&LIB) TYPE(*CHAR) LEN(10)
RTVOBJD OBJ(AXAFILE) OBJTYPE(*FILE) RTNLIB(&LIB)
? MQAXAMC FUNCTION('*START') ??FLIB(&LIB) +
??INBOUND( 'QUANTUM.MSGQ.MGR' 'ADMEM.AXAUS.LF000' 'QIUKVC1.QUANTUM') +
??OUTBOUND('QUANTUM.MSGQ.MGR' 'AXAUS.ADMEM.RF000' 'QUANTUM.QIUKVC1') +
SINEX('A1' 'A2' 'A4' 'B1' 'C1' +
'D1' 'F1' 'I1' 'K1' 'K2' +
'K3' 'L1' 'M1' 'M3' 'P1' +
'P2' 'S1' ' ' ' ' ' ') +
PENCE('LA' 'L1' 'LB' ' ' ' ' +
' ' ' ' ' ' ' ' ' ') +
??JOB(ADMMQLDUS2) ??JOBQ(QBATCHFUT2) +
PRTERRRPT('*YES') ??BATCH(30) +
??TESTTRN(ADMSTNF1) ??TESTLNK(ADMLNKF2) +
??RTGDTA('QCMDB')
ENDPGM
I'm using a vendor supplied command MQAXAMC which has following parameters.
Function
FLIB
INBOUND :
MQ Manager name
MQ Queue name
MQ channel name
OUTBOUND:
MQ Manager name
MQ Queue name
MQ channel name
SINEX
PENCE
¿JOB? which is shown above, but is not listed here
JOBQ
PRTERRPT
BATCH
TESTTRN
TESTLNK
RTGDATA
Due to strict limitation on not to hard code, I'm looking for an
alternate solution, maybe to store these parameters in a file and
use.? I normally plan to use the same program with different inbound
and outbound queue parameters from time to time by keeping at least
rest of the parameters hard coded.
So at least I like to keep two parameters(inbound & outbound queues)
not hard-coded, if it is not possible to limit all the parameters
(that are in in single quotes) from hard-coded. Any solution or
advice is appreciated.
An example of how a file might be used:
/* Str-create table DDL ;;; partially completed example */
create table MQAXAMCrqs
( Function for AXfunc char( 7) not null
, TestMode for AXtest char( 1) not null
, constraint MQAXACM_pk
primary key (Function, TestMode)
, constraint MQAXACM___AXfunc____Value_Is__Disallowed
check( AXfunc IN ('*START', '*other', '*etc.') )
, constraint MQAXACM___AXtest____Must_Be___Zero_or_One
check( AXtest IN ('0', '1') )
, FileName for AXfile char(10) not null with default
'AXAFILE'
, InBoundManager for AXinbMgr char(30) not null
, InBoundQueue for AXinbQue char(30) not null
, InBoundChannel for AXinbCnl char(30) not null
, OutBoundManager for AXoutMgr char(30) not null
, OutBoundQueue for AXoutQue char(30) not null
, OutBoundChannel for AXoutCnl char(30) not null
, SinexArgs for AXsnxArg char(40) not null with default ' '
, PenceArgs for AXpncArg char(20) not null with default ' '
, JobQueueQual for AXjobQnm char(20) not null with default
'QBATCHFUT2*LIBL '
, PrintErrorRpt for AXErrRpt char(10) not null with default
'*YES '
... BATCH
... TESTTRN
... TESTLNK
... RTGDATA
)
/* End-create table DDL */
/* Str-insert sample data;; partially completed */
insert into MQAXAMCrqs values(
'*START', '0', default
, 'QUANTUM.MSGQ.MGR', 'ADMEM.AXAUS.LF000', 'QIUKVC1.QUANTUM'
, 'QUANTUM.MSGQ.MGR', 'AXAUS.ADMEM.RF000', 'QUANTUM.QIUKVC1'
, 'A1A2A4B1C1D1F1I1K1K2K3L1M1M3P1P2S1', 'LAL1LB'
, default, default
...
/* End-insert sample data */
PGM Parm(&FncRqs) /* MQAXAMC per FncRqs and test\prod environment */
Dcl &FncRqs *char 07 /* parm: *START, etc.; LIKE(&AXfunc) */
DCL &AXAfilLib *char 10 /* Library of AXAFILE in *LIBL */
Dcl &TestMode *lgl value('0')
Dcl &TestModeC *char 01 stg(*defined) defvar(&TestMode 01)
Dcl &JobQName *char 10 stg(*defined) defvar(&AXjobQnm 01)
Dcl &JobQLibr *char 10 stg(*defined) defvar(&AXjobQnm 11)
Dcl &Snx01 *char 02 stg(*defined) defvar(&AXsnxArg 01)
Dcl &Snx02 *char 02 stg(*defined) defvar(&AXsnxArg 03)
Dcl &Snx03 *char 02 stg(*defined) defvar(&AXsnxArg 05)
Dcl &Snx04 *char 02 stg(*defined) defvar(&AXsnxArg 07)
...
Dcl &Snx20 *char 02 stg(*defined) defvar(&AXsnxArg 39)
/* Each field could come from the file definition instead */
/* This declarative overlay may be preferable? */
Dcl &Pnc01 *char 02 stg(*defined) defvar(&AXPncArg 01)
Dcl &Pnc02 *char 02 stg(*defined) defvar(&AXPncArg 03)
Dcl &Pnc03 *char 02 stg(*defined) defvar(&AXPncArg 05)
Dcl &Pnc04 *char 02 stg(*defined) defvar(&AXPncArg 07)
...
Dcl &Pnc10 *char 02 stg(*defined) defvar(&AXPncArg 19)
DclF MQAXAMCrqs OPNID(*NONE)
/* file of MQAXAMC invocations for each request per testmode */
/* file could be extended to, for example, include per user etc.*/
CALLPRC PRC(GetMQAXAMC_Test) RTNVAL(&TestMode)
ovrdbf MQAXAMCrqs TOFILE(*FILE) ovrscope(*ActGrpDfn) +
POSITION(*KEY 2 *N (&FncRqs *cat &TestModeC))
/* per override, must find the specific matching row else error */
/* Take care to set number-of-fields for PRIMARY KEY; e.g. use 0 */
/* Optionally specify the format name for RECORD FORMAT spec */
rcvf /* any error is pretty much fatal; no monitors enabled */
close /* no longer require request parameter file to be opened */
RTVOBJD OBJ(*LIBL/&AXfile) OBJTYPE(*FILE) RTNLIB(&AXAfilLib)
/* Note: if OVRDBF must be honored, perhaps use QDBRTVFD instead */
Select
When (&FncRqs = '*START') Then(Do)
? MQAXAMC
FUNCTION(&FncRqs)
??FLIB(&AXAfilLib) +
??INBOUND( &AXinbMgr &AXinbQue &AXinbCnl ) +
??OUTBOUND( &AXoutMgr &AXoutQue &AXoutCnl ) +
SINEX(&Snx01 &Snx02 &Snx03 &Snx04 &Snx05 +
&Snx06 &Snx07 &Snx08 &Snx09 &Snx10 +
&Snx11 &Snx12 &Snx13 &Snx14 &Snx15 +
&Snx16 &Snx17 &Snx18 &Snx19 &Snx20 )
PENCE(&Pnc01 &Pnc02 &Pnc03 &Pnc04 &Pnc05 +
&Pnc06 &Pnc07 &Pnc08 &Pnc09 &Pnc10 )
??JOB(ADMMQLDUS2) +
??JOBQ(&JobQLibr/&JobQName) +
PRTERRRPT(&AXErrRpt) +
??BATCH(30) /* this and other parms incomplete in file */ +
??TESTTRN(ADMSTNF1) +
??TESTLNK(ADMLNKF2) +
??RTGDTA('QCMDB')
EndDo
EndSelect
ENDPGM
<><><><><><><><><>
Another example would be to encapsulate the retrieved values in
procedures, where the data could come from the same file, or anywhere
else; i.e. the program is not tightly-coupled to the database file.
PGM Parm(&FncRqs) /* MQAXAMC per FncRqs and test\prod environment */
DCL VAR(&LIB) TYPE(*CHAR) LEN(10)
Dcl &TestMode *lgl value('0')
Dcl &JobQQual *char 20 value('QBATCHFUT2*LIBL ')
Dcl &JobQName *char 10 stg(*defined) defvar(&JobQQual 01)
Dcl &JobQLibr *char 10 stg(*defined) defvar(&JobQQual 11)
Dcl &RtgDta *char 80 value('*JOBD')
Dcl &SnxArg *char 40
Dcl &Snx01 *char 02 stg(*defined) defvar(&SnxArg 01)
Dcl &Snx02 *char 02 stg(*defined) defvar(&SnxArg 03)
Dcl &Snx03 *char 02 stg(*defined) defvar(&SnxArg 05)
Dcl &Snx04 *char 02 stg(*defined) defvar(&SnxArg 07)
...
Dcl &Snx15 *char 02 stg(*defined) defvar(&SnxArg 39)
Dcl &PncArg *char 20
Dcl &Pnc01 *char 02 stg(*defined) defvar(&PncArg 01)
Dcl &Pnc02 *char 02 stg(*defined) defvar(&PncArg 03)
Dcl &Pnc03 *char 02 stg(*defined) defvar(&PncArg 05)
Dcl &Pnc04 *char 02 stg(*defined) defvar(&PncArg 07)
...
Dcl &Pnc10 *char 02 stg(*defined) defvar(&AXPncArg 19)
RTVOBJD OBJ(AXAFILE) OBJTYPE(*FILE) RTNLIB(&LIB)
/* Note: if OVRDBF must be honored, perhaps use QDBRTVFD instead */
CALLPRC PRC(GetMQAXAMC_Test ) RTNVAL(&TestMode)
CALLPRC PRC(GetMQAXAMC_Libr ) PARM(&TestMode) RTNVAL(&LibrName)
CALLPRC PRC(GetMQAXAMC_JobQ ) PARM(&TestMode) RTNVAL(&JobQQual)
CALLPRC PRC(GetMQAXAMC_RtgDta) PARM(&TestMode) RTNVAL(&RtgDta )
CALLPRC PRC(GetMQAXAMC_Sinex ) PARM(&TestMode) RTNVAL(&SnxArg )
CALLPRC PRC(GetMQAXAMC_Pence ) PARM(&TestMode) RTNVAL(&PncArg )
...
? MQAXAMC ...
ENDPGM
As an Amazon Associate we earn from qualifying purchases.