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

Access file which has DSNTYPE=LIBRARY


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
maxsubrat

Active User


Joined: 27 Feb 2008
Posts: 110
Location: india

PostPosted: Fri Jun 21, 2019 4:09 pm
Reply with quote

Hi,
I have a PDSE file which has DSNTYPE=LIBRARY.

While I process this thru JCL thru IEBGENER, it fails with S002.
Here is my JCL:
//TEST1 EXEC PGM=IEBGENER
//SYSPRINT DD DUMMY
//SYSUT1 DD DISP=SHR,DSN=NE.HSE.EMP500
//SYSUT2 DD SYSOUT=(,),OUTPUT=*
//SYSIN DD DUMMY

If I remove this IEBGENER step, then it executes successfully in rest of the steps.
Not sure whether IEBGENER supports this file ?
Thanks
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10886
Location: italy

PostPosted: Fri Jun 21, 2019 4:40 pm
Reply with quote

what should be the expected result ?
Back to top
View user's profile Send private message
maxsubrat

Active User


Joined: 27 Feb 2008
Posts: 110
Location: india

PostPosted: Fri Jun 21, 2019 5:00 pm
Reply with quote

The JCL has 5 steps which calls the same proc each time.
The proc functionality is to check the dataset opens successfully and check the members exist or not.
So there is 3-4 steps are there in the proc to check the datasets which is passing from JCL.

sample jcl: only the step1 has the dsntype=library, all other steps has PDS.

//STEP1 EXEC CHKDPDS,DSN=NE.HSE.EMP500
//STEP2 EXEC CHKDPDS,DSN=NE.HSE.EMP501
//STEP3 EXEC CHKDPDS,DSN=NE.HSE.EMP502
//STEP4 EXEC CHKDPDS,DSN=NE.HSE.EMP503
//STEP5 EXEC CHKDPDS,DSN=NE.HSE.EMP504

PROC:
//TEST1 EXEC PGM=IEBGENER
//SYSPRINT DD DUMMY
//SYSUT1 DD DISP=SHR,DSN=NE.HSE.EMP500
//SYSUT2 DD SYSOUT=(,),OUTPUT=*
//SYSIN DD DUMMY

This is the 1st step in the proc.
there are few more steps also to check the members are exist in the datasets or not.
But the job fails in this 1st step for the file NE.HSE.EMP500.
all other jcl steps executes successfully.
So the step1 in the JCL also should run successfully like other steps. But it is throwing error with S002.

Thanks
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10886
Location: italy

PostPosted: Fri Jun 21, 2019 5:09 pm
Reply with quote

Quote:
Not sure whether IEBGENER supports this file ?



IEBGENER is designed to deal with DSORG PS datasets or members of a partitioned dataset

using for something different will result in unpredictable behaviour

until now you have been lucky

find a different approach.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2139
Location: USA

PostPosted: Fri Jun 21, 2019 6:06 pm
Reply with quote

maxsubrat wrote:
Hi,
I have a PDSE file which has DSNTYPE=LIBRARY.

While I process this thru JCL thru IEBGENER, it fails with S002.
Here is my JCL:
//TEST1 EXEC PGM=IEBGENER
//SYSPRINT DD DUMMY
//SYSUT1 DD DISP=SHR,DSN=NE.HSE.EMP500
//SYSUT2 DD SYSOUT=(,),OUTPUT=*
//SYSIN DD DUMMY

This has nothing to do with DSNTYPE=LIBRARY or not.

It was a stupid idea (1) to use //SYSPRINT DD DUMMY while having absolutely no idea about the used tools, and (2) to have read no documentation, or no explained examples before doing something with your own hands.

IEBGENER is not supposed to work with DSORG=PO datasets. Period.

This code, when translated to non-mainframe language, is equivalent to hammering screws using a huge hammer... As well as to make a big iron swimming in a water pool.
Back to top
View user's profile Send private message
Willy Jensen

Active Member


Joined: 01 Sep 2015
Posts: 734
Location: Denmark

PostPosted: Fri Jun 21, 2019 7:40 pm
Reply with quote

