BMCDSN in batch

Raymond Bell

BMCDSN in batch
All,

Quick question. Does anyone have some JCL to run the BMCDSN command
processor in batch that doesn't look like this?

//BMCDSN EXEC PGM=IKJEFT1A,DYNAMNBR=20
//*
//BMCUTILB DD DISP=SHR,DSN=SA1.P.BMC.AUTHLOAD
// DD DISP=SHR,DSN=BMC.LOAD
//SYSTSPRT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSTSIN DD *
ABUDSN /DB2B/ABUD2300/
+DIS UTIL(*)
+TERM UTIL(UTILITY_ID)
/*

I'd kinda like something similar to DSNUPROC, like 'EXEC
PGM=ABUD2300,PARM=(DB2B)' and the SYSIN just being the +DIS UTIL(*) command.
Or is the above the only way?

Cheers,


Raymond Bell
Database Administrator


This e-mail (and any attachments) may contain privileged and/or confidential information. If you are not the intended recipient please do not disclose, copy, distribute, disseminate or take any action in reliance on it. If you have received this message in error please reply and tell us and then delete it. Should you wish to communicate with us by e-mail we cannot guarantee the security of any data outside our own computer systems. For the protection of Legal & General's systems and staff, incoming emails will be automatically scanned.

Any information contained in this message may be subject to applicable terms and conditions and must not be construed as giving investment advice within or outside the United Kingdom.

Legal & General Group PLC, Temple Court, 11 Queen Victoria Street, London, EC4N 4TP.
Registered in England no: 1417162

Legal & General Group Plc is a holding company, subsidiary undertakings of which are fully authorised as appropriate under the Financial Services and Markets Act in respect of their investment activities in the UK.

---------------------------------------------------------------------------------
Welcome to the IDUG DB2-L list. To unsubscribe, go to the archives and home page at http://www.idugdb2-l.org/archives/db2-l.html. From that page select "Join or Leave the list". The IDUG DB2-L FAQ is at http://www.idugdb2-l.org. The IDUG List Admins can be reached at [login to unmask email] Find out the latest on IDUG conferences at http://conferences.idug.org/index.cfm

gerhard heiss

Re: BMCDSN in batch
(in response to Raymond Bell)
Raymond,

you might consider using IFI to let your programs issue commands to DB2.
Below is a quick example, coded in REXX

Regards Gerhard

/* REXX */
SSID = 'DB2T'
RET=CONN_DB2(SSID) ; IF RET^=0 THEN EXIT RET

CALL IFI '-DIS UTIL(*)'

ADDRESS DSNREXX
"DISCONNECT"
EXIT
/*--------------------------------------------------------------------*/
IFI:
ARG CMD
/* REMOVE ENCLOSING QUOTES */
IF LEFT(CMD,2) = ""'" & RIGHT(CMD,2) = "'"" THEN
CMD = SUBSTR(CMD,2,LENGTH(CMD)-2)
ELSE
IF LEFT(CMD,2) = """'" & RIGHT(CMD,2) = "'""" THEN
CMD = SUBSTR(CMD,3,LENGTH(CMD)-4)
COMMAND = SUBSTR("COMMAND",1,18," ")
/****************************************************************/
/* SET UP THE IFCA, RETURN AREA, AND OUTPUT AREA FOR THE */
/* IFI COMMAND CALL. */
/****************************************************************/
IFCA = SUBSTR('00'X,1,180,'00'X)
IFCA = OVERLAY(D2C(LENGTH(IFCA),2),IFCA,1+0)
IFCA = OVERLAY("IFCA",IFCA,4+1)
RTRNAREASIZE = 262144 /*1048572*/
RTRNAREA = D2C(RTRNAREASIZE+4,4)LEFT(' ',RTRNAREASIZE,' ')
OUTPUT = D2C(LENGTH(CMD)+4,2)!!'0000'X!!CMD
BUFFER = SUBSTR(" ",1,16," ")
/****************************************************************/
/* MAKE THE IFI COMMAND CALL. */
/* DSNWLI2 INSTEAD OF DSNWLIR BECAUSE CAF IS USED */
/* (THE REXX LANGUAGE SUPPORT DESCRIBES THE USE OF */
/* DSNWLIR BECAUSE IT USES THE RRSAF INTERFACE */
/* */
/* MAKE THE IFI COMMAND CALL. */
/****************************************************************/
ADDRESS LINKPGM "DSNWLI2 COMMAND IFCA RTRNAREA OUTPUT"
RTRN= SUBSTR(IFCA,12+1,4)
REAS= SUBSTR(IFCA,16+1,4)
TOTLEN = C2D(SUBSTR(IFCA,20+1,4))
/****************************************************************/
/* EXTRACT MESSAGES FROM THE RETURN AREA */
/****************************************************************/
SEQNO = 0
OFFSET = 4+1
DO WHILE ( OFFSET < TOTLEN )
LEN = C2D(SUBSTR(RTRNAREA,OFFSET,2))
SEQNO = SEQNO + 1
TEXT = SUBSTR(RTRNAREA,OFFSET+4,LEN-4-1)
SAY TEXT
OFFSET = OFFSET + LEN
END
RETURN
/*--------------------------------------------------------------------*/
CONN_DB2:
ARG SSID
'SUBCOM DSNREXX'
SELECT
WHEN(RC = 1) THEN
DO
RET = RXSUBCOM('ADD','DSNREXX','DSNREXX')
IF RET <> 0 THEN
DO
SAY PROC_NAME 'ADD DSNREXX: 'RET
EXIT RET
END
END
WHEN(RC = 0) THEN
NOP
OTHERWISE
END
ADDRESS DSNREXX
"CONNECT "SSID
RETURN RC





