View previous topic :: View next topic
|
Author |
Message |
Vidya Kajale
New User
Joined: 01 Jun 2010 Posts: 43 Location: India
|
|
|
|
Can anybody help me out in developing a sort card to remove 12th and 15th digit from a number of 15 digits and replace the two spaces in the end of 13th digit and also first 4 digits will be spaces using sort utility.
Ex: 123400234126417 should look like ' 1234002341241 ' where number 6 and 7 got removed and two spaces at end and four spaces at begeining. |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
123400234126417 => 15 bytes
1234002341241 + 6 bytes of spaces => 19 bytes
Are you sure this is your requirement?
If yes
Do you need to remove 12th and 15th digit always?
If Yes
OUTREC FIELDS=(4X,5:1,11,16:13,2,18:13,2,2X) |
|
Back to top |
|
|
Vidya Kajale
New User
Joined: 01 Jun 2010 Posts: 43 Location: India
|
|
|
|
Thank you so much. I used sort card OUTREC FIELDS=(4X,5:1,11,16:13,2,2X) to meet my requirement.
But after 19 digit number i am getting unwnted dots in my output file.How to remove those dots? |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Please show all your sort cards, sample input, expected output and output received. |
|
Back to top |
|
|
Vidya Kajale
New User
Joined: 01 Jun 2010 Posts: 43 Location: India
|
|
|
|
Also please let me know what changes should i do to sort card to insert inverted coma at the begining and at the end of my 19 digit number string? |
|
Back to top |
|
|
Vidya Kajale
New User
Joined: 01 Jun 2010 Posts: 43 Location: India
|
|
|
|
i/p: 001234567891012
o/p: 0012345678901 .......................................................................
sort card: SORT FIELDS=COPY
OUTREC FIELDS=(4X,5:1,11,16:13,2,2X)
my o/p is as expected but i don't need extra dots after last spaces. Also o/p should be within inverted comas. |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Try this
Code: |
SORT FIELDS=COPY
OUTREC FIELDS=(4X,5:C'''',6:1,11,17:13,2,19:C'''',61X)
|
|
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Code: |
SORT FIELDS=COPY
OUTREC BUILD=(4X,C'''',1,11,13,2,C'''',80:X) |
I've changed FIELDS to BUILD, as FIELDS is somewhat "overloaded". Since all the data appears naturally at the position of the columns previously specified, I have removed the columns. To "pad" the record, put data in the last byte, unreferenced bytes will automatically be filled by DFSORT.
For "inverted commas" you may mean C'"'. |
|
Back to top |
|
|
Vidya Kajale
New User
Joined: 01 Jun 2010 Posts: 43 Location: India
|
|
|
|
using these sort card i got o/p as:
'0012345678901' .My inverted comas must be before 1st four spaces and after 2 spaces at the ending. |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Thanks Bill
Vidya,
I believe I had spoon fed you enough.Why not try to understand the card and change it to what is needed? |
|
Back to top |
|
|
Vidya Kajale
New User
Joined: 01 Jun 2010 Posts: 43 Location: India
|
|
|
|
Thank you so much.
I got my o/p using sort card: OUTREC FIELDS=(1:C'''',4X,6:1,11,17:13,2,2X,21:C'''',59X)
|
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Vidya,
As Pandora-Box indicates, you really should be able to do that bit yourself.
If you don't understand how, there are excellent manuals referenced in "stickies" at the top of this forum. Consult them, experiment, and understand what has been shown to you, then the final bit will be easy.
If you don't understand the sort card but go ahead with a solution, what are you going to do when someone asks you to change it? Or document it? Or how to do something similar since you've managed that one? |
|
Back to top |
|
|
|