Page 1 of 1

JCL SORT

PostPosted: Sun Jun 19, 2016 12:27 am
by rahul_ibm
Hi All

I have one file (File 1) which unloads data from a table whenever a request comes.
The file contains a 10 digit id. Say 0000000090

I have another file (File 2) which contains the below query.
The query is " WHERE I_CAMPAIGN = 0000000080 "

I want to sort these two files and create another output file such that the resulting file contains
WHERE I_CAMPAIGN = 0000000090

The requirement is to just replace the campaign_id in second file with the new campaign_id of first file whenever a new request comes.

Can anyone please help me to solve this.

Re: JCL SORT

PostPosted: Sun Jun 19, 2016 12:38 am
by BillyBoyo
 OPTION COPY
  INREC BUILD=(C'" WHERE I_CAMPAIGN = ',1,10,C' "')


As you have described it, there is no need to for second file to be used as input - it contains a constant value, and a value you want to use from the first file. So just take the data from the first file and use constants.

Re: JCL SORT

PostPosted: Sun Jun 19, 2016 1:07 am
by rahul_ibm
Thank you for replying.

But is there any way that i can do this using both the files.

Re: JCL SORT

PostPosted: Sun Jun 19, 2016 1:18 am
by enrico-sorichetti
But is there any way that i can do this using both the files.

why should we waste time when You already got what You asked for ?
since the content of the second dataset is irrelevant , why do You feel that it is important to use it (*) ?
(*) for what ?

Re: JCL SORT

PostPosted: Sun Jun 19, 2016 1:48 am
by rahul_ibm
No, I just wanted to know it to get a knowledge of it.
Anyways its fine. And I am happy with the solution provided.

Thanks Billy and Enrico. :-)

Re: JCL SORT

PostPosted: Sun Jun 19, 2016 1:49 pm
by NicC
What has this got to do with JCL? Apart from the topic title, "JCL SORT", JCL is not mentioned. And JCL SORT is a stupid title - it is uninformative which does not help when people are searching for solutions to problems similar to yours. Topic moved to correct part of the forum.

BTW, you do not have a file - or two - you have datasets.

Re: JCL SORT

PostPosted: Sun Jun 19, 2016 5:07 pm
by steve-myers
NicC wrote:... BTW, you do not have a file - or two - you have datasets.

NiC is absolutely right. The only "file" in z?OS systems is the data between the beginning of a tape and a "file mark," or the data between two "file marks." A "file mark" on a magnetic tape, in turn is a special data record written in a way that ensures it will get the attention of the control units that operate a tape drive that it is not ordinary data.

By the way: it is "data sets" (yes, two words), not "datasets" (one non-existent word). A mistake I'm embarrassed to confess I too, have made.