As stated by others, you cannot use IEBGENER to check for an empty PDS/E.
You can use IEHLIST or various freeware tools to list directories and post-process the output to check for members or not.
One IBM alternative to IEHLIST could be the TSO LISTPDS command in batch.
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 917
Location: The Universe

PostPosted: Fri Jun 21, 2019 7:48 pm
Reply with quote

Willy Jensen wrote:
As stated by others, you cannot use IEBGENER to check for an empty PDS/E.
You can use IEHLIST or various freeware tools to list directories and post-process the output to check for members or not.
One IBM alternative to IEHLIST could be the TSO LISTPDS command in batch.
There is no IBM supplied line mode LISTPDS command
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 917
Location: The Universe

PostPosted: Fri Jun 21, 2019 8:06 pm
Reply with quote

The other question I have is what is the real goal here? Ignoring the issue about DSNTYPE=LIBRARY, I can't see the example JCL as producing any useful output even for old style PDS data sets.

There is no such thing as an "empty" PDS. There are PDSs with no members, but a PDS (or even a DSNTYPE=LIBRARY PDS) with no members is not "empty." There is always a directory with a pseudo member entry that indicates the end of the directory.

I have to go now. There is a little more research I'd like to do but I can't do it right now,
Back to top
View user's profile Send private message
maxsubrat

Active User


Joined: 27 Feb 2008
Posts: 110
Location: india

PostPosted: Fri Jun 21, 2019 8:25 pm
Reply with quote

Thanks for all the valuable info.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2139
Location: USA

PostPosted: Fri Jun 21, 2019 9:12 pm
Reply with quote

It makes sense for TS sometimes to read at least something by himself before trying to ask others.

There are plenty of options in the world of mainframes...
One of the simplest is like this:
Quote:
Return Codes

z/OS DFSMSdfp Utilities
SC23-6864-00

IEBPTPCH returns a code in register 15 to indicate the results of program execution.

The return codes and their meanings are:

Codes --- Meaning

00 (X'00') --- Successful completion.

04 (X'04') --- Either a physical sequential data set is empty or a partitioned data set has no members.

08 (X'08') --- A member specified for printing or punching does not exist in the input data set and processing will continue with the next member, or a DBCS error was encountered.

12 (X'0C') --- An unrecoverable error occurred, a user routine passed a return code of 12 to IEBPTPCH and the utility is ended, or a DBCS error was encountered.

16 (X'10') --- A user routine passed a return code of 16 to IEBPTPCH. The utility is ended.
Back to top
View user's profile Send private message
Willy Jensen

Active Member


Joined: 01 Sep 2015
Posts: 734
Location: Denmark

PostPosted: Fri Jun 21, 2019 10:58 pm
Reply with quote

@steve-myers
Quote:
There is no IBM supplied line mode LISTPDS command

Quite right, I was thinking of the LISTDS dsname MEMBERS command.
Blame it on age creeping in.
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 917
Location: The Universe

PostPosted: Sat Jun 22, 2019 4:11 am
Reply with quote

sergeyken wrote:

Quote:
Return Codes

z/OS DFSMSdfp Utilities
SC23-6864-00

IEBPTPCH returns a code in register 15 to indicate the results of program execution.

The return codes and their meanings are:

Codes --- Meaning

00 (X'00') --- Successful completion.

04 (X'04') --- Either a physical sequential data set is empty or a partitioned data set has no members.

08 (X'08') --- A member specified for printing or punching does not exist in the input data set and processing will continue with the next member, or a DBCS error was encountered.

12 (X'0C') --- An unrecoverable error occurred, a user routine passed a return code of 12 to IEBPTPCH and the utility is ended, or a DBCS error was encountered.

16 (X'10') --- A user routine passed a return code of 16 to IEBPTPCH. The utility is ended.
Yes, and IEBPTPCH also issues the technically incorrect message (for a PDS) with RC 4 -

IEB417I DATA SET EMPTY, RETURN CODE IS 4
Back to top
View user's profile Send private message
hankoerlemans

New User


Joined: 25 Jan 2018
Posts: 61
Location: Australia

PostPosted: Tue Nov 19, 2019 7:30 am
Reply with quote

Hmmm, dfSMS "Reading a PDSE Directory" ???

