View previous topic :: View next topic
|
Author |
Message |
ramsri
Active User
Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
Hi,
I have two records like shown below and want to put info appearing at 65th column (three characters) from 02 rec on to 03 rec. (LRECL = 80, RECFM = FB)
Input:
Code: |
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
02XXX ABCXXX99VOT 2013102 000999999990000100009999999900001OVRTP 9AB39
03XXX ABCXXXRAMARAO C MELLI 11 SEVEN ROADS
|
Expected Output:
Code: |
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
02XXX ABCXXX99VOT 2013102 000999999990000100009999999900001OVRTP 9AB39
03XXX ABCXXXRAMARAO C MELLI 11 SEVEN ROADS OVR
|
I've tried below SPLICE but don't get expected output
Code: |
//TOOLIN DD *
SPLICE FROM(IN) TO(OUT) ON(10,6,CH) WITH(65,3) WITHALL KEEPBASE
|
Please help. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Ramsri,
Do you have just 2 records in the entire input? If so you could use WHEN=GROUP RECORDS=2 and PUSH the 3 bytes at pos-65 |
|
Back to top |
|
|
ramsri
Active User
Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
Arun, thanks......its a big file.......looking for SPLICE way of it. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
ramsri wrote: |
Arun, thanks......its a big file.......looking for SPLICE way of it. |
I believe the 'SPLICE way' is not a part of your requirement.
The initial post just showed 2 records and you wanted to push/propagate one field from record-1 to record-2. If your input file has more than 2 records, then show a sample with more records and do a better way of explaining what exactly you are trying to achieve. |
|
Back to top |
|
|
ramsri
Active User
Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
entire file will have 02 and 03 as shown earlier. I kept 03 first followed by 02
Code: |
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
03XXX ABCXXXRAMARAO C MELLI 11 SEVEN ROADS
02XXX ABCXXX99VOT 2013102 000999999990000100009999999900001OVRTP 9AB39
|
and used below TOOLIN
Code: |
//TOOLIN DD *
SPLICE FROM(IN) TO(OUT) ON(10,6,CH) WITH(65,3)
|
Output:
Code: |
03XXX ABCXXXRAMARAO C MELLI 11 SEVEN ROADS OVR
|
Thanks.
Its working but partially as I could not retain 02 record.
Thanks. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
ramsri wrote: |
Its working but partially |
Someone trying to help you may well be looking for your "expected output", NOT partially working code/output. Your first post showed 02XXX-record followed by 03XXX, where as it just got reversed in your latest post.
Arun Raj wrote: |
If your input file has more than 2 records, then show a sample with more records and do a better way of explaining what exactly you are trying to achieve. |
|
|
Back to top |
|
|
ramsri
Active User
Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
Arun, your WHEN=GROUP idea has given me results........thanks a lot.
Code: |
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,RECORDS=2,PUSH=(65:65,3))
|
|
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Ramsri,
Are you sure about that? It it going to do the PUSH, unconditionally, for every record on your file. |
|
Back to top |
|
|
ramsri
Active User
Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
Bill, yes.......ran the job and got expected results too......thanks. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Ramsri,
You're welcome.
One of those cases where we could help the TS in arriving at a solution, without having any clue on what the actual requirement was . My best guess is that the input file has the above 2-record set repeated through out the file. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Suggest you make sure you have used proper data for the test.
There may be some condition(s) that will fail, but haven't been included in the test imput. |
|
Back to top |
|
|
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1205 Location: Dublin, Ireland
|
|
|
|
.. so.. Wednesday was psychic day this week...
Garry |
|
Back to top |
|
|
|