View previous topic :: View next topic
|
Author |
Message |
ramsri
Active User
Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
Hi,
File - RECFM=FB, LRECL=90
Input:
Code: |
----+----1----+----2----+----3----+----4
XXXXX1.ICCP.SCLB3H.INL
ICCP.SCLB3H.INL.XXXXX1
ICCP.SCLB3H.INL.CXXXX1
ICCP.SCLB3H.XXXXX1.INL
ICCP.SCLB3H.BXXXX1.INL
ICCP.PXXXX1.SCLB3H.INL
|
I want the "XXXXX1" to be copied to 30th column from above input.
Expected Output:
Code: |
----+----1----+----2----+----3----+----4
XXXXX1.ICCP.SCLB3H.INL XXXXX1
ICCP.SCLB3H.INL.XXXXX1 XXXXX1
ICCP.SCLB3H.INL.CXXXX1 CXXXX1
ICCP.SCLB3H.XXXXX1.INL XXXXX1
ICCP.SCLB3H.BXXXX1.INL BXXXX1
ICCP.PXXXX1.SCLB3H.INL PXXXX1
|
Please help.
Thanks. |
|
Back to top |
|
|
Naish
New User
Joined: 07 Dec 2006 Posts: 82 Location: UK
|
|
|
|
Code: |
----+----1----+----2----+----3----+----4
XXXXX1.ICCP.SCLB3H.INL
ICCP.SCLB3H.INL.XXXXX1
ICCP.SCLB3H.INL.CXXXX1
ICCP.SCLB3H.XXXXX1.INL
ICCP.SCLB3H.BXXXX1.INL
ICCP.PXXXX1.SCLB3H.INL |
1. Is this all you have in your file? or such GROUP records can recur?
2. Is XXXXX1 fixed at its position?
3. IF 1=YES AND 2=YES, use WHEN=GROUP. Its easy brother... try it.. you can do it... |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
You need to explain the rules of getting from input to output a little better since the character in position 30 seems to vary. |
|
Back to top |
|
|
ramsri
Active User
Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
The rule is to copy the word having XXX to 30th position irrespective of its position in input.
Thanks. |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
ramsri wrote: |
The rule is to copy the word having XXX to 30th position irrespective of its position in input.
Thanks. |
That is very different than your original post. |
|
Back to top |
|
|
Naish
New User
Joined: 07 Dec 2006 Posts: 82 Location: UK
|
|
|
|
ramsri wrote: |
The rule is to copy the word having XXX to 30th position irrespective of its position in input.
Thanks. |
What?
ramsri,
1. You have not answered my questions.
2. Now you come back changing your requirements.
3. You look quite experienced too (personal assumption).
4. Please explain clearly what you want. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
You need to start over and post what is really wanted. Your posts are rather inconsistent and do not explaikn what you are trying to accomplish.
You show a "rule" that has 5 Xs, data that has 4 and 5 Xs, data that has some Xs as well as some leading character, and finish with:
Quote: |
The rule is to copy the word having XXX to 30th position |
having only 3 Xs and no mention of how these other characters are supposed to be handled. |
|
Back to top |
|
|
ramsri
Active User
Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
by the time I realized that I wanted add more info to it the EDIT did not allow me because 10 mintues were over..... The word containing XXXX from each input record should be moved to 30th column is what the SORT should achieve. That is a total of 6 characters including the numeral at the last should be moved to new position. That is why I used
Input Data - LRECL=90, RECFM=FB
Code: |
----+----1----+----2----+----3----+----4
XXXXX1.ICCP.SCLB3H.INL
ICCP.SCLB3H.INL.XXXXX1
ICCP.SCLB3H.INL.CXXXX1
ICCP.SCLB3H.XXXXX1.INL
ICCP.SCLB3H.BXXXX1.INL
ICCP.PXXXX1.SCLB3H.INL
|
If each record split into 4 parts, on part definitely contains a word with XXXX appearing in it. I am using only 4X here because the first and last character are changing.
Output:
Code: |
----+----1----+----2----+----3----+----4
XXXXX1.ICCP.SCLB3H.INL XXXXX1
ICCP.SCLB3H.INL.XXXXX1 XXXXX1
ICCP.SCLB3H.INL.CXXXX1 CXXXX1
ICCP.SCLB3H.XXXXX1.INL XXXXX1
ICCP.SCLB3H.BXXXX1.INL BXXXX1
ICCP.PXXXX1.SCLB3H.INL PXXXX1
|
I tried below code but it does not give me expected results except first record
Code: |
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=(1,80,SS,EQ,C'XXXX'),OVERLAY=(30:1,6))
|
Wrong Output:
Code: |
XXXXX1.ICCP.SCLB3H.INL XXXXX1
ICCP.SCLB3H.INL.XXXXX1 ICCP.S
ICCP.SCLB3H.INL.CXXXX1 ICCP.S
ICCP.SCLB3H.XXXXX1.INL ICCP.S
ICCP.SCLB3H.BXXXX1.INL ICCP.S
ICCP.PXXXX1.SCLB3H.INL ICCP.P
|
I hope that I've explained it better ths time
Thanks. |
|
Back to top |
|
|
Naish
New User
Joined: 07 Dec 2006 Posts: 82 Location: UK
|
|
|
|
By the way you got the right output (pun intended).
Anyway, assuming that you have such an input, suggest that you PARSE into 4 fields and then search in each of the PARSED field and then OVERLAY accordingly.
Hope this helps. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
I hope that I've explained it better ths time |
Yup
Quote: |
I tried below code but it does not give me expected results except first record
Code: |
INREC IFTHEN=(WHEN=(1,80,SS,EQ,C'XXXX'),OVERLAY=(30:1,6)) |
|
Because you told the sort to use positions 1-6 no matter where the Xs were found. . . |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Does your value always end with XXXX1?
To put it another way, can you describe the required field accurately. Is the file FB? Length>? |
|
Back to top |
|
|
ramsri
Active User
Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
Bill, its LRECL=90, RECFM=FB.
Its a 6 character field that will have XXXX appearing in the middle. This fields first position may have different alphabet and last position will always be a numeral.
Thanks. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Four PARSEd fields, as Naish said, OVERLAY at the end of the existing record. Test the "middle" of each field for "XXXX". Personally, I'd validate the first and last bytes as well, unless feeling 100% secure about the possibility of not getting a false hitt. I wouldn't use SS looking for s substring.
Plonk the one that matches XXXX (if any) into the correct position on the record.
Assuming that this is connected to your other recent ones, are you going to be looking for multiple values? |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
ramsri,
Use the following DFSORT JCL which will give you the desired results
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
XXXXX1.ICCP.SCLB3H.INL
ICCP.SCLB3H.INL.XXXXX1
ICCP.SCLB3H.INL.CXXXX1
ICCP.SCLB3H.XXXXX1.INL
ICCP.SCLB3H.BXXXX1.INL
ICCP.PXXXX1.SCLB3H.INL
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFOUTLEN=90,IFTHEN=(WHEN=INIT,
PARSE=(%01=(STARTAFT=C'XXX',FIXLEN=3),%02=(SUBPOS=7,FIXLEN=6)),
OVERLAY=(91:%01,X,%02)),
IFTHEN=(WHEN=(95,1,SS,EQ,C'. '),OVERLAY=(30:98,3,91,3)),
IFTHEN=(WHEN=NONE,OVERLAY=(30:95,6))
//* |
|
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
ramsri,
Are you "piecing together" a solution with lthe ittle bits of code supplied to you?
If yes, please instead post the full requirement. There is a chance that people are wasting time with your "movable feast" descriptions.
Is X the letter X, or does it stand for "any letter of the alphabet in any position"? Will you be looking for more than one set of characters? What are you doing with the data once it is in position 30? What topics are you thinking of starting next? |
|
Back to top |
|
|
ramsri
Active User
Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
Hi Kolusu, thanks a lot.......I got the results.
Bill, I won't extend this topic anymore |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Good for you, Ramsri. Thanks for the feedback. |
|
Back to top |
|
|
|