Page 1 of 1

Print particular qualifier from a dataset to putput.

Posted: Wed Sep 09, 2015 10:53 pm
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.

Re: Print particular qualifier from a dataset to putput.

Posted: Thu Sep 10, 2015 12:11 am
by William Collins
You have the dataset name on a dataset, or are you thinking of the name of the DSN on SYSIN?

Re: Print particular qualifier from a dataset to putput.

Posted: Thu Sep 10, 2015 11:45 am
by RyanFox
Thanks for the reply.

I have file names in notepad so any of them I can opt for.

Re: Print particular qualifier from a dataset to putput.

Posted: Thu Sep 10, 2015 3:35 pm
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.

Re: Print particular qualifier from a dataset to putput.

Posted: Thu Sep 10, 2015 3:59 pm
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.

Re: Print particular qualifier from a dataset to putput.

Posted: Sun Sep 13, 2015 10:31 am
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?

Re: Print particular qualifier from a dataset to putput.

Posted: Sun Sep 13, 2015 11:48 am
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.

Re: Print particular qualifier from a dataset to putput.

Posted: Sat Oct 03, 2015 1:17 pm
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.

Re: Print particular qualifier from a dataset to putput.

Posted: Sat Oct 03, 2015 3:18 pm
by William Collins
Yes, sorry, it is on another site, it is just that I remember enrico posting it. I'll find an example.

Re: Print particular qualifier from a dataset to putput.

Posted: Sat Oct 03, 2015 3:19 pm
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:

Re: Print particular qualifier from a dataset to putput.

Posted: Mon Feb 22, 2016 1:55 pm
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.

Re: Print particular qualifier from a dataset to putput.

Posted: Mon Feb 22, 2016 4:44 pm
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.