Page 1 of 1

Extract the data's from Dataset into two datasets

PostPosted: Tue Mar 28, 2017 2:07 pm
by srrc
Dear all,

Hope all are doing great.

I am having a dataset which contains the 100 records.
I want to split this dataset into two dataset.

Input dataset:
=COLS> -1----+----2----+----3----+----4----+----5----+----6----+----7----+
000001                       +--------------------------------------------
000002                     1_| XXX                | 22.03.2017         | 0
000003                     2_| YY                 | 21.03.2017         | 0
000004                     3_| ZZZ                | 20.03.2017         | 1


Am passing value to JP0 as 22.03.2017 and sort card as below
SORT FIELDS=COPY
OUTFIL FILES=01,INCLUDE COND=(54,10,CH,EQ,JP0)
OUTFIL FILES=02,INCLUDE COND=(75,1,CH,EQ,C'1')


Am getting syntax error while executing the above sort.

Output dataset:
I want output dataset as below
=COLS> ----+----1----
000001 XXX 22.03.2017
 

Is it possible to format the output like with include statement?

Thanks in advance.

Sorry for any mistake in the question.

Re: Extract the data's from Dataset into two datasets

PostPosted: Tue Mar 28, 2017 2:32 pm
by NicC
Please cut and paste the relevant part of the SYSOUT (including message identifiers).
(From what you posted it looks like your control cards start in col 1 which is a no-no.)

Re: Extract the data's from Dataset into two datasets

PostPosted: Tue Mar 28, 2017 3:02 pm
by srrc
Dear NicC,

I have changed the sort card (starts from col 4) as below and it worked.

SORT FIELDS=COPY
OUTFIL FNAMES=SORTOF1,INCLUDE=((54,10,CH,EQ,JP0),AND,(75,1,CH,EQ,C'1'))
OUTFIL FNAMES=SORTOF2,INCLUDE=(75,1,CH,EQ,C'1')


It extracted as per the condition given.

but i need the output as mentioned on the 1st post.
am trying with outrec.

Thanks for the reply.

Re: Extract the data's from Dataset into two datasets

PostPosted: Tue Mar 28, 2017 4:48 pm
by srrc
Dear all,

I got the output as I mentioned in the first post.

Now am trying to use Joinkeys.here are the details:

JNF1:
----+----1----
XXX 22.03.2017
YY  21.03.2017
ZZZ 22.03.2017


JNF2:
----+----1----+----2----+----3----+----4----+----5----+----6-
***************************** Top of Data *******************
XXX                01.01.2016                           9  N
AAA                01.01.2016                           6  N


Keys: 1,3 on both datasets.

Sort card:
JOINKEYS FILES=F1,FIELDS=(1,3,A)
JOINKEYS FILES=F2,FIELDS=(1,3,A)
REFORMAT FIELDS=(F2:57,2,F1:1,14)
SORT FIELDS=COPY
OUTREC BUILD=(1,2,X,3,3,X,6,11,62X)

By using the above sortcard am getting the output as follow,
----+----1----+---
9 XXX  22.03.2017
 

But i need the output as below
----+----1----+---
9 XXX  22.03.2017
   YY  21.03.2017
 


Matched and also unmatched from JNF1 with data from JNF2. is this possible?
Thanks in advance.

Re: Extract the data's from Dataset into two datasets

PostPosted: Tue Mar 28, 2017 8:48 pm
by BillyBoyo
You have no JOIN statement, so you get the default, which is of matched records only.

So, you need a JOIN with UNPAIRED,F1 which will give you matched records, plus unmatched F1.

There are probably some efficiencies which can be included for what you have coded so far for the entire process, so maybe post it.

Re: Extract the data's from Dataset into two datasets

PostPosted: Wed Mar 29, 2017 8:28 am
by srrc
Dear BillyBoyo,

yes, I got the output as you mentioned to use Join with UNPAIRED,F1.. Thank you.