View previous topic :: View next topic
|
Author |
Message |
vinuk2009
New User
Joined: 30 Apr 2009 Posts: 19 Location: chennai
|
|
|
|
Hi,
I have a file with LRECL 300 and FB. it is a flat file. Presently in the 90th position sign (i.e. '-') is there for some records and some records are strated which don't have sign in 90th position. I need to insert space or '+' in 90th position for all the records which don't have '-' and the column shold strat in 91st position. same like this I need to do in 114 th position, 150th position in same file. Could some one please let me know is it possible using sort? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Post some sample input and the output you want from the sample input. These do not need to be full-length records, just enough to show your requirement. Post the rules needed to get from the nput to the output.
Mention the dsorg and lrecl of the files. |
|
Back to top |
|
|
vinuk2009
New User
Joined: 30 Apr 2009 Posts: 19 Location: chennai
|
|
|
|
Hi Dick,
here is the example
Input file
Code: |
90 91 92 ..........114 115 116 ....................150 151 153........... cols
1 0 0 .............- 1 0 ....................2 0 0 ...........
- 2 0 ............2 0 0 ....................- 1 0 ..........
3 0 0 .............- 2 0 ....................- 2 0 ...........
|
Ouptut file
Code: |
90 91 92 93 .......114 115 116 117...............150 151 152 153..........
+ 1 0 0 .......- 1 0 ...............+ 2 0 0 ..........
- 2 0 ........+ 2 0 0 ................- 1 0 ..........
+ 3 0 0 ........- 2 0 ................- 2 0 .......... |
DSORG = PS and LRECL =300 and RECFM = FB |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
please learn to use the tags ( code tag in this case )
they will keep the data You enter aligned and make things easier for people willing to help
and using the preview button before the submit one will let You see what Your post will look like
I edited Your post to let You see what it looks like,
please repost just the file part properly aligned and I will cleanup everything after that |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
follow on
I reformatted in a more ( IMHO ) readable fashion
Input file
Code: |
0 0 0 0 ... 1 1 1 1 ... 1 1 1 1 .......... cols
9 9 9 9 ... 1 1 1 1 ... 5 5 5 5 .......... cols
0 1 2 3 ... 4 5 6 7 ... 0 1 3 4 .......... cols
1 0 0 . ... - 1 0 . ... 2 0 0 . .......... data
- 2 0 . ... 2 0 0 . ... - 1 0 . .......... data
3 0 0 . ... - 2 0 . ... - 2 0 . .......... data
|
Ouptut file
Code: |
0 0 0 0 ... 1 1 1 1 ... 1 1 1 1 .......... cols
9 9 9 9 ... 1 1 1 1 ... 5 5 5 5 .......... cols
0 1 2 3 ... 4 5 6 7 ... 0 1 3 4 .......... cols
+ 1 0 0 ... - 1 0 B ... + 2 0 0 .......... data
- 2 0 B ... + 2 0 0 ... - 1 0 B .......... data
+ 3 0 0 ... - 2 0 B ... - 2 0 0 .......... data
|
do You realize that You will lose the previous content of columns 93,117,154 ?
unless You shift everiyhing and change the column accordingly |
|
Back to top |
|
|
vinuk2009
New User
Joined: 30 Apr 2009 Posts: 19 Location: chennai
|
|
|
|
Hi Enrico,
Thank you for reformating my data. I tried to reformat before post. But I didn't get success. Going forward I will follow your suggestion. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
the best way to format correctly is to edit/build the post in an editor with a fixed font ( without using tabs )
and after that cut and paste into the forum reply box
I hope I reformatted correctly,
but You still have to answer the question about shifting or overlaying |
|
Back to top |
|
|
|