Does anyone have an example of the calling parms needed ? (The manual is a bit confusing since it talks a lot about accessing the program from Rexx, but not Cobol). The following is what I've tried
Code:
10 kk-info.
15 filler pic x(18) value 'INFO DD(INAV0200) '.
15 filler pic x(20) value
Z'INRTDSN(AA-INRTDSN)'.
....
05 aa-inrtdsn pic x(44).
....
call kk-bpxwdyn using kk-info
returning aa-bpxwdyn-code
I'm getting a return code of zero from the call, but nothing is filled in in AA-INRTDSN.
Does anyone have an idea of how to achieve this ? _________________ Michael
That's a dynamic CALL, and 05 aa-inrtdsn pic x(44). is only known to anything, the compiler, at compile time.
So that's not going to work. It won't work with a static CALL either, since the COBOL compiler is entirely unaware of what any CALLed program does, and takes no differentiating action on them at all.
This BPXWDYN program in fact does support function INFO and does return data when called from REXX. We are trying to get this to work in Enterprise COBOL. Does anyone know how to code the parameter area in COBOL to make this utility work for COBOL ?
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
Posted: Tue Jun 27, 2017 5:11 pm Post subject:
allmonr,
You need to zero out R0 for the INFO call to work with BPXWDYN and COBOL does not have the mechanism of zeroing out the registers. In REXX R0 points to the REXX environment. You need an Assembler stub to zero out the R0 before you invoke the BPXWDYN within COBOL. _________________ Kolusu
www.linkedin.com/in/kolusu
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
Posted: Fri Jun 29, 2018 1:19 pm Post subject:
misi01,
It seems that BPXWDYN is enhanced to provide an alternate entry point, BPXWDY2, that:
(1) Preserves the invoker program mask, and
(2) Better facilitates invocation by a high-level language call by clearing register 0 as required by the BPXWDYN interface.
Joined: 10 Oct 2003 Posts: 315 Topics: 49 Location: Germany
Posted: Tue Jul 03, 2018 6:13 am Post subject:
Dear all,
very interesting topic. Several years ago I had a similar problem (find out dataset information for datsets which are allocated by dd namens per JCL).
Here is my PL/1 solution. Perhaps it might help anybody who reads this post, or give a first impression how to retrieve information from the mvs (z/OS) system control blocks.
The first pointer for documentation is this IBM Manual: MVS Data Areas,
Volume 1 (ABEP - DAIT), GA22-7581-01 and the volumes 2,3,4,5.
Code:
/* Some information in this structure is only avialable if
the jcl provides the DCB parameter or the associated
dataset is open
*/
DEFINE STRUCTURE
1 tDSInfo
, 2 DD CHAR(8)
, 2 DSN CHAR(44)
, 2 MEMBER CHAR(8)
, 2 DISP CHAR(3)
, 2 DSORG CHAR(2)
, 2 RECFM CHAR(3)
, 2 LRECL BIN FIXED(15)
, 2 RESERVED CHAR(442) /* FOR FUTURE USE */
;
DSInfo:
/* Loops over the MVS Control blocks to get information
for all DD names associated with the current job.
For each DD Name the filenames and some other
data is fetched from then JFCB (Job File
Control Block).
A callback function is invoked for each file.
The callbackfunction is passed from the calling module.
*/
PROC(pEntry,pUserdata);
DCL pEntry ENTRY
( PTR /* Data for each DDName / Dataset */
, PTR /* Userdata */
) RETURNS(BIT(1)) VARIABLE ;
DCL pUserData PTR ; /* any data passed from the calling modul
an routed to the callback function */
/* extract/prepare data from controlblocks to pass
to the callback function for the calling modul */
CALL PLIFILL(ADDR(DSInfo),'00'X,CSTG(DSInfo));/* Fill with '0'x */
DSInfo.DD = TIOTSEG.TIOEDDNM ;
DSInfo.DSN = JFCB.JFCBDSNM ;
DSInfo.Member = JFCB.JFCBELNM ;
Joined: 02 Dec 2002 Posts: 629 Topics: 176 Location: Stockholm, Sweden
Posted: Wed Oct 24, 2018 6:22 am Post subject:
Thanks for the code Kolusu. It solved the following problem we had here.
We have a batch program that allocates a number of private DL/1 databases. Trouble is, there's no guarantee that the actual databases exist (privately), so to avoid a JCL error, we allocate them as DUMMY.
All well and good, until the program attempts to read them and fails with a return code AI. Now, theoretically we could simply analyze that return code and process it as if it were a GE.
Instead, I ran your code above using 2 databases, the first one existed, the second one was allocated a DUMMY. Here are the surprising (?) results.
Quote:
BPXWDY2 RETURNED RC = +0
BPXWDY2 RETURNED RCB= 0000000000
POSITIVE RC
BPXWDY2 RETURNED RC = +0
BPXWDY2 RETURNED RCB= 0000000000
BPXWDY2 DDNAME LENG = 00005, DDNAME = DAA01 N
BPXWDY2 DSNAME LENG = 00021, DSNAME = SIMMIC.DIALDBDT.DAA01
BPXWDY2 RETURNED RC = +0
BPXWDY2 RETURNED RCB= 0000000000
POSITIVE RC
BPXWDY2 RETURNED RC = +294967273
BPXWDY2 RETURNED RCB= 4294967273
BPXWDY2 DDNAME LENG = 00000, DDNAME = AA01 N
BPXWDY2 DSNAME LENG = 00000, DSNAME = IMMIC.DIALDBDT.DAA01
As you can see, the DUMMY allocated file returned an RC that I assume indicates an "invalid" file. (BTW, the DDNAME/DSNAME in the second example contain a leading blank even though it's not obvious)
Actually, the fault was mine (though not obvious). My program was looping, checking for each entry in a table as to whether the file existed or not. What I didn't realise/hadn't noticed was that the contents of DDNAME/DSNAME get truly clobbered after each call, so you have to re-init them. This became my code
Code:
The definitions first
01 DDNAME.
05 DDNAME-LENGTH PIC S9(4) BINARY VALUE 9.
05 DDNAME-VALUE.
10 FILLER PIC X(07).
88 INRTDDN VALUE 'INRTDDN'.
10 FILLER PIC X(03) VALUE LOW-VALUES.
05 DDNAME-NULL PIC X(01) VALUE LOW-VALUES.
01 DSNAME.
05 DSNAME-LENGTH PIC S9(4) BINARY VALUE 45.
05 DSNAME-VALUE.
10 FILLER PIC X(07).
88 INRTDSN value 'INRTDSN'.
10 FILLER PIC X(44) VALUE LOW-VALUES.
05 DSNAME-NULL PIC X(01) VALUE LOW-VALUES.
The actual code
perform varying x1 from 1 by 1
until x1 > x2
move ' ' to w-bpxwdy2-value
string
'INFO DD(' delimited by size
t-dl1-databas(x1) delimited by ' '
') '
low-value delimited by size
into w-bpxwdy2-value
end-string
*
call k-bpxwdy2 using w-bpxwdy2-value
returning w-bpxwdy2-rc
*
if w-bpxwdy2-rc = 0
move low-values to DDNAME
move 9 to DDNAME-LENGTH
set INRTDDN to true
move low-values to DsNAME
move 45 to DSNAME-LENGTH
set INRTDSN to true
call k-bpxwdy2 using w-bpxwdy2-value
ddname
dsname
returning w-bpxwdy2-rc
end-if
*
if w-bpxwdy2-rc = 0
move k-j to v-databas(x1)
end-if
*
end-perform
NOW I see that DUMMY files are returned with a DSNAME of NULLFILE. _________________ Michael
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum