Get printed members in alphabetical order with IEBPTPCH.

Other Mainframe related questions which attracts you and there is no suitable Forum you find for it and related FAQs.
Post Reply
Sushant S
Registered Member
Posts: 20
Joined: Fri Aug 16, 2013 2:44 pm

Get printed members in alphabetical order with IEBPTPCH.

Post by Sushant S »

I wanted to print all the members of a PDS to a file. For this, I am using IEBPTPCH. The process works fine and members are printed but the problem is that the members does not follow any or you can say that theya are not in alphabetical order. This is what I have used: 

Code: Select all

PUNCH TYPORG=PO
I am not sure how can we get the members in order. Can you please help if there are some parameters which I can pass to make the output data sorted by member name?
enrico-sorichetti
Global Moderator
Global Moderator
Posts: 826
Joined: Wed Sep 11, 2013 3:57 pm

Re: Get printed members in alphabetical order with IEBPTPCH.

Post by enrico-sorichetti »

1) get the member list ONLY
2) sort them and build the control statement for step3
3) run IEBPTPCH whit the control statements generated by step 2

OR
use the ISPF LMM*** services to do it using a rexx script
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort 8-)
User avatar
Anuj Dhawan
Founder
Posts: 2802
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: Get printed members in alphabetical order with IEBPTPCH.

Post by Anuj Dhawan »

The output of IEBPTPCH, for an all-member run,  might appear in random order. Though there is an order. IEBPTPCH will read the directory of a PDS and sorts the members of it by TTRC order (Relative Track Number) and not in alphabetical order. To determine the output order of an all member run you need to produce an IEHLIST of the PDS directory:

Code: Select all

//IEHLIST  JOB  ACCT,'LIST PDS',MSGCLASS=A,CLASS=B

Code: Select all

//STEP0001 EXEC PGM=IEHLIST
//SYSPRINT DD SYSOUT=*
//PDS1     DD DSN=your.pds.name,DISP=OLD
//SYSIN    DD *
  LISTPDS DSNAME=your.pds.name,FORMAT
/*
A sample of partail output is shown below:

Code: Select all

MEMBERS  TTRC
TESTMEM1 0000100F
TESTMEM2 0000040F <-- First member IEBPTPCH will process
TESTMEM3 00003C0F <-- Last member IEBPTPCH will process
TESTMEM4 00000A0F
TESTMEM5 00000B0F
TESTMEM6 00000C0F
TESTMEM7 00000D0F
TESTMEM8 00000E0F
TESTMEM1 0000060F <-- Second member IEBPTPCH will process
Some search over the internet and it looks like that this method is probably a holdover from the OS/360 days when PDS’s 
were first introduced. This actually reduces the time, to a great extent, to process the entire dataset and send the output 
to the physical printer or card punch. But it’s a non-practical method in today's world when no one uses punched cards anymore. 


Look at this APAR, OA45799, which addresses the follwoing problem:
IEBPTPCH currently does not specify the order in which it will print or punch members of a PDS or PDSE. When MEMBER control statements are not used (the entire PDS/PDSE is printed/punched), the members are processed in TTR order.  When MEMBER control statements are used, the members are processed in the order in which the members are specified.
There is another method apart from what Enrico has suggested:

Code: Select all

//S1 EXEC SAS

Code: Select all

// OPTIONS='MACRO'
//PDSIN DD DISP=SHR,DSN=your.pds.name
//PSDOUT DD DSN=output-dataset,
// DISP=OLD,
// UNIT=SYSDA,SPACE=(CYL,(10,20),RLSE),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=0)
//SYSIN DD *,DLM=ZZ
PROC SOURCE
INDD=PDSIN
OUTDD=PSDOUT
NOPRINT
NULL;
RUN;
ZZ
The members are unloaded in alphabetical order separated by the IEBUPDTE control statement:

Code: Select all

./ ADD NAME=member-name
You can use the follwoing SAS control statements to eliminate the IEBUPDTE control statement:

Code: Select all

//S1 EXEC SAS
// OPTIONS='MACRO'
//PDSIN DD DISP=SHR,DSN=your.pds.name
//PSDOUT DD DSN=output-dataset,
// DISP=OLD,
// UNIT=SYSDA,SPACE=(CYL,(10,20),RLSE),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=0)
//SYSIN DD *,DLM=ZZ
PROC SOURCE
INDD=PDSIN
OUTDD=PSDOUT
NOPRINT
NULL;
FIRST '%%%%%% START of entire dataset %%%%%%';
BEFORE'%%%%%% START OF NEW MEMBER %%%%%%';
AFTER '%%%%%% END OF MEMBER %%%%%%';
LAST '%%%%%% END entire dataset %%%%%%';
RUN;
ZZ
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
nicc
Global Moderator
Global Moderator
Posts: 691
Joined: Wed Apr 23, 2014 8:45 pm

Re: Get printed members in alphabetical order with IEBPTPCH.

Post by nicc »

Why the 8M region on the IEHLIST? It should run in a few K!
Regards
Nic
User avatar
Anuj Dhawan
Founder
Posts: 2802
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: Get printed members in alphabetical order with IEBPTPCH.

Post by Anuj Dhawan »

Yes, it should. Edited.
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
Sushant S
Registered Member
Posts: 20
Joined: Fri Aug 16, 2013 2:44 pm

Re: Get printed members in alphabetical order with IEBPTPCH.

Post by Sushant S »

Thank you so much for the answers ! Excellent help. :) :)
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “Other Mainframe Topics, Off-Topics, FAQs.”