Print particular qualifier from a dataset to putput.

IBM's Sort Product, ICETOOL, ICEMAN and ICEGENER.
Post Reply
RyanFox
Registered Member
Posts: 52
Joined: Sat Jun 15, 2013 12:54 pm

Print particular qualifier from a dataset to putput.

Post by RyanFox »

Hi,

I am looking forward to way to print a particular qualifier of a dataset into a separate file using sort JCL. If dataset is QUAL1.QUAL2.Dyymmdd, I want the yymmdd to be written in output. Please note I don't want D in the o/p.

Please suggest a way to do it.
William Collins
Global Moderator
Global Moderator
Posts: 490
Joined: Sun Aug 25, 2013 7:24 pm

Re: Print particular qualifier from a dataset to putput.

Post by William Collins »

You have the dataset name on a dataset, or are you thinking of the name of the DSN on SYSIN?
RyanFox
Registered Member
Posts: 52
Joined: Sat Jun 15, 2013 12:54 pm

Re: Print particular qualifier from a dataset to putput.

Post by RyanFox »

Thanks for the reply.

I have file names in notepad so any of them I can opt for.
nicc
Global Moderator
Global Moderator
Posts: 691
Joined: Wed Apr 23, 2014 8:45 pm

Re: Print particular qualifier from a dataset to putput.

Post by nicc »

First get your file into a mainframe dataset.
Then run your sort program using that dataset as SORTIN.
Do a COPY operation.
INCLUDE only those records that you want.
BUILD the output using only the input columns that you want.
Regards
Nic
William Collins
Global Moderator
Global Moderator
Posts: 490
Joined: Sun Aug 25, 2013 7:24 pm

Re: Print particular qualifier from a dataset to putput.

Post by William Collins »

If you're talking then of qualifiers which may differ in length and number, there is a trick enrico has mentioned previously.

If you JFY with SHIFT=RIGHT for 1,44 then the last six positions will contain the date you want.
RyanFox
Registered Member
Posts: 52
Joined: Sat Jun 15, 2013 12:54 pm

Re: Print particular qualifier from a dataset to putput.

Post by RyanFox »

Thanks all. but William which trick from enrico you are talking about here. Are you asking to look some other topic from him?
William Collins
Global Moderator
Global Moderator
Posts: 490
Joined: Sun Aug 25, 2013 7:24 pm

Re: Print particular qualifier from a dataset to putput.

Post by William Collins »

The trick of coding what I suggested in the last line. If you slide everything to the right, the data you want is in a known position, no matter how many qualifiers or the lengths of them.
RyanFox
Registered Member
Posts: 52
Joined: Sat Jun 15, 2013 12:54 pm

Re: Print particular qualifier from a dataset to putput.

Post by RyanFox »

William Collins wrote:The trick of coding what I suggested in the last line. If you slide everything to the right, the data you want is in a known position, no matter how many qualifiers or the lengths of them.
Thanks. I did not think about this. But I stil ldon't see any post from enrico in this thread, perhaps you are mentioning about some other thread.
William Collins
Global Moderator
Global Moderator
Posts: 490
Joined: Sun Aug 25, 2013 7:24 pm

Re: Print particular qualifier from a dataset to putput.

Post by William Collins »

Yes, sorry, it is on another site, it is just that I remember enrico posting it. I'll find an example.
enrico-sorichetti
Global Moderator
Global Moderator
Posts: 826
Joined: Wed Sep 11, 2013 3:57 pm

Re: Print particular qualifier from a dataset to putput.

Post by enrico-sorichetti »

But I stil ldon't see any post from enrico in this thread, perhaps you are mentioning about some other thread.
I posted it somewhere else, but frankly I do not remember where :oops:
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-)
RyanFox
Registered Member
Posts: 52
Joined: Sat Jun 15, 2013 12:54 pm

Re: Print particular qualifier from a dataset to putput.

Post by RyanFox »

Hit the enter too fast:

Thanks for the discussion around this. I was not able to login here for a while. If you can post what you have talked about I think many of us will get benefitted.
William Collins
Global Moderator
Global Moderator
Posts: 490
Joined: Sun Aug 25, 2013 7:24 pm

Re: Print particular qualifier from a dataset to putput.

Post by William Collins »

Here's an example:

Code: Select all

//FIXPOS   EXEC PGM=SORT 
//SYSOUT   DD SYSOUT=* 
//SORTOUT  DD SYSOUT=* 
//SYSIN    DD * 
  OPTION COPY 
                                                      
  INREC IFTHEN=(WHEN=INIT, 
                 OVERLAY=(51:7,44,JFY=(SHIFT=RIGHT))),
        IFTHEN=(WHEN=INIT, 
                 BUILD=(1,7,86,9)) 
//SORTIN   DD * 
KEY1 ! ABCDE 1111-1111 
KEY1 ! ABCDE FGH 1111-1112
It is the same principle for a low-level qualifier. If the qualifier is variable-length, it would require a PARSE also, after the data has been shifted. This can be a general way to find the "last", or a fixed-number of "fields" from the end of the record, when it is not known how many fields are on the record.
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 “IBM DFSort, ICETOOL, ICEMAN, ICEGENER.”