Code:

//READDIR   EXEC PGM=IEBGENER                 
//SYSPRINT  DD   SYSOUT=*                     
//SYSUT1    DD   DISP=SHR,DSN=HANKO.TEST.PDSE,
// LRECL=256,RECFM=F,BLKSIZE=256             
//SYSUT2    DD   SYSOUT=*                     
//SYSIN     DD   DUMMY                       



although without seeing the following steps it's a bit hard to see how this kind of output is useful.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2139
Location: USA

PostPosted: Tue Nov 19, 2019 8:01 pm
Reply with quote

hankoerlemans wrote:
Hmmm, dfSMS "Reading a PDSE Directory" ???

Code:

//READDIR   EXEC PGM=IEBGENER                 
//SYSPRINT  DD   SYSOUT=*                     
//SYSUT1    DD   DISP=SHR,DSN=HANKO.TEST.PDSE,
// LRECL=256,RECFM=F,BLKSIZE=256             
//SYSUT2    DD   SYSOUT=*                     
//SYSIN     DD   DUMMY                       



although without seeing the following steps it's a bit hard to see how this kind of output is useful.

Physical organization of DSORG=PO, and "DSORG=POE" (e.g. DSNTYPE=LIBRARY) are completely different.

It was a very-very bad idea in old times, trying to read a PDS directory as physical blocks with RECFM=F, LRECL=256 attributes. There was no guaranty on correct behavior after this attempt - even with DSORG=PO (though it worked somehow...), and it's not surprising, it would never work with DSNTYPE=LIBRARY.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8700
Location: Dubuque, Iowa, USA

PostPosted: Tue Nov 19, 2019 8:41 pm
Reply with quote

Whether or not it was a bad idea in "old times", IBM fully supports reading a PDS directory sequentially now (quotes are from the z/OS 2.1 manual):
Quote:
z/OS DFSMS Using Data Sets
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Reading a PDS Directory Sequentially

z/OS DFSMS Using Data Sets
SC23-6855-00


You can read a PDS directory sequentially just by opening the data set to its beginning (without using positioning macros) and reading it.
The DD statement must identify the DSNAME without a member name.
You can use either BSAM or QSAM with MACRF=R or G.
Specify BLKSIZE=256 and RECFM=F or RECFM=U.
QSAM always requires LRECL=256
You should test for the last directory entry (8 bytes of X'FF'). Records and blocks after that point are unpredictable. After reading the last allocated directory block, control passes to your EODAD routine or reading continues with a concatenated data set. You can issue an FEOV macro to cease reading the current data set and continue with the next one. If you issue FEOV while reading the last or only data set, control passes to your EODAD routine.
If you also want to read the keys (the name of the last member in that block), use BSAM and specify KEYLEN=8.
This technique works when PDSs and PDSEs are concatenated. However, you cannot use this technique to sequentially read a UNIX directory. The system considers this to be a like sequential concatenation.
and even a PDSE:
Quote:
z/OS DFSMS Using Data Sets
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Reading a PDSE Directory

z/OS DFSMS Using Data Sets
SC23-6855-00


You can read a PDSE directory sequentially just by opening the data set (without using positioning macros) and reading it. The PDSE directory cannot be updated. The following rules and guidelines apply to reading a PDSE directory:
The DD statement must identify the DSNAME without a member name.
You can use either BSAM or QSAM with MACRF=R or G.
Specify BLKSIZE=256 and RECFM=F or RECFM=U.
If you also want to read the keys (the name of the last member in that block), use BSAM and specify KEYLEN=8.
After reading the last PDSE directory entry, you read the next directory, or control passes to your EODAD routine. The last directory entry is indicated with a dummy name of eight bytes of X'FF'.
Alias entries with names longer than eight bytes are omitted. To read them, use DESERV.
You can use sequentially read the directories of a concatenation of PDSs and PDSEs. However, you cannot sequentially read a UNIX directory. This is considered to be a like sequential concatenation. To proceed to each successive data set, you can rely on the system's EOV function or you can issue the FEOV macro.
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 917
Location: The Universe

PostPosted: Tue Nov 19, 2019 9:06 pm
Reply with quote

sergeyken wrote:
hankoerlemans wrote:
... Physical organization of DSORG=PO, and "DSORG=POE" (e.g. DSNTYPE=LIBRARY) are completely different.

It was a very-very bad idea in old times, trying to read a PDS directory as physical blocks with RECFM=F, LRECL=256 attributes. There was no guaranty on correct behavior after this attempt - even with DSORG=PO (though it worked somehow...), and it's not surprising, it would never work with DSNTYPE=LIBRARY.
Well, it does work with DSORG=PO. It sort of kind of works with DSORG=POE (DSNTYPE=LIBRARY) and it's documented that it sort of kind of works to transform (sort of) a POE directory to a PO directory so old programs that use the old way of reading a directory would continue to word with DSORG=POE.

The traditional way to read a PDS directory works because a PDS directory really is sort of a sequential data set with RECFM=F, LRECL=256, BLKSIZE=256. The reader program has to deblock the directory entries by hand, as it were, which makes the exercise a little more difficult.

By the way, the wording in the current Using Data Sets manual (-30!) is quite a bit different than the quote from the -0 manual previously quoted.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2139
Location: USA

PostPosted: Tue Nov 19, 2019 9:25 pm
Reply with quote

steve-myers wrote:
sergeyken wrote:
hankoerlemans wrote:
... Physical organization of DSORG=PO, and "DSORG=POE" (e.g. DSNTYPE=LIBRARY) are completely different.

It was a very-very bad idea in old times, trying to read a PDS directory as physical blocks with RECFM=F, LRECL=256 attributes. There was no guaranty on correct behavior after this attempt - even with DSORG=PO (though it worked somehow...), and it's not surprising, it would never work with DSNTYPE=LIBRARY.
Well, it does work with DSORG=PO. It sort of kind of works with DSORG=POE (DSNTYPE=LIBRARY) and it's documented that it sort of kind of works to transform (sort of) a POE directory to a PO directory so old programs that use the old way of reading a directory would continue to word with DSORG=POE.

The traditional way to read a PDS directory works because a PDS directory really is sort of a sequential data set with RECFM=F, LRECL=256, BLKSIZE=256. The reader program has to deblock the directory entries by hand, as it were, which makes the exercise a little more difficult.

By the way, the wording in the current Using Data Sets manual (-30!) is quite a bit different than the quote from the -0 manual previously quoted.

Yes, this can be done, and I also did it for DSORG=PO, long time ago. I wasn't sure about DSORG=POE, but now I see the proof of it.

Nevertheless, the whole approach resembles me reading DB2 tables from VSAM files using DSORG=VS/KS... Hopefully it is also possible, but I would not try doing this.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2139
Location: USA

PostPosted: Wed Nov 20, 2019 8:44 pm
Reply with quote

A standard solution would be like this example
Code:
//*==========================================================
//* CHECK FOR EMPTY LIBRARY                                 
//*==========================================================
//ISEMPTY  EXEC PGM=IEBPTPCH                                 
//SYSPRINT DD  DUMMY,SYSOUT=*                                     
//SYSUT1   DD  DISP=SHR,                                     
//             DSNAME=&SYSUID..EMPTYLIB                     
//SYSUT2   DD  DUMMY,SYSOUT=*                               
//SYSIN    DD  *                                             
   PRINT   TYPORG=PO,STOPAFT=1                               
//*                                                         
//*==========================================================
//*                                                         
// IF (ISEMPTY.RC EQ 0) THEN LIBRARY IS NOT EMPTY           
//*                                                         
// ELSE (ISEMPTY.RC NE 0) THEN LIBRARY IS EMPTY             
//*                                                         
// ENDIF (ISEMPTY.RC EQ 0)    LIBRARY IS NOT EMPTY           
//*                                                         
//*==========================================================
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Unable to interpret a hex value to De... COBOL Programming 4
No new posts how to eliminate null indicator value... DB2 7
No new posts Format Binary file to EBCDIC JCL & VSAM 4
No new posts Access to macro definitions PL/I & Assembler 4
No new posts Binary File format getting change whi... All Other Mainframe Topics 7
Search our Forums:

Back to Top