I know this can be obtained by splicing record 1 with record 2 and then splicing the result with record 3. But my original input has 13 records for each key(1,3) and I need to write 12 splice steps.
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
Shajakhan Y.,
welcome to the forum.
Frank and Kolusu are not even awake yet, so to save you some dialog time:
1. insure that you are using DFSORT and not a competitor.
2. Look thru some of the posts answered by Frank and Kolusu and insure that you are providing all the necessary info that they will need to answer your question.
look at some of their questions to other posters,
as well as the job you should run to determine your DFSORT level.
Joined: 08 Nov 2010 Posts: 6 Location: Chennai, India
Hi,
Complexity of my Input Record:
-------------------------------------
Excluding the key column(1,3), The sample input I have provided has only 3 records & 6 columns per key. (2 sets of 3 columns).
But my original input has 13 records & 156 columns (12 sets of 13 columns).
The below SPLICE step can obtain me the desired output for my Sample Input. But applying the same logic to my original input will make things very complex.
//TOOLIN DD *
SPLICE FROM(INPUT) TO(TEMP1) ON(1,4,CH) -
WITHALL -
WITH(09,4) WITH(13,4) -
WITH(21,4) WITH(25,4)
SPLICE FROM(TEMP1) TO(OUTPUT) ON(1,4,CH) -
WITH(13,4) -
WITH(25,4)
/*
I am looking for a simple alternate way to achieve my desired output.
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
Shajakhan Y,
You need to provide more details.
1. What is the LRECL and recfm of the input and output dataset?
2. Do you want to pick up any value other than XXX on each record and string them together as a single record?
3. What happens if you have 2 records with the same string?
ex:
AAA~ABC~EFG~XXX~JKL~
AAA~XXX~DEF~XXX~XXX~MNO~
You have 2 values EFG and DEF for the same key AAA which value need to be picked?
4. Is the input file already sorted on the key (1,3)?
Joined: 08 Nov 2010 Posts: 6 Location: Chennai, India
Hi Skolusu,
What is the LRECL and recfm of the input and output dataset?
The RECFM is FB for both input & output. The LRECL of my original Input is 1200.
Do you want to pick up any value other than XXX on each record and string them together as a single record?
The Input is already sorted on key (1,3). For every key, there will be 13 records. Eg. 'AAA' will have 13 records & 'BBB' will have 13 records...
1st record -> Key in pos (1,3). value in pos (4,3), (43,4) , (95,3), ..
2nd record -> Key in pos (1,3). value in pos (7,3), (47,4), (98,3), ..
3nd record -> Key in pos (1,3). value in pos (10,3), (51,4), (101,3), ..
...
13th record -> key in pos (1,3). value in (40,3), (91,4), ..
My input will be diagonally arranged with SPACES in the remaining places.
(** Actually XXX in the input i have shown is SPACES. I want to show that the data is diagonally arranged, that is why i used XXX here**)
I am new to this forum and i don't know how to post the screenshot of my input.
You have 2 values EFG and DEF for the same key AAA which value need to be picked?
I will not have two values in the same position.
eg:
AAA~ABC~
AAA~XXX~DEF~
AAA~XXX~XXX~GHI~
(** XXX here is SPACES).
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
Hello,
Quote:
I am new to this forum and i don't know how to post the screenshot of my input.
To do this, you use the Code tag.
I've taken your last post and "Code'd" the data as i understand it should be - it won't hurt my feelings if i'm offbase
Code:
AAA~ABC~
AAA~ ~DEF~
AAA~ ~ ~GHI~
When posting data from a termnal, copy/paste the data from the screen, highlight this pasted data, then click Code. There is a Preview function so you can see your post as it will appear to the forum (rather than how it looks n the RFeply Editor). When it appears as you want, Submit.
Joined: 08 Nov 2010 Posts: 6 Location: Chennai, India
Hi all,
I just found that this can be done using the 'WITHANY' operand.
The WITHANY operand of SPLICE can be used to create one spliced record for each set of duplicates. The first duplicate is spliced with the nonblank values of each subsequent duplicate for specified fields.
Joined: 09 Nov 2010 Posts: 27 Location: SHENZHEN CHINA
YEP, IT LOOKS LIKE THE WITHANY OPTION FOR SPLICE IS A NEW FEATURE, THE PUBLICATION OF 'DFSORT APPLICATION PROGRAMMING GUIDE' WHICH I'M READING IS SECOND EDITION, MARCH 2005, THANKS A LOT.