-----Original Message-----
From: DB2 Data Base Discussion List [mailto:[login to unmask email] On
Behalf Of Bell, Raymond
Sent: Wednesday, January 19, 2005 3:49 PM
To: [login to unmask email]
Subject: [DB2-L] BMCDSN in batch


All,

Quick question. Does anyone have some JCL to run the BMCDSN command
processor in batch that doesn't look like this?

//BMCDSN EXEC PGM=IKJEFT1A,DYNAMNBR=20
//*
//BMCUTILB DD DISP=SHR,DSN=SA1.P.BMC.AUTHLOAD
// DD DISP=SHR,DSN=BMC.LOAD
//SYSTSPRT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSTSIN DD *
ABUDSN /DB2B/ABUD2300/
+DIS UTIL(*)
+TERM UTIL(UTILITY_ID)
/*

I'd kinda like something similar to DSNUPROC, like 'EXEC
PGM=ABUD2300,PARM=(DB2B)' and the SYSIN just being the +DIS UTIL(*)
command. Or is the above the only way?

Cheers,


Raymond Bell
Database Administrator


This e-mail (and any attachments) may contain privileged and/or
confidential information. If you are not the intended recipient please
do not disclose, copy, distribute, disseminate or take any action in
reliance on it. If you have received this message in error please reply
and tell us and then delete it. Should you wish to communicate with us
by e-mail we cannot guarantee the security of any data outside our own
computer systems. For the protection of Legal & General's systems and
staff, incoming emails will be automatically scanned.

Any information contained in this message may be subject to applicable
terms and conditions and must not be construed as giving investment
advice within or outside the United Kingdom.

Legal & General Group PLC, Temple Court, 11 Queen Victoria Street,
London, EC4N 4TP. Registered in England no: 1417162

Legal & General Group Plc is a holding company, subsidiary undertakings
of which are fully authorised as appropriate under the Financial
Services and Markets Act in respect of their investment activities in
the UK.

------------------------------------------------------------------------
---------
Welcome to the IDUG DB2-L list. To unsubscribe, go to the archives and
home page at http://www.idugdb2-l.org/archives/db2-l.html. From that
page select "Join or Leave the list". The IDUG DB2-L FAQ is at
http://www.idugdb2-l.org. The IDUG List Admins can be reached at
[login to unmask email] Find out the latest on IDUG conferences
at http://conferences.idug.org/index.cfm

---------------------------------------------------------------------------------
Welcome to the IDUG DB2-L list. To unsubscribe, go to the archives and home page at http://www.idugdb2-l.org/archives/db2-l.html. From that page select "Join or Leave the list". The IDUG DB2-L FAQ is at http://www.idugdb2-l.org. The IDUG List Admins can be reached at [login to unmask email] Find out the latest on IDUG conferences at http://conferences.idug.org/index.cfm

Chris Bowen

Re: BMCDSN in batch
(in response to gerhard heiss)
Hi Ray,

If you're prepared to countenance a two step proc then you could try
something like this: -

//RAYSBMC PROC DB2SYS=
//BMCBLD EXEC PGM=IRXJCL,PARM='BMCBUILD &DB2SYS'
//SYSEXEC DD DSN=your rexx library,DISP=SHR
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD DUMMY
//SYSPRINT DD SYSOUT=*
//SYSUT2 DD DSN=&&BMCPARMS,DISP=(NEW,PASS),
// etc etc
//BMCDSN EXEC PGM=IKJEFT1A,DYNAMNBR=20
//*
//BMCUTILB DD DISP=SHR,DSN=SA1.P.BMC.AUTHLOAD
// DD DISP=SHR,DSN=BMC.LOAD
//SYSTSPRT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSTSIN DD DSN=&&BMCPARMS,DISP=(OLD,DELETE)
// DD DDNAME=RUNPARMS

Your REXX exec BMCBUILD looks something like: -

/* REXX */
PARSE ARGS DB2SYS .
Queue 'ABUDSN /' || DB2SYS || '/ABUD2300/'
"EXECIO * DISKW SYSUT2 (FINIS"
exit

At which point the execution JCL comes down to: -

//ASTEP EXEC RAYSBMC,DB2SYS=DB2B
//BMCDSN.RUNPARMS DD *
+DIS UTIL(*)
+TERM UTIL(UTILITY_ID)
/*

I have absolutely no idea what the BMC parms mean but tailoring to meet
your needs should be straight-forward.

As a solution it's not elegant in itself but both the execution JCL and the
REXX code are simple and the procedure JCL is not too bad. Of course, the
REXX exec could be replaced with a "real" program (Assembler, COBOL,
whatever).

Regards

Chris Bowen
(My personal views only etc etc)

---------------------------------------------------------------------------------
Welcome to the IDUG DB2-L list. To unsubscribe, go to the archives and home page at http://www.idugdb2-l.org/archives/db2-l.html. From that page select "Join or Leave the list". The IDUG DB2-L FAQ is at http://www.idugdb2-l.org. The IDUG List Admins can be reached at [login to unmask email] Find out the latest on IDUG conferences at http://conferences.idug.org/index.cfm