IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Reading a library member using BPXWDYN


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Viktor

New User


Joined: 12 Nov 2010
Posts: 7
Location: Europe

PostPosted: Tue Nov 16, 2010 9:19 am
Reply with quote

Hello all -
I wish to use COBOL to read a JCL dataset with many members. The COBOL program will read the JCL members in order to ascertain which datasets within these JCL jobs are dependent upon another.

The JCL dataset is organized as PO, with Dsntype = LIBRARY, and record length = 80. I have used BPXWDYN in order to find the member names of the JCL dataset.

I used a string similar to the following in conjunction with obtaining member names:

'ALLOC DD(MYPDS) DSN(LABC.XXXX.JCLLIB)'

1) This part has gone well, even though it appears the member name entries have a length of 43 and not 80. (Why ? Directory has own format ???)

After a member name is identified, the pgm shall read the (JCL) member. Here is where I have a problem: this being that all attempts at allocation (and de-allocation) of the member itself are unsuccessful.

Here is one version of the BPXWDYN strings that I have test-used:

'ALLOC DD(MYMBR) DSN(LABC.XXXX.JCLLIB(MBR1))'

2) It seems that enclosing the member name in parentheses is not correct. But then what is correct ? I have tried '[' and quotes and apostrophes as well. I get back a return code 24.

I have numbered my questions for convenience. I have two more questions:

When the COBOL program is run against a dataset with dataset name type = PDS, organization = PO, and recordlength = 80, an error occurs during the COBOL READ (in order to obtain a list of member names):

IGZ0002S JCLXYZ,STEP01 ,10FE,D,SYSIN ,GET ,WRNG.LEN.RECORD,000004CD0000000,QSAM
From compile unit PROGRAMXX at entry point PROGRAMXX at statement 235 at compile unit offset +00001762 at entry offset +00001762 at address 3560274A.

3) What is wrong here and how can this be corrected ?

Thank you for your patience.

P.S. - I have searched the forum for help with BPXWDYN: I have read the 'How to read a record of a file as file in COBOL' thread.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Nov 16, 2010 10:05 am
Reply with quote

Hello and welcome to the forum,

Did you read this previous topic?
ibmmainframes.com/viewtopic.php?t=50781

Or this one with some sample cobol code?
ibmmainframes.com/viewtopic.php?t=5501
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Tue Nov 16, 2010 12:30 pm
Reply with quote

1) because it was designed in that way
2) reading the directory is different from reading data
3) the thing to be corrected is Your understanding of PDS organization icon_biggrin.gif

see
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DGT2D470/CCONTENTS?SHELF=DGT2BK81&DN=SC26-7410-08&DT=20080602122917

for all You might want to know aboput PDS

the PDS directory can be read by using a PS dcb with lrecl 256, but You will have to do Your own deblocking and directory demangling

it would be simpler to use the ISPF LMM**** stuff
just one dd and no issues in allocating the single members

even if for such task something with stronger string handling capabilities would be better

I would do the prototyping in rexx and after, if the performance is not satisfactory
switch to a compiled language
Back to top
View user's profile Send private message
Viktor

New User


Joined: 12 Nov 2010
Posts: 7
Location: Europe

PostPosted: Tue Nov 16, 2010 3:45 pm
Reply with quote

Thanks Dick S. and Enrico-S for the prompt answers. I think I will using ISPF LMM services as suggested.

But even if I use ISPF LMM in conjunction with BPXWDYN, I still have to solve the problem of allocating a member of the library.

I studied the allocation string in the COBOL pgm example using LMM, and used the same format in my own COBOL pgm. But when the program was testrun the member still remained allocated with a return code of 24. Here are the different formats I have tried (unsuccessfully):

ALLOC DD(MYMBR) DSN('LABC.XXXX.JCLLIB(MBR1)')

ALLOC DD(MYMBR) DSN("LABC.XXXX.JCLLIB(MBR1)")

ALLOC DD(MYMBR) DA('LABC.XXXX.JCLLIB(MBR1)')

ALLOC DD(MYMBR) DA("LABC.XXXX.JCLLIB(MBR1)")

On the other hand, I am able to successfully allocate the library itself

ALLOC DD(MYPDS) DSN(LABC.XXXX.JCLLIB)

I am at a loss to see what is wrong with my member allocation string.

???
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Tue Nov 16, 2010 3:58 pm
Reply with quote

In ISPF LM services, you LMINIT the whole PDS. Then, for particular member-processing services, you provide the member name in the service itself.

O.
Back to top
View user's profile Send private message
Viktor

New User


Joined: 12 Nov 2010
Posts: 7
Location: Europe

PostPosted: Wed Nov 17, 2010 1:47 pm
Reply with quote

Hi everyone -
Just a status report in case you are wondering how things are going . . .

Based on the feedback I have gotten from you all, it sounds like using ISPF LM services is a better way to go.

So I have written a COBOL LM pgm based upon the example which was kindly provided in an earlier post. I have finally gotten it to compile but when I testrun it, it results in a series of return code 20s. I shall see if I can find out what the problem is. Probably the JCL to run the job isn't set up right.
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Wed Nov 17, 2010 1:59 pm
Reply with quote

Try running it with TRACE & TEST. Also, you might want to DISPLAY the ISPF variables ZERRSM & ZERRLM after each failed service.

O.
Back to top
View user's profile Send private message
Viktor

New User


Joined: 12 Nov 2010
Posts: 7
Location: Europe

PostPosted: Thu Nov 25, 2010 3:17 pm
Reply with quote

Got it to run now.

Thanks everyone for your help.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Thu Nov 25, 2010 10:20 pm
Reply with quote

see
ibmmainframes.com/viewtopic.php?t=52204&highlight=
for a members list logic in rexx
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Calling an Open C library function in... CICS 1
No new posts Reading dataset in Python - New Line ... All Other Mainframe Topics 22
No new posts Find the size of a PS file before rea... COBOL Programming 13
No new posts Submit multiple jobs from a library t... JCL & VSAM 14
No new posts Duplicate several members of/in one l... JCL & VSAM 7
Search our Forums:

Back to Top